Learn R Programming

ryandexdirect (version 3.6.2)

yadirGetReport: Get Report From 'Yandex Direct Report Service'

Description

The 'Service Report' is designed to get statistics on the advertiser's account. You must set period, choose report type and needed fields, and get statistic.

Usage

yadirGetReport(ReportType = "CUSTOM_REPORT", DateRangeType =
                 "CUSTOM_DATE", DateFrom = Sys.Date() - 31, 
                 DateTo = Sys.Date() - 1,
                 FieldNames = c("CampaignName", "Impressions",
                 "Clicks", "Cost"), FilterList = NULL, Goals = NULL,
                 AttributionModels = NULL, IncludeVAT = "YES",
                 IncludeDiscount = "NO", Login = getOption("ryandexdirect.user"), 
                 AgencyAccount = getOption("ryandexdirect.agency_account"), 
                 FetchBy = NULL, Token = NULL, TokenPath = yadirTokenPath(), 
				 SkipErrors = TRUE)

Value

Data frame with the requested fields

Arguments

ReportType

Report level, one from ACCOUNT_PERFORMANCE_REPORT, CAMPAIGN_PERFORMANCE_REPORT, ADGROUP_PERFORMANCE_REPORT, AD_PERFORMANCE_REPORT, CRITERIA_PERFORMANCE_REPORT, CUSTOM_REPORT, SEARCH_QUERY_PERFORMANCE_REPORT. For detail go https://tech.yandex.ru/direct/doc/reports/type-docpage/

DateRangeType

Reporting period, one from TODAY, YESTERDAY, LAST_3_DAYS, LAST_5_DAYS, LAST_7_DAYS, LAST_14_DAYS, LAST_30_DAYS, LAST_90_DAYS, LAST_365_DAYS, THIS_WEEK_MON_TODAY ,THIS_WEEK_SUN_TODAY, LAST_WEEK, LAST_BUSINESS_WEEK, LAST_WEEK_SUN_SAT, THIS_MONTH, LAST_MONTH, ALL_TIME, CUSTOM_DATE, AUTO. For detail go https://tech.yandex.ru/direct/doc/reports/period-docpage/

DateFrom

If your select CUSTOM_DATE in DateRangeType you must enter start date in this argument in YYYY-MM-DD format else you can not used this argument

DateTo

If your select CUSTOM_DATE in DateRangeType you must enter end date in this argument in YYYY-MM-DD format else you can not used this argument

FieldNames

Character vector with field names list, for example c("Date","CampaignName","Impressions","Clicks"), for more ditails go https://yandex.ru/dev/direct/doc/reports/fields-list-docpage

FilterList

Character vector with rows filters, for example c("Clicks GREATER_THAN 99","Impressions LESS_THAN 1000"), for more details go https://tech.yandex.ru/direct/doc/reports/filters-docpage/

Goals

integer vector, id of the Yandex.Metric goals for which you want to get statistics. No more than 10 elements in the array. For example c(182453, 182452, 23458860).

AttributionModels

Attribution models used in the calculation of data on Yandex.Metrica goals. For example c("LSC", "LC", "FC"), see detail for more information.

IncludeVAT

Include or exclude VAT, one of "NO" or "YES"

IncludeDiscount

Include or exclude Discount, one of "NO" or "YES"

Login

Your Yandex Login

AgencyAccount

Your agency account login, if you get statistic from client account

FetchBy

Split the query by date range. Allowed values: "DAY", "WEEK", "MONTH", "QUARTER", "YEAR".

TokenPath

Path to directory where you save credential data

Token

character or list object, your Yandex API Token, you can get this by function yadirGetToken or yadirAuth

SkipErrors

Logical, if TRUE function skip all errors of API answer

Author

Alexey Seleznev

Details

Attribution model is the rule, what transition to consider the source of the visit.

Possible Values:

FC

The first transition. The source of any visitor visits is his first visit to the site in the last 180 days. This model allows you to track the source of advertising, which first brought the client and thereby influenced all subsequent interactions with the site.

LC

The last transition. The source of the visit is considered to be a transition, as a result of which the visitor is currently visiting the site, regardless of the history of visits. This model can be used in the technical analysis of the site. To assess the performance of advertising campaigns, use the Last significant transition model.

LSC

Is the last significant transition. All sources of transitions for the last 90 days are conventionally divided into significant (your ads) and insignificant (transitions from saved pages, internal transitions or direct visits to the site). The source of the visit is considered to be an ad transition. If the visit occurred after an insignificant transition, then its source is considered the last transition on the ad. This model allows you to take into account the conversions that are lost in the model Last transition due to technical limitations on the duration of the visit.

LYDC

Last click from Yandex.Direct. Of all the recent significant transitions, only Direct is taken into account. If a user at least once went to the site by an ad in Yandex.Direct, then this transition is considered the source of all subsequent visits - until the user clicks on the ad again. This model helps to see all the visits associated with the Directorate, including those that would be attributed to other sources in other attribution models.

The AttributionModels parameter can be specified only if the Goals parameter is specified. If the Goals parameter is specified, and the AttributionModels parameter is not, the default value is LSC.

If several attribution models are specified, the data will be displayed for each model separately.

References

Official docs of 'Service Reports'

What are goals?

What are attribution models?

Docs on ryandexdirect website

See Also

For get more ditails see vignett vignette("yandex-direct-get-stat", package = "ryandexdirect")

Examples

Run this code
if (FALSE) {
### Please choose another TokenPath to save the Login permanently.
# For get Report from client account
statAgency <- yadirGetReport(ReportType       = "ACCOUNT_PERFORMANCE_REPORT", 
                             DateRangeType    = "CUSTOM_DATE", 
                             DateFrom         = "2018-01-01", 
                             DateTo           = "2018-05-10", 
                             FieldNames       = c("AdNetworkType",
                                                  "Impressions",
                                                  "Clicks",
                                                  "Cost"), 
							 Goals = c(182453, 
							           182452, 
							           234588),
							 AttributionModels = c("LSC", "LC"),
                             IncludeVAT        = "YES", 
                             IncludeDiscount   = "NO", 
                             Login             = "client_login", 
                             TokenPath         = tempdir())
							 
# For get data from agency client account
statAgency <- yadirGetReport(ReportType = "ACCOUNT_PERFORMANCE_REPORT", 
                             DateRangeType = "CUSTOM_DATE", 
                             DateFrom = "2018-01-01", 
                             DateTo = "2018-05-10", 
                             FieldNames = c("AdNetworkType",
                                            "Impressions",
                                            "Clicks",
                                            "Cost"), 
                             IncludeVAT = "YES", 
                             IncludeDiscount = "NO", 
                             Login = "client_login", 
                             AgencyAccount = "aguncy_login",
                             TokenPath = tempdir())
}

Run the code above in your browser using DataLab