ga_js() wrapped in htmltools::HTML() for use inside tags$head().
Usage
ga_head(
app,
content_group = app,
app_version = "",
ip = "",
measurement_id = .MS_GA_ID,
log_url = Sys.getenv("MSENS_LOG_URL", "")
)Arguments
- app
short app/product id recorded on every event, e.g.
"scores"- content_group
GA4 content group for reporting; defaults to
app- app_version
version string recorded on every event — the deployed git commit, so a Sheet row ties back to the exact code that produced it
- ip
client IP to stamp on every logged row, from
ms_client_ip(req)in aui = function(req). Behind shiny-server this is the ONLY place a real address exists — seems_client_ip().- measurement_id
GA4 measurement ID; defaults to the project property
- log_url
Apps Script
/execendpoint for the Sheet log. Defaults to theMSENS_LOG_URLenvironment variable; empty means the Sheet leg is a silent no-op (GA4 still receives events).
Examples
if (FALSE) { # \dontrun{
ui <- bslib::page_sidebar(
tags$head(msens::ga_head("scores", app_version = "v8")), ...)
} # }