This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SaveRealTimeConfiguration("<report suite>", | |
metric1 = "instances", | |
elements1 = c("page", "referringdomain", "sitesection"), | |
metric2 = "revenue", | |
elements2 = c("referringdomain", "sitesection") | |
metric3 = "orders", | |
elements3 = c("products") | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GetRealTimeReport("<report suite>", "instances") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GetRealTimeReport("<report suite>", | |
"instances", | |
periodMinutes = "5", | |
periodCount = "12", | |
periodOffset = "10") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GetRealTimeReport("mlcpwmproduction", | |
"instances", | |
"page", | |
periodMinutes = "9", | |
periodCount = "3") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#"metrics" would be a user input into a function arguments | |
metrics <- c("a", "b", "c") | |
#Loop over the metrics list, appending proper curly braces | |
metrics_conv <- lapply(metrics, function(x) paste('{"id":', '"', x, '"', '}', sep="")) | |
#Collapse the list into a proper comma separated string | |
metrics_final <- paste(metrics_conv, collapse=", ") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: print "Here's a string subtitution for my name: %s" %("Randy") | |
Out[1]: "Here's a string subtitution for my name: Randy" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elements_list = sprintf('{"id":"%s", | |
"top": "%s", | |
"startingWith":"%s", | |
"search":{"type":"%s", "keywords":[%s]} | |
}', element, top, startingWith, searchType, searchKW2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Converts report_suites to JSON | |
if(length(report_suites)>1){ | |
report_suites <- toJSON(report_suites) | |
} else { | |
report_suites <- toJSON(list(report_suites)) | |
} | |
#API request | |
json <- postRequest("ReportSuite.GetTrafficVars",paste('{"rsid_list":', report_suites , '}')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Efficient method | |
library(rjson) | |
report_suites <- list(rsid_list=c("A", "B", "C")) | |
request.body <- toJSON(report_suites) | |
#API request | |
json <- postRequest("ReportSuite.GetTrafficVars", request.body) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"reportDescription":{ | |
"reportSuiteID":"(string)", | |
"date":"(string)", | |
"dateFrom":"(string)", | |
"dateTo":"(string)", | |
"dateGranularity":"(string)", | |
"metrics":[ | |
{ | |
"id":"(string)" |