Skip to main content

Gate Google Analytics to production deploys

Description​

Netlify deploy previews currently load the production GA4 tag (G-TZ94NZD7TN): confirmed via curl -s https://deploy-preview-481--d7y.netlify.app/docs/next/ | grep -c G-TZ94NZD7TN. Gate gtag in docusaurus.config.js on Netlify's CONTEXT === 'production' build environment variable so preview and branch deploys stop reporting to the production GA4 property. Indexing scoping does not need a fix: previews already serve x-robots-tag: noindex and every page carries a canonical link back to https://d7y.io.

Completion criteria​

Netlify deploy previews and branch deploys no longer send events to the production GA4 property; production deploys are unaffected.

This issue tracks recommended changes resulting from an analysis of the Dragonfly documentation commissioned by CNCF. The analysis and supporting documents are here: https://github.com/cncf/techdocs/tree/main/analyses under 2026/dragonfly. See cncf/techdocs#335.

  • To be filed in dragonflyoss/d7y.io