Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
selesnow authored Oct 31, 2019
1 parent 8ec5a6d commit 5d804dc
Show file tree
Hide file tree
Showing 7 changed files with 198 additions and 89 deletions.
37 changes: 28 additions & 9 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
Package: ryandexdirect
Type: Package
Title: Load Data From Yandex Direct
Version: 3.2.0.9000
Date: 2019-06-20
Description: Load data from 'Yandex Direct' API V5 <https://tech.yandex.ru/direct/doc/dg/concepts/about-docpage/> into R. Provide function for load lists of campaings, ads, keywords and other objects from 'Yandex Direct' account. Also you can load statistic from API 'Reports Service' <https://tech.yandex.ru/direct/doc/reports/reports-docpage/>. And allows keyword bids management.
Title: Load Data From 'Yandex Direct'
Version: 3.2.2
Date: 2019-10-31
Description: Load data from 'Yandex Direct' API V5
<https://tech.yandex.ru/direct/doc/dg/concepts/about-docpage/> into R.
Provide function for load lists of campaings, ads, keywords and other
objects from 'Yandex Direct' account. Also you can load statistic from
API 'Reports Service' <https://tech.yandex.ru/direct/doc/reports/reports-docpage/>.
And allows keyword bids management.
License: GPL-2
Authors@R: c(person(given = "Alexey", family = "Seleznev", role = c("aut", "cre"), email = "[email protected]"))
Authors@R:
c(person(given = "Alexey",
family = "Seleznev",
role = c("aut", "cre"),
email = "[email protected]"))
Author: Alexey Seleznev [aut, cre]
Maintainer: Alexey Seleznev <[email protected]>
Depends: R (>= 3.5.0)
BugReports: https://github.com/selesnow/ryandexdirect/issues
URL: https://selesnow.github.io/ryandexdirect
Imports: utils, httr, bitops, jsonlite, xml2, data.table, readr, magrittr, dplyr
Suggests: knitr, rmarkdown, kableExtra
VignetteBuilder: knitr
URL: https://selesnow.github.io/ryandexdirect, https://t.me/R4marketing
Imports: utils,
httr,
bitops,
jsonlite,
xml2,
data.table,
readr,
magrittr,
dplyr
Suggests: knitr,
rmarkdown,
kableExtra
Encoding: UTF-8
Language: ru
VignetteBuilder: knitr
32 changes: 32 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,52 @@
# ryandexdirect 3.2.2

дата: 2019-10-31

* Функция `yadirGetCampaignList()` с версии 3.2.2 считается устаревшей. Она будет присутвовать в пакете, но не будет развиваться. Вместо неё рекомендуется использовать функцию `yadirGetCampaign()`.
* В таблицу возвращаемую функцией `yadirGetCampaign()` добавлены новые поля:
* SourceId - Идентификатор исходной кампании в у. е., если текущая кампания была создана автоматически при переходе рекламодателя на работу в валюту.
* FundsMode - Тип финансовых показателей кампании:
* CAMPAIGN_FUNDS — общий счет не подключен, финансовые показатели кампании возвращаются в поле CampaignFundsBalance;
* SHARED_ACCOUNT_FUNDS — общий счет подключен, финансовые показатели кампании возвращаются в поле SharedAccountFundsSpend.
* CampaignFundsBalance - Текущий баланс кампании в валюте рекламодателя, без учета НДС.
* CampaignFundsBalanceBonus - Скидочный бонус. Параметр утратил актуальность.
* CampaignFundsSumAvailableForTransfer - Сумма, доступная для переноса на другую кампанию, в валюте рекламодателя, без учета НДС.
* SharedAccountFundsRefund - Параметр утратил актуальность, всегда возвращается значение 0.
* SharedAccountFundsSpend - Сумма средств, израсходованных по данной кампании за все время ее существования, с учетом НДС.
* AttributionModel - Модель атрибуции, используемая для оптимизации конверсий:
* FC — первый переход.
* LC — последний переход.
* LSC — последний значимый переход.
* LYDC — последний переход из Яндекс.Директа.
* В пакете появился документ со всеми устаревшими функциями, посмотреть его можно с помощью команды `help("ryandexdirect-deprecated")`.

