#' @importFrom glue glue
query_fun <- function(dates) {
glue("SELECT",
"date,",
"SUM(totals.visits) AS visits,",
"SUM(totals.pageviews) AS pageviews,",
"SUM(totals.transactions) AS transactions,",
"SUM(totals.transactionRevenue)/1000000 AS revenue",
"FROM",
"(TABLE_DATE_RANGE([bigquery-public-data.google_analytics_sample.ga_sessions_],",
"TIMESTAMP('{dates[1]}'), TIMESTAMP('{dates[2]}')))",
"GROUP BY",
"date",
"ORDER BY",
"date ASC", .sep = "\n")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.