Symptom

After deploying GA4 click tracking (#763) to krillswarm.com, only the auto-collected page_view event ever reached GA4 / Firebase. Clicking the Windows installer, app-store tiles, copy buttons, etc. produced no download / copy_install_cmd / outbound_click events — in Realtime, DebugView, or anywhere. Grepping the deployed HTML showed the listener code was present (gtag('event', 'download', etc.), so it looked shipped.

Root cause

Chirpy’s compress_html layout (enabled in production via compress_html.ignore.envs: [development]) strips all newlines inside inline <script> blocks — the deployed listener was a single line with zero newlines. The injected script used // line comments. Once collapsed to one line, each // commented out the entire remainder of the script, producing SyntaxError: Unexpected end of input; the listener IIFE never ran. The separate gtag('config', …) script had no // comments, so page_view kept firing — which masked the breakage and made it look like “events just aren’t showing up” rather than “the script is dead.”

Fix

Replaced every // line comment in docs/_includes/analytics/firebase.html with /* … */ block comments, which survive newline-stripping. Verified by extracting the listener <script> from the compressed _site/index.html and running node --check on it (was SyntaxError, now OK), and by a headless-browser probe that dispatches clicks and reads window.dataLayer: all 8 expected gtag('event', …) calls now fire, internal nav fires none.

Prevention