# NOT RUN {
# Get objects
## Get ads
Ads <- myTarGetAdList(login = "my_test_client")
## Get campaigns
Campaigns <- myTarGetCampaignList(login = "my_test_client")
# Get statistic
# base metrics by campaigns
base_data <- myTarGetTotalData(date_from = Sys.Date() - 7,
date_to = Sys.Date(),
object_type = "campaigns",
object_id = Campaigns$id,
metrics = "base",
stat_type = "day",
login = "my_test_client",
token_path = "mytarget_token")
# all metrics by campaigns
all_data <- myTarGetTotalData(date_from = Sys.Date() - 7,
date_to = Sys.Date(),
object_type = "campaigns",
object_id = Campaigns$id,
metrics = "all",
stat_type = "day",
login = "my_test_client",
token_path = "mytarget_token")
# custom set of metric by campaigns
custom_data <- myTarGetTotalData(date_from = Sys.Date() - 7,
date_to = Sys.Date(),
object_type = "campaigns",
object_id = Campaigns$id,
metrics = c("base", "tps", "viral"),
stat_type = "day",
login = "my_test_client",
token_path = "mytarget_token")
# if have note objects id, base metrics by ads
base_data2 <- myTarGetStats(date_from = as.Date("2013-01-01"),
date_to = Sys.Date(),
object_type = "banners",
metrics = "base",
stat_type = "day",
login = "my_test_client",
token_path = "mytarget_token")
# }
Run the code above in your browser using DataLab