# ryandexdirect 3.2.1
* В `yadirGetKeyWordsBids` исправлена ошибка возникающая при запросе данных по 1 ключевому слову.
* В `yadirSetAutoKeyWordsBids` исправлена ошибка `object 'StrategyPriority' not found`.

# ryandexdirect 3.2.0
* В пакет добавлены функции для управления ставками ключевых слов
* yadirGetKeyWordsBids
* yadirSetKeyWordsBids
* yadirSetAutoKeyWordsBids

Описание релиза на [GitHub](https://github.com/selesnow/ryandexdirect/releases/tag/3.2.0).

# ryandexdirect 3.1.6
* В пакет добавлены виньетки
* Подробная виньетка о загрузке статистики из рекламных аккаунтов Яндекс Директ: `vignette("yandex-direct-get-statistic", package = "ryandexdirect")`
* Подробная виньетка про авторизацию и работу с учётными данными: `vignette("yandex-direct-auth", package = "ryandexdirect")`
* Для обработки лимита в 1 000 000 строк в функцию `yadirGetReport` добавлен аргумент FetchBy. Подробнее об этом можно узнать из описания релиза на GitHub.
* Исправлена проблема, которая возникала при запросе статистики сразу из нескольких клиентских аккаунтов.

Описание релиза на [GitHub](https://github.com/selesnow/ryandexdirect/releases/tag/3.1.6).

# ryandexdirect 3.1.4
* В результат возвращаемый функцией `yadirGetCampaign` добалены следующие поля:
* SearchBidStrategyType - Тип стратегии показа на поиске
* NetworkBidStrategyType - Тип стратегии показа в сетях

Описание релиза на [GitHub](https://github.com/selesnow/ryandexdirect/releases/tag/3.1.5).

# ryandexdirect 3.1.1
* Исправлена ошибка в функции `yadirAuth`, возникающая после обновления просроченного токена.
Expand Down
33 changes: 29 additions & 4 deletions R/yadirGetCampaign.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,27 @@ yadirGetCampaign <-
Type = character(0),
Status = character(0),
State = character(0),
StatusPayment = character(0),
SourceId = double(0),
DailyBudgetAmount = double(0),
DailyBudgetMode = character(0),
Currency = character(0),
StartDate = as.Date(character(0)),
Impressions = integer(0),
Clicks = integer(0),
ClientInfo = character(0),
FundsMode = character(0),
CampaignFundsBalance = double(0),
CampaignFundsBalanceBonus = double(0),
CampaignFundsSumAvailableForTransfer = double(0),
SharedAccountFundsRefund = double(0),
SharedAccountFundsSpend = double(0),
TextCampBidStrategySearchType = character(0),
TextCampBidStrategyNetworkType = character(0),
TextCampAttributionModel = character(0),
DynCampBidStrategySearchType = character(0),
DynCampBidStrategyNetworkType = character(0),
DynCampAttributionModel = character(0),
MobCampBidStrategySearchType = character(0),
MobCampBidStrategyNetworkType = character(0),
CpmBannerBidStrategySearchType = character(0),
Expand Down Expand Up @@ -63,14 +73,17 @@ yadirGetCampaign <-
\"Type\",
\"StartDate\",
\"Status\",
\"StatusPayment\",
\"SourceId\",
\"State\",
\"Statistics\",
\"Funds\",
\"Currency\",
\"DailyBudget\",
\"ClientInfo\"],
\"TextCampaignFieldNames\": [\"BiddingStrategy\"],
\"TextCampaignFieldNames\": [\"BiddingStrategy\",\"AttributionModel\"],
\"MobileAppCampaignFieldNames\": [\"BiddingStrategy\"],
\"DynamicTextCampaignFieldNames\": [\"BiddingStrategy\"],
\"DynamicTextCampaignFieldNames\": [\"BiddingStrategy\",\"AttributionModel\"],
\"CpmBannerCampaignFieldNames\": [\"BiddingStrategy\"],
\"Page\": {
\"Limit\": 10000,
Expand Down Expand Up @@ -103,17 +116,27 @@ yadirGetCampaign <-
Type = dataRaw$result$Campaigns[[i]]$Type,
Status = dataRaw$result$Campaigns[[i]]$Status,
State = dataRaw$result$Campaigns[[i]]$State,
StatusPayment = dataRaw$result$Campaigns[[i]]$StatusPayment,
SourceId = ifelse(is.null(dataRaw$result$Campaigns[[i]]$SourceId), NA, dataRaw$result$Campaigns[[i]]$SourceId),
DailyBudgetAmount = ifelse(is.null(dataRaw$result$Campaigns[[i]]$DailyBudget$Amount), NA, dataRaw$result$Campaigns[[i]]$DailyBudget$Amount / 1000000),
DailyBudgetMode = ifelse(is.null(dataRaw$result$Campaigns[[i]]$DailyBudget$Mode), NA, dataRaw$result$Campaigns[[i]]$DailyBudget$Mode),
Currency = dataRaw$result$Campaigns[[i]]$Currency,
StartDate = dataRaw$result$Campaigns[[i]]$StartDate,
Impressions = ifelse(is.null(dataRaw$result$Campaigns[[i]]$Statistics$Impressions), NA,dataRaw$result$Campaigns[[i]]$Statistics$Impressions),
Clicks = ifelse(is.null(dataRaw$result$Campaigns[[i]]$Statistics$Clicks), NA,dataRaw$result$Campaigns[[i]]$Statistics$Clicks),
ClientInfo = dataRaw$result$Campaigns[[i]]$ClientInfo,
FundsMode = dataRaw$result$Campaigns[[i]]$Funds$Mode,
CampaignFundsBalance = ifelse(is.null(dataRaw$result$Campaigns[[i]]$Funds$CampaignFunds$Balance), NA, dataRaw$result$Campaigns[[i]]$Funds$CampaignFunds$Balance / 1000000),
CampaignFundsBalanceBonus = ifelse(is.null(dataRaw$result$Campaigns[[i]]$Funds$CampaignFunds$BalanceBonus), NA, dataRaw$result$Campaigns[[i]]$Funds$CampaignFunds$BalanceBonus / 1000000),
CampaignFundsSumAvailableForTransfer = ifelse(is.null(dataRaw$result$Campaigns[[i]]$Funds$CampaignFunds$SumAvailableForTransfer), NA, dataRaw$result$Campaigns[[i]]$Funds$CampaignFunds$SumAvailableForTransfer / 1000000),
SharedAccountFundsRefund = ifelse(is.null(dataRaw$result$Campaigns[[i]]$Funds$SharedAccountFunds$Refund), NA, dataRaw$result$Campaigns[[i]]$Funds$CampaignFunds$Refund / 1000000),
SharedAccountFundsSpend = ifelse(is.null(dataRaw$result$Campaigns[[i]]$Funds$SharedAccountFunds$Spend), NA, dataRaw$result$Campaigns[[i]]$Funds$SharedAccountFunds$Spend / 1000000),
TextCampBidStrategySearchType = ifelse(is.null(dataRaw$result$Campaigns[[i]]$TextCampaign$BiddingStrategy$Search$BiddingStrategyType), "", dataRaw$result$Campaigns[[i]]$TextCampaign$BiddingStrategy$Search$BiddingStrategyType),
TextCampBidStrategyNetworkType = ifelse(is.null(dataRaw$result$Campaigns[[i]]$TextCampaign$BiddingStrategy$Network$BiddingStrategyType), "", dataRaw$result$Campaigns[[i]]$TextCampaign$BiddingStrategy$Network$BiddingStrategyType),
TextCampAttributionModel = ifelse(is.null(dataRaw$result$Campaigns[[i]]$TextCampaign$AttributionModel), "", dataRaw$result$Campaigns[[i]]$TextCampaign$AttributionModel),
DynCampBidStrategySearchType = ifelse(is.null(dataRaw$result$Campaigns[[i]]$DynamicTextCampaign$BiddingStrategy$Search$BiddingStrategyType), "", dataRaw$result$Campaigns[[i]]$DynamicTextCampaign$BiddingStrategy$Search$BiddingStrategyType),
DynCampBidStrategyNetworkType = ifelse(is.null(dataRaw$result$Campaigns[[i]]$DynamicTextCampaign$BiddingStrategy$Network$BiddingStrategyType), "", dataRaw$result$Campaigns[[i]]$DynamicTextCampaign$BiddingStrategy$Network$BiddingStrategyType),
DynCampAttributionModel = ifelse(is.null(dataRaw$result$Campaigns[[i]]$DynamicTextCampaign$AttributionModel), "", dataRaw$result$Campaigns[[i]]$DynamicTextCampaign$AttributionModel),
MobCampBidStrategySearchType = ifelse(is.null(dataRaw$result$Campaigns[[i]]$MobileAppCampaign$BiddingStrategy$Search$BiddingStrategyType), "", dataRaw$result$Campaigns[[i]]$MobileAppCampaign$BiddingStrategy$Search$BiddingStrategyType),
MobCampBidStrategyNetworkType = ifelse(is.null(dataRaw$result$Campaigns[[i]]$MobileAppCampaign$BiddingStrategy$Network$BiddingStrategyType), "", dataRaw$result$Campaigns[[i]]$MobileAppCampaign$BiddingStrategy$Network$BiddingStrategyType),
CpmBannerBidStrategySearchType = ifelse(is.null(dataRaw$result$Campaigns[[i]]$CpmBannerCampaign$BiddingStrategy$Search$BiddingStrategyType), "", dataRaw$result$Campaigns[[i]]$CpmBannerCampaign$BiddingStrategy$Search$BiddingStrategyType),
Expand All @@ -136,7 +159,7 @@ yadirGetCampaign <-
result$Currency <- as.factor(result$Currency)
result$SearchBidStrategyType <- paste0(result$TextCampBidStrategySearchType, result$DynCampBidStrategySearchType, result$MobCampBidStrategySearchType, result$CpmBannerBidStrategySearchType)
result$NetworkBidStrategyType <- paste0(result$TextCampBidStrategyNetworkType, result$DynCampBidStrategyNetworkType, result$MobCampBidStrategyNetworkType, result$CpmBannerBidStrategyNetworkType)

result$AttributionModel <- paste0(result$TextCampAttributionModel, result$DynCampAttributionModel)
# removing
result$TextCampBidStrategySearchType <- NULL
result$TextCampBidStrategyNetworkType <- NULL
Expand All @@ -146,7 +169,9 @@ yadirGetCampaign <-
result$MobCampBidStrategyNetworkType <- NULL
result$CpmBannerBidStrategySearchType <- NULL
result$CpmBannerBidStrategyNetworkType <- NULL

result$TextCampAttributionModel <- NULL
result$DynCampAttributionModel <- NULL

# end timr
stop_time <- Sys.time()

Expand Down
5 changes: 5 additions & 0 deletions R/yadirGetCampaignList.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ yadirGetCampaignList <-
AgencyAccount = NULL,
TokenPath = getwd()) {

# depricating
.Deprecated(new = "yadirGetCampaign()",
package = "ryandexdirect",
old = "yadirGetCampaignList()")

# start time
start_time <- Sys.time()

Expand Down
10 changes: 8 additions & 2 deletions R/yadirGetKeyWordsBids.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ yadirGetKeyWordsBids <- function(KeywordIds = NULL,
start_time <- Sys.time()

# auth
Token <- ryandexdirect:::tech_auth(login = Login,
Token <- tech_auth(login = Login,
token = Token,
AgencyAccount = AgencyAccount,
TokenPath = TokenPath)
Expand Down Expand Up @@ -83,7 +83,13 @@ yadirGetKeyWordsBids <- function(KeywordIds = NULL,

# start of coleccting
for (part_of_id in id_parts) {


if ( length(part_of_id) == 1 ) {

part_of_id <- list(part_of_id)

}

# detect ids and object
if ( object == "keywords" ) {
query_list$params$SelectionCriteria$KeywordIds <- part_of_id
Expand Down
Loading

0 comments on commit 5d804dc

Please sign in to comment.