Why does my website set cookies before the user consents?

Kilian Müller
Kilian MüllerOwner of 1hold.de · Google PartnerUpdated
Consent ModeGoogle Certified Specialist

A website sets cookies before consent when tags run without waiting for the cookie banner: a Google tag or pixel hard-coded in the theme, a Tag Manager tag without a consent check, or a banner that loads after the tags. In many cases consent mode is also misread: in advanced mode Google tags load before consent, but with the default state denied they should not write analytics or advertising cookies.

Whether a cookie may be set without consent depends on its purpose. Technically necessary cookies, such as the one storing the banner choice itself, are usually allowed. Analytics and advertising cookies are not. The legal assessment belongs with your data protection advice. The technical part can be checked precisely.

Why are cookies set before consent?

  • Hard-coded tags. A Google tag, Meta pixel or other script placed directly in the theme, a plugin or the page builder runs before the banner can block it.
  • Tags without a consent check. In Tag Manager, tags fire on their trigger regardless of consent unless consent settings or blocking triggers are configured.
  • Banner loads too late. If the banner script loads after the tags, the first hits go out before any consent state exists.
  • Default state missing or granted. According to Google, no consent values are set by default. If the default is not set to denied, Google tags write cookies as usual.
  • Third-party embeds. YouTube videos, maps or chat widgets can set their own cookies as soon as they load, independent of your Google tags.

What does Google Consent Mode change?

Consent mode passes the visitor’s choice to Google tags, which then adjust their behaviour. In basic mode, Google tags only load after the visitor interacts with the banner. Without consent, nothing is sent. In advanced mode, the tags load immediately with a denied default. While consent is denied, they send cookieless pings and write no cookies for the denied purposes. Only after consent is granted do they set cookies and send full measurement data.

Consent mode only controls Google tags and tags with built-in consent mode support. Other scripts, such as pixels from other platforms, must be blocked by the banner itself or by consent checks in Tag Manager.

How do I find and fix the cause?

  1. Test in a clean session. Open the website in a private window, do not click the banner and check under Application → Cookies in the browser’s developer tools which cookies already exist.
  2. Assign each cookie. Names such as _ga or _gcl_au come from Google tags, _fbp from the Meta pixel. Unknown cookies can be traced via the Network tab.
  3. Check the default state. In Tag Assistant, the first event must show the default state for all four values ad_storage, analytics_storage, ad_user_data and ad_personalization before any tag fires.
  4. Move scripts into Tag Manager. Remove hard-coded tags from the theme and plugins and add them in Tag Manager with consent settings.
  5. Load the banner first. In Tag Manager, the banner or consent template fires on Consent Initialization – All Pages.
  6. Test again after every change. Theme updates and new plugins often add scripts again.

Whether your website loads tracking before consent is shown by a first test with our GDPR check.

If a scanner still flags tracking after these steps, see Why is my cookie scanner still reporting tracking without consent?

Set a denied default for all four consent values before any tag, run every script through Tag Manager with consent checks, and test in a private window without clicking the banner.

Sources

Want to know which cookies your website sets before consent, and why? We check banner, Tag Manager and every script and close the gaps. Book a free intro call or read more about our tracking services.

Need personal advice?

Our Google-certified experts are happy to help – free and without obligation.

Book a meeting