Skip to content
webappsysv36the production system behind Adapte DijitalEN · TR · built in Istanbul
Order a site
  1. WebAppSys
  2. Notes
  3. Consent Mode and Analytics, Set Up in the Right Order

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.

read
~4 min
updated
2026-11-20
type
guide
by
webappsys
cover.webp
Consent Mode and Analytics, Set Up in the Right Order

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.

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

  1. Load a tiny script that sets the default state: storage denied.
  2. If the visitor already chose "Accept" on an earlier visit, set analytics storage to granted.
  3. Load the analytics tag.
  4. Show the banner only if no choice has been stored.
  5. On "Accept", update analytics storage to granted and store the choice.
  6. 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

  1. Open the site in a private browser window.
  2. Before choosing, open developer tools and check cookies: no analytics cookie should be set.
  3. Click "Decline", reload and check again: still none.
  4. Clear the site data, reload and click "Accept".
  5. Check cookies: the analytics cookie should now appear, and your visit should show in real-time reports.

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.

// Same branch

Related notes