Repository navigation
Docs analytics: one funnel with coderhelm.com, nothing typed sent; self-host stays analytics-free - #224
Merged
Conversation
… ? sent; self-host stays analytics-free - docs: Google Analytics (G-T14Q1LDRC0) on docs.coderhelm.com only, loaded on idle or first interaction; page views on every client-side navigation; events for search used, Copy Markdown, copy code, outbound host and install guide step. Every hit passes a scrubber: URLs cut to origin and path, AWS regions, emails, search terms and form fields dropped, the tag's own history page views dropped. Linker with coderhelm.com; Google signals and ad personalization off. - Install guide: the trust line says anonymous page views go to Google Analytics and nothing typed is sent; an e2e runs Google's real tag and holds every hit to it. "Install name" is now "Name in your AWS account", with plain help and a one-sentence rule; the default stays prod. - CSP: both docs policies allow googletagmanager.com scripts and GA4 hosts; site and app connect-src now allow GA4's regional hosts. - Dashboard: no tag on a self-hosted install or any host but app.coderhelm.com; the first page view is no longer lost; addresses sent without query strings. - Site: linker with the docs, signals off; the self-host page says what the guide sends.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
docs.coderhelm.com, including the install guide, had no analytics. It now sends to the coderhelm.com property (
G-T14Q1LDRC0), so the site, the docs and the install guide form one funnel. Nothing typed, nothing after?or#, no email, region or install name is ever sent, and a test runs Google's real tag to check every hit. The install guide's trust line now says this. Self-hosted builds stay analytics-free; the dashboard did not check for that before, and now it does. Paired with CoderHelm/coderhelm-platform#307 (trust model wording).Changes
Docs (
docs/lib/analytics.ts,docs/components/analytics.tsx)docs.coderhelm.com, never on localhost, previews or a self-hosted docs build. It loads when the browser is idle or on the first interaction.page_locationis origin plus path. Setting it in config also stops the tag's own history page views, so each page counts once.docs_search(once per open, no query),copy_markdown,copy_code,outbound_click(link_domainonly, with AWS regions removed),install_step(the step name only).scrubHit()on its way out (sendBeacon, fetch or image):form_destinationand the like) are dropped.form_destinationbefore scrubbing.coderhelm.comanddocs.coderhelm.com. Google signals and ad personalization are off. GA4 always anonymizes IPs, soanonymize_ipdoes nothing and is not set. The marketing site has no consent banner, so the docs have none either.Install guide
GUIDE_TRUST:prod. Every resource name iscoderhelm-<name>, socoderhelmwould givecoderhelm-coderhelm-*and a stack calledcoderhelm-coderhelm. The launch template'sStagedefault, the terminal installer and the docs (--stage prod,coderhelm/prod/...) all useprod.CSP (
infra/lib/docs-csp.json)https://www.googletagmanager.comtoscript-src. They addhttps://*.google-analytics.com https://*.analytics.google.com https://www.googletagmanager.comtoconnect-srcandimg-src. Everything else is unchanged.www.google-analytics.comandanalytics.google.com. GA4 also sends to regional hosts (region1.google-analytics.com), so they now use the same wildcard hosts.Dashboard (
google-analytics.tsx)isSelfHosted()) or on any host butapp.coderhelm.com. Before, every self-hosted dashboard loaded CoderHelm's tag.gtag.gtagis now defined before the first call, so the call is queued.Site: linker with the docs, Google signals and ad personalization off.
Verification
scripts/analytics.test.mjs), build, typecheck, check:links (4163 links, none broken), check:output (88 pages), e2e 80/80.e2e/analytics.spec.ts: Google's real gtag.js runs onhttps://docs.coderhelm.comunder the production CSP, with hits answered locally.param_or the region. This holds after the reader types into the form, launches and clicks the AWS link, whose address carries the email and setup key.cdk synthis clean.google-analytics.spec.ts: page views on first load and route change, origin plus path only, no tag when self-hosted or on localhost.