Google Analytics and the cookie banner
Every site comes with visitor analytics that work without cookies and need no cookie banner. That is enough for most people.
Sometimes Google Analytics is needed anyway: for conversion tracking on ads, for online shop reporting, or because your marketing partner works with it. Those are perfectly valid reasons, and you can add it to your site. This page explains what that takes in practice.
Two things have to happen
- Add Google's tracking code to the site's page template.
- Add a cookie banner that asks for consent before tracking starts.
The second step is not optional. Google Analytics sets cookies, and setting cookies requires the visitor's consent. That is why the banner appears: the requirement comes from the tracking cookies, not from us.
The easy way: ask the AI assistant
The AI assistant can make these changes for you. Tell it something like:
Add Google Analytics to the site, measurement id G-XXXXXXXXXX. Also add a cookie banner that asks for consent before tracking starts.
After the change, check that the banner appears and that tracking starts only after consent. If something goes wrong, you can ask the assistant to undo the changes or restore an earlier version from the History page (see Publishing).
If you edit the site's source code yourself, the principle is the same: tracking code in the page template, and a banner that loads tracking only after consent.
Worth knowing beforehand
The banner shows for everyone. It is the first thing a visitor meets on your site, and some leave because of it. That is the price of Google Analytics.
The site gets slightly slower. Google's script loads on every page view. Add only the outside services you actually need.
Visitor data goes to Google. That is the whole point of the tool, but it is worth saying out loud: this is a US advertising company, and you have to mention it in your privacy policy.
Your own analytics keep running. They do not switch off, so you see the numbers from both. They will never match, because Google Analytics only sees the visitors who accept cookies.
Need help?
If you would rather not do this yourself, get in touch. We are happy to help.