#' Get a ranked reports
#'
#' @param date_range A two length vector of start and end Date objects
#' @param metrics Metric to send
#' @param dimensions Dimension to send
#' @param num_rows How many rows
#' @param rsid Adobe report number
#'
#' @export
aa_ranked_report <- function(date_range,
metrics,
dimensions,
num_rows,
rsid = Sys.getenv("ADOBE_API_RSID")){
timeframe <- make_timeframe(date_range[[1]], date_range[[2]])
req_body <- list(
rsid = rsid,
globalFilters = list(
type = "dateRange",
dateRange = timeframe
),
metricContainer = list(
metrics = list(
columnId = 0,
id = sprintf("metrics/%s", metrics),
sort = "desc"
)
),
dimension = sprintf("variables/%s", dimensions),
settings = list(
countRepeatInstances = TRUE,
limit = num_rows,
page = 0
),
statistics = list(
functions = c("col-max", "col-min")
)
)
res <- aa_get_data("reports/ranked", body = req_body)
# parse response here
res
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.