Make your Google tag wait for consent

2 min read Updated June 2026

If you’ve added the Google tag (gtag.js) or Google Tag Manager straight into your site’s header, it runs the moment a page loads — before anyone has answered the banner. This guide shows two ways to make it wait for consent instead.

Why an untagged Google tag doesn’t wait

A normal Google snippet looks like a regular <script>, so the browser runs it immediately. ClearConsent only holds scripts it can recognise, so you need to either tag the script or turn on Google Consent Mode.

Option A — tag the Google script

First add a service for it (for example, slug google-analytics) under Services. Then change the script so ClearConsent holds it until the visitor consents to that service: set the type to text/plain and add the service slug.

HTML
<!-- Held until the visitor consents to "google-analytics" -->
<script type="text/plain" data-cc-name="google-analytics"
        src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script>

When the visitor consents, ClearConsent activates the script. Until then it stays inert.

If you’d rather keep Google’s tag in place and let it adjust its own behaviour, turn on Google Consent Mode instead. ClearConsent then loads in consent-gated mode: all v2 signals start denied, and Google’s tags wait for consent before they read or write cookies. See Enable Google Consent Mode v2.

Pick one approach per tag
Either tag the script (Option A) or hand it to Consent Mode (Option B) — you don’t need both for the same Google tag. Consent Mode is the simplest choice if you only use Google Analytics or Google Ads.

Check it worked

Open your site in a private window and watch the network requests before you click anything: the Google request shouldn’t fire until you accept. After you consent, it loads as normal.

Was this article helpful?
Thanks for your feedback!

Related articles