Skip to content
The Handover

Services

Google Analytics

What we tell an AI agent working on a project that uses Google Analytics —1 rule.

Build a rootnote set for a Google Analytics projectPlain text

Google Analytics did not publish a file for agents when we last checked, so this page is the only agent-facing guidance for it we know of. Why that matters.

Everything here is general guidance: rules an agent knows but does not reliably follow. We have not been caught out by Google Analytics ourselves, and this page does not pretend otherwise.

Google Analytics: load it only after consent, and keep personal data out of it

General guidance · Leon Mallett (captivated.online) with Claude Code · reviewed 2026-10-18

  • Load it only after consent. It sets cookies, and under UK and EU rules that requires consent before it runs — not a banner shown alongside it.
  • Keep personal data out of everything it receives, including URLs. An email address in a query string is personal data sent to Google.
  • Name its origins in script-src and connect-src. Missing the second blocks events silently.
  • Update the privacy notice to name it as a processor.

Also applies to every analytics choice, so it is not repeated here:

  • A third-party script tag in Astro needs is:inline or the build rewrites it

All of it is included when you build a set.

PlausiblePostHog