cc_ga_js() wrapped in htmltools::HTML() for use inside tags$head().
Usage
cc_ga_head(
app,
content_group = app,
app_version = "",
ip = "",
measurement_id = .CC_GA_ID,
log_url = Sys.getenv("CALCOFI_LOG_URL", "")
)Arguments
- app
short app id recorded on every event, e.g.
"db-viz-hex"- content_group
GA4 content group for reporting; defaults to
app- app_version
version string recorded on every event, e.g. a git SHA
- ip
client IP stamped on every logged row. Behind shiny-server this is the only way to record a real one: the websocket handshake the R session sees is a fresh localhost connection with no
X-Forwarded-For, so make the app'suiafunction(req)and passcc_client_ip(req)here. Left empty, theipcolumn falls back to whatevercc_track_session()reports (127.0.0.1behind a proxy).- measurement_id
GA4 measurement ID; defaults to the CalCOFI apps property
- log_url
Apps Script
/execendpoint for the Sheet log. Defaults to theCALCOFI_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(calcofi4r::cc_ga_head("db-viz-hex", app_version = APP_VERSION)), ...)
} # }