bootstrap-google-analytics
Installation
SKILL.md
Bootstrap Google Analytics (GA4)
Configure Google Analytics 4 with gtag.js in a Phoenix 1.8 app — disabled in dev/test, enabled in production via environment variable.
What Gets Configured
- config.exs — GA disabled by default with
enabled: false, measurement_id: nil - runtime.exs — GA enabled in production with
GOOGLE_ANALYTICS_MEASUREMENT_IDenv var - root.html.heex — Conditional gtag.js script injection
- .env.sample —
GOOGLE_ANALYTICS_MEASUREMENT_IDentry
App Name Detection
Detect from mix.exs:
- App module prefix (e.g.,
MyApp) — the module namespace - OTP app name (e.g.,
:my_app) — used in config atoms - Web module prefix (e.g.,
MyAppWeb) — for layout references