rym (version 1.0.3)

rym-expense-uploading: Manage Cost Data Upload

Description

Upload, delete and get list of uploading expense data in 'Yandex Metrica'.

Usage

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"))

Arguments

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

Details

Loading data format.

Require:

Date

Date in YYYY-MM-DD format

UTMSource

Source name, for example google

Expenses

Expense size, for example 12.34

Optional:

UTMMedium

Medium name, for exmaple cpc

UTMCampaign

Campaign name, for example my campaing

UTMTerm

Term name, for example my term

UTMContent

Content name, for example my contant

Currency

Currency in ISO 4217 code

Clicks

Clicks number, for example 23

References

See official dox: API documents Yandex Metrica documents

Examples

Run this code
# 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')

# }

Run the code above in your browser using DataLab