ship09-consent-mode-analytics.md
Consent Mode and Analytics, Set Up in the Right Order
How to set up analytics so that consent comes first: default settings before the tag loads, a clear banner, updating consent on acceptance and checking that it works.

Set analytics up so that consent comes first. Before the analytics tag sends anything, set a default consent state of denied for storage. Show a clear banner with equal "Accept" and "Decline" choices. When a visitor accepts, update the consent state. Then test it: decline, check that no analytics cookie is set; accept, check that it is.
Analytics is part of every site we ship, and so is a cookie banner. The order in which they load is what decides whether the banner means anything. A banner that appears after analytics has already set cookies is decoration. This note is part of the website production system README.
This note describes a general technical setup, not legal advice. Rules on cookies and consent differ between countries and change over time. For your situation, check guidance from official sources, such as your national data-protection authority, and take legal advice where needed.
What consent mode is
Google's consent mode is a way of telling Google tags whether a visitor has agreed to storage for analytics and advertising. It uses a few named settings, including analytics_storage and ad_storage, plus ad_user_data and ad_personalization for advertising. Each is either granted or denied. Tags adjust their behavior to the current state.
The right order
- Load a tiny script that sets the default state: storage denied.
- If the visitor already chose "Accept" on an earlier visit, set analytics storage to granted.
- Load the analytics tag.
- Show the banner only if no choice has been stored.
- On "Accept", update analytics storage to granted and store the choice.
- On "Decline", store the choice and leave storage denied.
The first step must run before the tag. If the tag loads first, it may set cookies before your default applies.
A banner people can answer
- Equal choices"Accept" and "Decline" with the same size and prominence.
- Plain wordsSay what the cookie is for in one sentence.
- A linkPoint to the privacy or cookie policy.
- RememberedDo not ask again on every page once a choice is made.
- ReversibleExplain how to change the choice later.
What we set by default
On WebAppSys sites, analytics storage starts as denied. Advertising storage, user data and personalization are denied and stay denied, because the sites do not run ads. The banner offers "Accept" and "Decline". The choice is kept in the browser's local storage on the visitor's device and is not sent to our server.
How to test it yourself
- Open the site in a private browser window.
- Before choosing, open developer tools and check cookies: no analytics cookie should be set.
- Click "Decline", reload and check again: still none.
- Clear the site data, reload and click "Accept".
- Check cookies: the analytics cookie should now appear, and your visit should show in real-time reports.
Search Console needs no cookie
Search Console measures how your site appears in search results from the search engine's side. It does not use cookies on your site and is not affected by the banner. It is connected during setup and handed over with the rest of the accounts, as described in the website handover pack.
Measuring with less data
With consent required, analytics will not count every visitor. That is expected. Treat analytics numbers as trends, not exact counts. Search Console figures, server logs and form submissions give other views of how the site is doing.
How this fits the system
Measurement wiring is the fifth module. It is applied by the installer with the theme settings and checked in the website QA checklist. The cookie text on this site is on the cookies page.
Set the default before the tag, ask clearly, update on acceptance and test both answers yourself. Then analytics measures what visitors agreed to, and the banner means what it says.
Frequently asked questions
Is consent mode a cookie banner?
No. It is a way to pass the visitor's choice to tags. You still need a banner or another way to ask.
Do I need a banner if I do not use analytics?
It depends on what else your site stores. Check official guidance for your country.
Does declining break the site?
It should not. Every page works without analytics.
General information, not legal or financial advice. Search engines and platforms change their rules; check their official documentation before relying on any detail.
#
The Website Production System: How a Brief Becomes a Finished Site
The README for WebAppSys: how a website production system turns a brief into a finished, measured site in three stages (build, publish, ship), with 17 linked notes.
- [x] build3 notes- [x] publish5 notes- [x] ship3 notes
// Same branch
Related notes
01-website-production-system.md
BuildThe Website Production System: How a Brief Becomes a Finished SiteThe README for WebAppSys: how a website production system turns a brief into a finished, measured site in three stages (build, publish, ship), with 17 linked notes.~5 minopen 04-website-content-pipeline.md
PublishThe Website Content Pipeline: From Brief to Published PageHow a content pipeline turns a brief into pages and articles that pass the same checks every time: research, outline, writing, compiling, covers and the calendar.~4 minopen 07-article-publishing-schedule.md
PublishAn Article Publishing Schedule You Can Actually KeepHow to plan an article publishing schedule that survives real life: a launch batch, a steady queue, fixed time slots, and the WordPress detail that makes scheduled posts miss.~5 minopen