Title: | R Interface to Yandex Metrica API |
---|---|
Description: | Allows work with 'Management API' for load counters, segments, filters, user permissions and goals list from Yandex Metrica, 'Reporting API' allows you to get information about the statistics of site visits and other data without using the web interface, 'Logs API' allows to receive non-aggregated data and 'Compatible with Google Analytics Core Reporting API v3' allows receive information about site traffic and other data using field names from Google Analytics Core API. For more information see official documents <https://yandex.ru/dev/metrika/doc/api2/concept/about-docpage>. |
Authors: | Alexey Seleznev [aut, cre] |
Maintainer: | Alexey Seleznev <[email protected]> |
License: | GPL-2 |
Version: | 1.0.6 |
Built: | 2025-02-17 04:45:26 UTC |
Source: | https://github.com/selesnow/rym |
Allows work with 'Management API' for load counters, segments, filters, user permissions and goals list from Yandex Metrica, 'Reporting API' allows you to get information about the statistics of site visits and other data without using the web interface, 'Logs API' allows to receive non-aggregated data and 'Compatible with Google Analytics Core Reporting API v3' allows receive information about site traffic and other data using field names from Google Analytics Core API. For more information see official documents <https://yandex.ru/dev/metrika/doc/api2/concept/about-docpage>.
The DESCRIPTION file:
Package: | rym |
Type: | Package |
Title: | R Interface to Yandex Metrica API |
Version: | 1.0.6 |
Authors@R: | c(person(given = "Alexey", family = "Seleznev", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0003-0410-7385")), person(given = "Netpeak", role = c("cph"))) |
Maintainer: | Alexey Seleznev <[email protected]> |
Description: | Allows work with 'Management API' for load counters, segments, filters, user permissions and goals list from Yandex Metrica, 'Reporting API' allows you to get information about the statistics of site visits and other data without using the web interface, 'Logs API' allows to receive non-aggregated data and 'Compatible with Google Analytics Core Reporting API v3' allows receive information about site traffic and other data using field names from Google Analytics Core API. For more information see official documents <https://yandex.ru/dev/metrika/doc/api2/concept/about-docpage>. |
Depends: | R (>= 3.5.0) |
BugReports: | https://github.com/selesnow/rym/issues |
Suggests: | knitr, rmarkdown |
VignetteBuilder: | knitr |
License: | GPL-2 |
Imports: | httr, stringr, utils, purrr |
URL: | https://selesnow.github.io/rym/ |
Encoding: | UTF-8 |
Language: | ru |
Config/pak/sysreqs: | libicu-dev libssl-dev |
Repository: | https://selesnow.r-universe.dev |
RemoteUrl: | https://github.com/selesnow/rym |
RemoteRef: | HEAD |
RemoteSha: | 26980ef81a0e0b13706fda6d2de0ba00d7354ded |
Author: | Alexey Seleznev [aut, cre] (<https://orcid.org/0000-0003-0410-7385>), Netpeak [cph] |
Index of help topics:
rym-calls Manage callss rym-expense-uploading Manage Cost Data Upload rym-offline-conversion Manage offline conversions rym-package R Interface to Yandex Metrica API rym_add_goal Create goal in 'Yandex Metrica' rym_add_segment Create segment in 'Yandex Metrica' rym_auth Authentication in Yandex Metrika API rym_get_counters Load Yandex Metrica counters rym_get_data Load data by compatible with the 'Google Analytics Core Reporting API' rym_get_direct_clients Load Yandex.Direct clients rym_get_filters List of filters rym_get_ga Work with 'compatible with the Google Analytics Core Reporting API (v3)' rym_get_goals List of goals rym_get_logs Get raw data from yandex metrika. rym_get_my_logins Show list of auth logins rym_get_segments List of segments rym_users_grants List of users permissions
Alexey Seleznev [aut, cre] (<https://orcid.org/0000-0003-0410-7385>), Netpeak [cph]
Maintainer: Alexey Seleznev <[email protected]>
API Compatible with Google Analytics Core API v3
Or read vignettes:
vignette("intro-to-rym", package = "rym")
vignette("rym-management-api", package = "rym")
vignette("rym-reporting-api", package = "rym")
vignette("rym-ga-api", package = "rym")
vignette("rym-logs-api", package = "rym")
## Not run: library(rym) # get counters list my_counters <- rym_get_counter() # join all counters id in string format, like 1,2,3,4,5,...,n counters_ids <- paste0(my_counters$id, collapse = ",") # get statistic from reporting API reporting <- rym_get_data(counters = counters_ids, date.from = "2018-08-01", date.to = "yesterday", dimensions = "ym:s:date, ym:s:lastTrafficSource", metrics = "ym:s:visits, ym:s:pageviews, ym:s:users", sort = "-ym:s:date") # get raw data raw_data <- rym_get_logs(counter = counters_ids[1], date.from = "2016-12-01", date.to = "2016-12-20", fields = "ym:s:visitID, ym:s:date, ym:s:bounce, ym:s:clientID, ym:s:networkType", source = "visits") ## End(Not run)
## Not run: library(rym) # get counters list my_counters <- rym_get_counter() # join all counters id in string format, like 1,2,3,4,5,...,n counters_ids <- paste0(my_counters$id, collapse = ",") # get statistic from reporting API reporting <- rym_get_data(counters = counters_ids, date.from = "2018-08-01", date.to = "yesterday", dimensions = "ym:s:date, ym:s:lastTrafficSource", metrics = "ym:s:visits, ym:s:pageviews, ym:s:users", sort = "-ym:s:date") # get raw data raw_data <- rym_get_logs(counter = counters_ids[1], date.from = "2016-12-01", date.to = "2016-12-20", fields = "ym:s:visitID, ym:s:date, ym:s:bounce, ym:s:clientID, ym:s:networkType", source = "visits") ## End(Not run)
Create new goal in 'Yandex Metrica' counter.
rym_add_goal( counter, name, type = c("number","action","step","url"), is.retargeting = FALSE, flag = c(NA, "basket", "order"), conditions = NULL, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
rym_add_goal( counter, name, type = c("number","action","step","url"), is.retargeting = FALSE, flag = c(NA, "basket", "order"), conditions = NULL, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
counter |
Yandex Metrika counter ID |
name |
character, goal name |
type |
character, goal type, one of "number","action","step","url" |
is.retargeting |
boolean, if TRUE the goal is retargeting |
flag |
character, target type for Yandex.Market customers |
conditions |
list, the list of conditions, for example |
login |
character, Your Yandex login |
token.path |
character, Directory for store API credential |
Alexey Seleznev
Official docs of 'Yandex Metrica Management API'
## Not run: rym_add_goal(123456789, name = 'first_goal', type = 'action', conditions = list(type = 'exact', url = 'rym-first-goal'), login = 'your_login') ## End(Not run)
## Not run: rym_add_goal(123456789, name = 'first_goal', type = 'action', conditions = list(type = 'exact', url = 'rym-first-goal'), login = 'your_login') ## End(Not run)
Create a new API segment in 'Yandex Metrica' counter.
rym_add_segment( counter, name, expression, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
rym_add_segment( counter, name, expression, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
counter |
Yandex Metrika counter ID |
name |
character, segment name |
expression |
character, filter expression, for example |
login |
character, Your Yandex login |
token.path |
character, Directory for store API credential |
Alexey Seleznev
Official docs of 'Yandex Metrica Management API'
See rym_add_goal()
for create new goal in 'Yandex Metrica'.
## Not run: rym_add_segment( counter = 123456789, name = "my_segment", expression = "ym:s:trafficSource=='organic' AND ym:s:isNewUser=='Yes'", login = "your_login") ## End(Not run)
## Not run: rym_add_segment( counter = 123456789, name = "my_segment", expression = "ym:s:trafficSource=='organic' AND ym:s:isNewUser=='Yes'", login = "your_login") ## End(Not run)
Actually you don't need call rym_auth since it will be called when you run any of the functions available in rym.
rym_auth(login = getOption("rym.user"), new.user = FALSE, token.path = getOption("rym.token_path"))
rym_auth(login = getOption("rym.user"), new.user = FALSE, token.path = getOption("rym.token_path"))
login |
character, Your Yandex login |
new.user |
logical, If TRUE you reauth in Yandex Metrika API |
token.path |
character, Directory for store API credential |
All your credential save in directory specified in the argument token.path, after save every time you run any function from rym, rym_auth be load credentials from local file login.rymAuth.RData. rym_auth create files for each your logins, which makes it possible use many yandex account in one script. Every tokens expire after 1 year after authentication, but rym_auth automaticly refresh and save you credential 30 days before he expire.
List with credential data.
Alexey Seleznev
OAuth 2.0 in Yandex docs - https://tech.yandex.ru/oauth/doc/dg/concepts/about-docpage/
## Not run: library(rym) rym_auth(login = "my_login") ## End(Not run)
## Not run: library(rym) rym_auth(login = "my_login") ## End(Not run)
Returns a list of existing counters available to the user.
rym_get_counters(login = getOption("rym.user"), token.path = getOption("rym.token_path"), search.string = NULL)
rym_get_counters(login = getOption("rym.user"), token.path = getOption("rym.token_path"), search.string = NULL)
login |
character, Your Yandex login |
token.path |
character, Directory for store API credential |
search.string |
character, Filter by line. Counters will be displayed, the identifier, name, site or mirrors of which contain the specified substring |
Data frame with list of yandex metrica counters.
Alexey Seleznev
Official docs - https://tech.yandex.ru/metrika/doc/api2/management/counters/counters-docpage/
## Not run: my_counters <- rym_get_counters(login = "my_login") ## End(Not run)
## Not run: my_counters <- rym_get_counters(login = "my_login") ## End(Not run)
The Reporting API allows you to obtain information about site visits statistics and other data without using the Yandex.Metrica interface.
rym_get_data(direct.client.logins = NULL, counters, metrics = "ym:s:visits,ym:s:pageviews,ym:s:users", dimensions = NULL, filters = NULL, sort = NULL, date.from = "8daysAgo", date.to = "yesterday", accuracy = "full", include.undefined = TRUE, lang = "ru", timezone = NULL, pretty = FALSE, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
rym_get_data(direct.client.logins = NULL, counters, metrics = "ym:s:visits,ym:s:pageviews,ym:s:users", dimensions = NULL, filters = NULL, sort = NULL, date.from = "8daysAgo", date.to = "yesterday", accuracy = "full", include.undefined = TRUE, lang = "ru", timezone = NULL, pretty = FALSE, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
direct.client.logins |
Logins of Yandex.Direct clients, separated by commas. Can be used to generate a Direct Expense report. |
counters |
Counter identifiers, separated by commas. |
metrics |
A list of metrics, separated by a comma. |
dimensions |
A list of groupings, separated by a comma. |
filters |
A list of filtring data. |
sort |
A list of metrics and dimension for sorting result data, for desc sorting use -. |
date.from |
Start date in YYYY-MM-DD. |
date.to |
End date in YYYY-MM-DD. |
accuracy |
Sampling level, one of low, medium, high or full. Or numeric from 0 to 1, where 1 - no sampling. |
include.undefined |
Includes in response rows for which grouping values are not defined. |
lang |
Language, by default ru |
timezone |
Timezone for time data. |
pretty |
Specifies the formatting of the result. |
login |
character, Your Yandex login |
token.path |
character, Directory for store API credential |
This API have some limits. 1. 10 demensions in the query. 2. 20 metrics in one query. 3. Limit: the number of unique groupings and metrics is up to 10, the number of individual filters is up to 20, the length of the line in the filter is up to 10,000 characters.
Data frame with dimension and metrics.
Alexey Seleznev
Run vignette("rym-reporting-api", package = "rym")
to see the corresponding vignette.
For load statics you also can use rym_get_ga
and rym_get_logs
## Not run: test_data <- rym_get_data(counters = 26841129, dimensions = "ym:s:date, ym:s:lastsignTrafficSource", login = "my_login", sort = "ym:s:date") ## End(Not run)
## Not run: test_data <- rym_get_data(counters = 26841129, dimensions = "ym:s:date, ym:s:lastsignTrafficSource", login = "my_login", sort = "ym:s:date") ## End(Not run)
Returns data about Yandex.Direct clients for campaigns that the owner of the Metrics counter has access to.
rym_get_direct_clients(counters, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
rym_get_direct_clients(counters, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
counters |
Counter identifiers, separated by commas |
login |
character, Your Yandex login |
token.path |
character, Directory for store API credential |
Data frame with Yandex Direct clients.
Alexey Seleznev
## Not run: my_clients <- rym_get_direct_clients(counters="11111,22222", login = "my_login") ## End(Not run)
## Not run: my_clients <- rym_get_direct_clients(counters="11111,22222", login = "my_login") ## End(Not run)
Returns information about counter filters.
rym_get_filters(counter, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
rym_get_filters(counter, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
counter |
Yandex Metrika counter ID, you can get ids of all your conters over rym_counters |
login |
character, Your Yandex login |
token.path |
character, Directory for store API credential, by default is your work directory |
Data frame with list of yandex metrika counter filters
id |
Filter id. |
attr |
The type of data to which the filter applies. One of referer, uniq_id, client_ip, title, url. |
type |
The relation or action for the filter, equal, contain, me, start, interval, only_mirrors. |
value |
Filter value. |
action |
Type of filter, include or exclude. |
status |
Status of filter, active or disabled. |
with_subdomains |
Filter by subdomains. |
start_ip |
The first IP address of the range. |
start_ip |
The last IP address of the range. |
Alexey Seleznev
## Not run: filters <- rym_get_filters(counter = "your_counter_id", login = "your_login") ## End(Not run)
## Not run: filters <- rym_get_filters(counter = "your_counter_id", login = "your_login") ## End(Not run)
Allows you to perform the following operations: 1. Obtain information about site traffic and other data. 2. Integrate Yandex.Metrica data with applications developed with the 'Google Analytics Core Reporting API (v3)' in mind. 3. Use the usual query parameters when collecting statistics, if you previously worked with the Google Analytics Core Reporting API (v3).
rym_get_ga(start.date = "10daysAgo", end.date = "today", counter = NULL, dimensions = "ga:date,ga:sourceMedium", metrics = "ga:sessions,ga:bounces,ga:users", filters = NULL, sort = NULL, sampling.level = "HIGHER_PRECISION", login = getOption("rym.user"), token.path = getOption("rym.token_path"))
rym_get_ga(start.date = "10daysAgo", end.date = "today", counter = NULL, dimensions = "ga:date,ga:sourceMedium", metrics = "ga:sessions,ga:bounces,ga:users", filters = NULL, sort = NULL, sampling.level = "HIGHER_PRECISION", login = getOption("rym.user"), token.path = getOption("rym.token_path"))
start.date |
Start date in format YYYY-MM-DD |
end.date |
End date in format YYYY-MM-DD |
counter |
Your yandex metrica counter |
dimensions |
List of dimensions fields, for example "ga:browser,ga:city", see dictionary of available dimension |
metrics |
List of metrics fields, for example "ga:users,ga:sessions", see dictionary of available metrics |
filters |
List of filtrind dimensions and metrics. |
sort |
Sorting fields |
sampling.level |
One of "HIGHER_PRECISION", "FASTER", "DEFAULT" |
login |
character, Your Yandex login |
token.path |
character, Directory for store API credential |
Limits: 10 metrics for one query. 7 dimensions for one query
Data frame with fields.
Alexey Seleznev
Official compatible with the Google Analytics Core Reporting API (v3) docs
Run vignette("rym-ga-api", package = "rym")
to see the corresponding vignette.
For load statics you also can use rym_get_data()
and rym_get_logs()
## Not run: data <- rym_get_ga(start.date = "2017-08-01", end.date = "yesterday", counter = "ga:26841129", metrics = "ga:sessions,ga:bounces,ga:users", dimensions = "ga:date,ga:sourceMedium", login = "my_login") ## End(Not run)
## Not run: data <- rym_get_ga(start.date = "2017-08-01", end.date = "yesterday", counter = "ga:26841129", metrics = "ga:sessions,ga:bounces,ga:users", dimensions = "ga:date,ga:sourceMedium", login = "my_login") ## End(Not run)
Returns information about the purpose of the yandex metrica counter.
rym_get_goals(counter, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
rym_get_goals(counter, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
counter |
Yandex Metrika counter ID |
login |
character, Your Yandex login |
token.path |
character, Directory for store API credential |
Data frame with list of yandex metrica counters
Alexey Seleznev
Official docs of 'Yandex Metrica Management API'
Run vignette("rym-management-api", package = "rym")
to see the corresponding vignette.
## Not run: my_counters <- rym_get_goals(login = "my_login") ## End(Not run)
## Not run: my_counters <- rym_get_goals(login = "my_login") ## End(Not run)
'Logs API' allows you to receive non-aggregated data collected by Yandex.Metrica. This API is intended for service users who want to independently process statistical data and use them to solve unique analytical problems.
rym_get_logs(counter = NULL, date.from = Sys.Date() - 10, date.to = Sys.Date() - 1, fields = "ym:s:date,ym:s:counterID,ym:s:dateTime, ym:s:isNewUser,ym:s:startURL,ym:s:visitDuration, ym:s:ipAddress,ym:s:referer", source = "visits", login = getOption("rym.user"), token.path = getOption("rym.token_path"))
rym_get_logs(counter = NULL, date.from = Sys.Date() - 10, date.to = Sys.Date() - 1, fields = "ym:s:date,ym:s:counterID,ym:s:dateTime, ym:s:isNewUser,ym:s:startURL,ym:s:visitDuration, ym:s:ipAddress,ym:s:referer", source = "visits", login = getOption("rym.user"), token.path = getOption("rym.token_path"))
counter |
Yandex metrika counter id |
date.from |
Start date in format YYYY-MM-DD |
date.to |
End date in format YYYY-MM-DD |
fields |
List of fields |
source |
Log source, one of "hits" or "visits" |
login |
character, Your Yandex login |
token.path |
character, Directory for store API credential |
Data frame with values and fields
Alexey Seleznev
Run vignette("rym-logs-api", package = "rym")
to see the corresponding vignette.
For load statics you also can use rym_get_data()
and rym_get_ga()
## Not run: # where "00000000" is your counter id rawmetrikdata <- rym_get_logs(counter = "00000000", date.from = "2016-12-01", date.to = "2016-12-20", fields = "ym:s:visitID, ym:s:date, ym:s:bounce, ym:s:clientID, ym:s:networkType", source = "visits") ## End(Not run)
## Not run: # where "00000000" is your counter id rawmetrikdata <- rym_get_logs(counter = "00000000", date.from = "2016-12-01", date.to = "2016-12-20", fields = "ym:s:visitID, ym:s:date, ym:s:bounce, ym:s:clientID, ym:s:networkType", source = "visits") ## End(Not run)
Get login list, chose and set default yandex login in current R session.
rym_get_my_logins(token.path = getOption("rym.token_path"), set.login = TRUE)
rym_get_my_logins(token.path = getOption("rym.token_path"), set.login = TRUE)
token.path |
character, Directory for store API credential |
set.login |
logical, if TRUE you set one of your account as session default |
Alexey Seleznev
## Not run: rym_get_my_logins() ## End(Not run)
## Not run: rym_get_my_logins() ## End(Not run)
Returns a list of segments created using the API and related to the specified counter.
rym_get_segments(counter, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
rym_get_segments(counter, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
counter |
Yandex Metrika counter ID, you can get ids of all your conters over rym_counters |
login |
character, Your Yandex login |
token.path |
character, Directory for store API credential, by default is your work directory |
Data frame with list of yandex metrica counter segments
id |
Segment id. |
counter_id |
Yandex Metrica counter id. |
name |
Segment name. |
expression |
An expression that matches the value of the filters parameter. |
is_retargeting |
Logical, is retargeting segment or not. |
segment_source |
Source of the segment. Indicates how to create it. Accepts the value of api - segments that are created using the API are used. |
Alexey Seleznev
Official docs of Yandex Metrica Management API
Run vignette("rym-management-api", package = "rym")
to see the corresponding vignette.
## Not run: segments <- rym_get_segments(counter = "your_counter_id", login = "your_login") ## End(Not run)
## Not run: segments <- rym_get_segments(counter = "your_counter_id", login = "your_login") ## End(Not run)
Returns information about the permissions to manage the counter and viewing statistics from 'management API'.
rym_users_grants(counter, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
rym_users_grants(counter, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
counter |
Yandex Metrika counter ID, you can get ids of all your conters over rym_counters |
login |
character, Your Yandex login |
token.path |
character, Directory for store API credential, by default is your work directory |
Data frame with list of yandex metrika counter users
user_login |
Login of the user who has been given permission to manage the counter. |
perm |
Access level, one of view, edit, public_stat. |
created_at |
Date of granting access in the format YYYY-MM-DD'T'hh: mm: ssZ. |
comment |
An arbitrary comment. The number of characters can not exceed 255. |
partner_data_access |
Logical, is partner access or not. |
Alexey Seleznev
Run vignette("rym-management-api", package = "rym")
to see the corresponding vignette.
## Not run: users <- rym_users_grants(counter = "your_counter_id", login = "your_login") ## End(Not run)
## Not run: users <- rym_users_grants(counter = "your_counter_id", login = "your_login") ## End(Not run)
calls Management:
Enable calls tracking for the specified counter.
Disable calls tracking for the specified counter.
Upload callss.
Returns the date and time from which conversions can be linked to visits for the specified counter.
Returns a list of calls downloads.
rym_enable_calls( counter, login = getOption("rym.user"), token.path = getOption("rym.token_path")) rym_disable_calls( counter, login = getOption("rym.user"), token.path = getOption("rym.token_path")) rym_allow_calls( counter, login = getOption("rym.user"), token.path = getOption("rym.token_path")) rym_upload_calls( counter, data, client.id.type = c("CLIENT_ID", "USER_ID"), new.goal.name = NULL, comment = paste0("Upload by rym at ", Sys.time()), login = getOption("rym.user"), token.path = getOption("rym.token_path")) rym_get_uploadings_calls( counter, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
rym_enable_calls( counter, login = getOption("rym.user"), token.path = getOption("rym.token_path")) rym_disable_calls( counter, login = getOption("rym.user"), token.path = getOption("rym.token_path")) rym_allow_calls( counter, login = getOption("rym.user"), token.path = getOption("rym.token_path")) rym_upload_calls( counter, data, client.id.type = c("CLIENT_ID", "USER_ID"), new.goal.name = NULL, comment = paste0("Upload by rym at ", Sys.time()), login = getOption("rym.user"), token.path = getOption("rym.token_path")) rym_get_uploadings_calls( counter, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
counter |
Your yandex metrica counter |
data |
data.frame, expense data for loading |
client.id.type |
Type of visitor identifiers: CLIENT_ID or USER_ID |
comment |
Comment for data loading |
new.goal.name |
The name of the new goal for calls in the event that such a goal does not exist. If the target exists, this parameter is ignored |
login |
character, Your Yandex login |
token.path |
character, Directory for store API credential |
Loading data format.
Require:
Identifier of the visitor to the site or advertising campaign in Yandex.Direct, for example: 12345
Optional:
whether the call is static (1 - static, 0 - dynamic)
target price, the decimal separator is the dot (.)
currency in the three-letter format ISO 4217, for example: RUB
phone number without spaces (with country and city code). For example, +70123456789
call duration in seconds
call waiting time in seconds
whether the call is missed (1 - missed, 0 - answered)
custom label. It can be used to mark the quality of a call or its outcome, etc. For example, “the customer was not satisfied with the price”
primary (1 - primary call, 0 - secondary call)
The URL from which the call came (the page associated with the event). For example, this could be the landing page for an ad campaign that has a phone number (PhoneNumber)
The URL to go to the call tracker interface
Example of CSV file.
Alexey Seleznev
See official dox: API documents Upload calls info into Yandex Metrica Calls in Yandex Metrica
## Not run: # read data for upload data <- read.csv("https://bit.ly/2CcsNyl") # enable offline cnversion rym_enable_calls( counter = 123456789, login = "your_login" ) # upload data rym_upload_calls( counter = 123456789, data = data, client.id.type = "CLIENT_ID", login = "your_login") # check uploading rym_allow_calls( counter = 123456789, login = "your_login") ## End(Not run)
## Not run: # read data for upload data <- read.csv("https://bit.ly/2CcsNyl") # enable offline cnversion rym_enable_calls( counter = 123456789, login = "your_login" ) # upload data rym_upload_calls( counter = 123456789, data = data, client.id.type = "CLIENT_ID", login = "your_login") # check uploading rym_allow_calls( counter = 123456789, login = "your_login") ## End(Not run)
Upload, delete and get list of uploading expense data in 'Yandex Metrica'.
rym_upload_expense( counter, data, comment = paste0("Upload bt rym at ", Sys.time()), login = getOption("rym.user"), token.path = getOption("rym.token_path")) rym_delete_uploaded_expense( counter, data, comment = paste0("Upload bt rym at ", Sys.time()), login = getOption("rym.user"), token.path = getOption("rym.token_path")) rym_get_uploadings_expense( counter, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
rym_upload_expense( counter, data, comment = paste0("Upload bt rym at ", Sys.time()), login = getOption("rym.user"), token.path = getOption("rym.token_path")) rym_delete_uploaded_expense( counter, data, comment = paste0("Upload bt rym at ", Sys.time()), login = getOption("rym.user"), token.path = getOption("rym.token_path")) rym_get_uploadings_expense( counter, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
counter |
Your yandex metrica counter |
data |
data.frame, expense data for loading |
comment |
Comment for data loading |
login |
character, Your Yandex login |
token.path |
character, Directory for store API credential |
Loading data format.
Require:
Date in YYYY-MM-DD format
Source name, for example google
Expense size, for example 12.34
Optional:
Medium name, for exmaple cpc
Campaign name, for example my campaing
Term name, for example my term
Content name, for example my contant
Currency in ISO 4217 code
Clicks number, for example 23
Alexey Seleznev
See official dox: API documents Yandex Metrica documents
## Not run: # prepare data for loading expense <- data.frame(Date = c("2020-06-01", "2020-06-02"), UTMSource = c("test_s_1", "test_s_2"), Expenses = c(88.12, 92.11), UTMMedium = c("cpc", "cpm"), UTMCampaign = c("camp1", "camp2"), UTMTerm = c("term1", "term2"), UTMContent = c("cont1", "cont2"), Currency = c("RUB", "RUB"), Clicks = c(11, 15)) # upload data rym_upload_expense( counter = 1111111, data = expense, login = 'yandex_login') # delete data rym_delete_uploaded_expense( counter = 1111111, data = expense, login = 'yandex_login') # get list of expense uploadings loaded <- rym_get_uploadings_expense( counter = 1111111, login = 'yandex_login') ## End(Not run)
## Not run: # prepare data for loading expense <- data.frame(Date = c("2020-06-01", "2020-06-02"), UTMSource = c("test_s_1", "test_s_2"), Expenses = c(88.12, 92.11), UTMMedium = c("cpc", "cpm"), UTMCampaign = c("camp1", "camp2"), UTMTerm = c("term1", "term2"), UTMContent = c("cont1", "cont2"), Currency = c("RUB", "RUB"), Clicks = c(11, 15)) # upload data rym_upload_expense( counter = 1111111, data = expense, login = 'yandex_login') # delete data rym_delete_uploaded_expense( counter = 1111111, data = expense, login = 'yandex_login') # get list of expense uploadings loaded <- rym_get_uploadings_expense( counter = 1111111, login = 'yandex_login') ## End(Not run)
Offline Conversion Management:
Enable offline conversion tracking for the specified counter.
Disable offline conversion tracking for the specified counter.
Upload offline conversions.
Returns the date and time from which conversions can be linked to visits for the specified counter.
Returns a list of offline conversion downloads.
rym_enable_offline_conversion( counter, login = getOption("rym.user"), token.path = getOption("rym.token_path")) rym_disable_offline_conversion( counter, login = getOption("rym.user"), token.path = getOption("rym.token_path")) rym_allow_offline_conversion( counter, login = getOption("rym.user"), token.path = getOption("rym.token_path")) rym_upload_offline_conversion( counter, data, client.id.type = c("CLIENT_ID", "USER_ID"), comment = paste0("Upload by rym at ", Sys.time()), login = getOption("rym.user"), token.path = getOption("rym.token_path")) rym_get_uploadings_offline_conversions( counter, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
rym_enable_offline_conversion( counter, login = getOption("rym.user"), token.path = getOption("rym.token_path")) rym_disable_offline_conversion( counter, login = getOption("rym.user"), token.path = getOption("rym.token_path")) rym_allow_offline_conversion( counter, login = getOption("rym.user"), token.path = getOption("rym.token_path")) rym_upload_offline_conversion( counter, data, client.id.type = c("CLIENT_ID", "USER_ID"), comment = paste0("Upload by rym at ", Sys.time()), login = getOption("rym.user"), token.path = getOption("rym.token_path")) rym_get_uploadings_offline_conversions( counter, login = getOption("rym.user"), token.path = getOption("rym.token_path"))
counter |
Your yandex metrica counter |
data |
data.frame, expense data for loading |
client.id.type |
Type of visitor identifiers: CLIENT_ID or USER_ID |
comment |
Comment for data loading |
login |
character, Your Yandex login |
token.path |
character, Directory for store API credential |
Loading data format.
Require:
Identifier of the visitor to the site or advertising campaign in Yandex.Direct, for example: 12345
Target ID specified when creating the target, for example order_confirmed
The time at which the conversion occurred in Unix Time Stamp format. Indicate the time in the time zone UTC + 0, for example: 1481718166
Optional:
Goal Value, for example: 1000
Three-letter currency code according to ISO 4217, for example: RUB
Example of CSV file.
Alexey Seleznev
See official dox: API documents Yandex Metrica documents
## Not run: # read data for upload data <- read.csv("https://bit.ly/2CcsNyl") # enable offline cnversion rym_enable_offline_conversion( counter = 123456789, login = "your_login" ) # upload data rym_upload_offline_conversion( counter = 123456789, data = data, client.id.type = "CLIENT_ID", login = "your_login") # check uploading rym_allow_offline_conversion( counter = 123456789, login = "your_login") ## End(Not run)
## Not run: # read data for upload data <- read.csv("https://bit.ly/2CcsNyl") # enable offline cnversion rym_enable_offline_conversion( counter = 123456789, login = "your_login" ) # upload data rym_upload_offline_conversion( counter = 123456789, data = data, client.id.type = "CLIENT_ID", login = "your_login") # check uploading rym_allow_offline_conversion( counter = 123456789, login = "your_login") ## End(Not run)