Publications / Analytics and marketing
Google Tag Manager cookie consent: setup, Consent Mode and GDPR
Connect your cookie banner to Google Tag Manager, apply consent checks by purpose, and test what fires before and after a visitor makes a choice.

Latest posts
- Google merged the Google tag with Tag Manager – what it changes for cookie consent
- Advertising on Google or measuring traffic? Check whether you need a cookie banner
- How should a proper cookie banner work?
- How to prepare your website for consetgo – pre-installation checklist
- Cookies in an online shop – a practical checklist
Set up Google Tag Manager cookie consent by connecting your cookie banner to the container, setting the initial consent state before measurement tags run, and holding each optional tag until the visitor consents to the purpose it serves. Then test each choice in Tag Assistant and inspect the browser's requests and storage, including what happens after a visitor changes their mind.
Does Google Tag Manager use cookies?
Google describes Tag Manager as a way to configure and run tags in response to events such as a page load, a click or a form submission. In its cookie documentation, Google identifies Analytics, remarketing and Google Ads conversion measurement as features that use cookies. For a website audit, start with the code and destinations configured in your container. Seeing a GTM container in the page source tells you where to look for the configuration. It cannot tell you which measurement cookies your visitors will encounter.
Take a shop with a Google Analytics 4 tag for product views and a Google Ads tag for purchases. Visiting the home page can trigger the analytics tag without triggering the purchase tag. To check both, open a product and complete a test purchase. Repeat each journey with a fresh browser profile and each relevant consent choice. A short cookie scan on the home page covers only the behavior it actually triggers.
Google is now bringing container functionality to Google tags as well. In its November 17, 2026 release notes, Google announced that each Google tag will become a Tag Manager container, with a common snippet for new deployments and existing in-page tag behavior preserved by the upgrade. If the Tag Manager interface lists destinations for your Google tag, check them. Installations not yet covered by the upgrade receive it in January 2027. Read more about the Google tag and Tag Manager merger.
Google Tag Manager cookie consent under GDPR and ePrivacy
Article 5(3) of the ePrivacy Directive covers storing information on a user's device or accessing information already stored there. It generally requires clear information about the purposes, followed by consent. The exceptions cover operations that are solely for transmitting a communication or are strictly necessary to provide a service that the user explicitly requested. The rule concerns information on the device, including information that is outside the definition of personal data. Check how the relevant country has implemented the directive. See the EDPB guidance on Article 5(3).
For the shop in this example, keep optional analytics and advertising tags that read or write cookies blocked until the visitor agrees to the corresponding purpose. Confirming an order and reporting that purchase to an advertising platform serve different purposes. Assign the advertising tag to the marketing choice even if its trigger is the same confirmation page the shop needs to display to complete the purchase.
GDPR Article 4(11) defines consent as freely given, specific, informed and unambiguous, expressed through a statement or clear affirmative action. Article 7 requires the controller to be able to demonstrate consent and make withdrawal as easy as giving it. Use separate controls for analytics and marketing, leave optional choices off until selected, and provide a visible cookie settings link so people can revisit their decision. Keep a record of what the visitor agreed to and which notice they saw. See the EDPB guidelines on consent.
Set up a cookie banner with Google Tag Manager
1. Inventory what can run on the site
Start with the published container and record each tag's purpose, trigger and destination. Include conversion helpers and any Custom HTML that loads a vendor script. Then review what the website loads directly through its theme, plugins and page templates. A GA4 tag added through the CMS needs its own consent coverage even if you already configured a consent check on the GA4 tag in GTM.
For a store, include routes for the storefront, checkout and order confirmation. Record the expected event and the category that enables it. For example, a measurement tag might be eligible to fire on a product view when Analytics is enabled, and an advertising tag might qualify on an order confirmation when Marketing is enabled. An inventory with the trigger and destination makes it easier to trace a request back to the right configuration. See how to assign cookie categories to services.
2. Choose where the banner and defaults run
If the consent management platform (CMP) loads independently of GTM, use its documented integration to set the default state before Google measurement tags run and to update the state when the visitor saves a choice. That arrangement also lets you keep the web container behind a consent gate. The banner must be reachable on a first visit and after refusal so a visitor can make or change a choice even while the container is blocked.
If your CMP runs through GTM, attach its consent template to Consent Initialization - All Pages. The container must be able to load for this trigger to run. Google runs Consent Initialization before other triggers, including Initialization. Use it for code that establishes or updates consent. Keep measurement tags on their own triggers and apply the firing rules for their purposes. For a custom GTM template, use Google's setDefaultConsentState and updateConsentState APIs. A consent command queued from a Custom HTML tag can take effect too late for the next trigger. In a CMP integration, when the visitor saves or withdraws a choice, send the update on that page before any navigation, so the new state applies to subsequent tags. See the Google documentation on Consent Mode.
3. Map the banner to Consent Mode v2
Consent Mode communicates the banner's choices to supported Google tags. In a setup that requires opt-in, initialize the four signals below to denied. Update each signal according to the visitor's decision. If the CMP restores a saved choice, verify that consent is in place before an eligible tag sends measurement on the next page.
| Consent type | What it controls | Example mapping for the shop |
|---|---|---|
analytics_storage | Storage related to analytics | Grant when the visitor enables Analytics. |
ad_storage | Storage related to advertising | Grant when the visitor agrees to advertising storage. |
ad_user_data | Sending user data to Google for advertising purposes | Grant only if the advertising choice covers that use. |
ad_personalization | Personalized advertising | Grant only if the visitor's choice covers personalization. |
With Analytics alone enabled, the expected state in this example is analytics_storage: granted and all three advertising signals denied. If you offer advertising measurement separately from personalized advertising, test a choice that grants the applicable measurement permissions while keeping ad_personalization denied. The names in the banner should describe the purposes that each choice actually enables. Read more about Google Consent Mode v2.
Google documents two implementation modes. In basic mode, Google tags stay blocked until the visitor grants the relevant consent. In advanced mode, Google tags can load with denied signals and send cookieless pings. If the implementation calls for zero optional measurement requests before consent, configure basic mode and verify that the tags are blocked. A denied storage signal in a debug panel does not prove that this network requirement is met. See Google's explanation of basic and advanced Consent Mode.
4. Review built-in and additional consent checks
Open a web tag and go to Advanced Settings → Consent Settings. The Built-In Consent Checks section shows the consent types the tag uses to adapt its behavior. For a consent-aware Google tag, check whether that behavior matches the mode you intend to run. If your goal is to prevent a tag from executing until consent, configure a firing restriction as well where your integration requires one.
Under Additional Consent Checks, Require additional consent for tag to fire makes the tag wait for all selected consent types to be granted when its trigger matches. For example, a Custom HTML tag whose sole purpose is analytics can require analytics_storage if that signal represents consent for the service. A marketing tag can require a CMP-provided custom consent type for its purpose. Confirm that your CMP sets that type before adding the check. Not set applies no additional check. No additional consent required explicitly records that decision after you've reviewed the tag.
Pay attention to when a trigger is evaluated. If an analytics tag was blocked at page load and the visitor later accepts analytics on the same page, verify whether the integration fires the tag at that point. For a tag that should start immediately, use the CMP's documented event after the consent update if your integration needs a separate trigger. Keep the category check on the tag and verify that accepting once generates one expected page view.
For example, suppose the shop uses a page-view trigger for GA4 and an order-completed event for its advertising conversion tag. Test someone who accepts Analytics after the first page renders and someone who returns with Analytics already enabled. Both journeys should produce one recorded page view each time the test page is loaded. For the purchase tag, test with Marketing enabled before placing the order, then repeat with Marketing disabled. Keep the purchase trigger tied to the actual order event. A generic consent update can occur on any page, including after the visitor opens settings again, so using that update alone as the purchase trigger would measure a consent change as a sale.
5. Audit the whole container in Consent Overview
Open Admin → Container Settings and select Enable consent overview under Additional Settings. Go back to Tags and open the Consent Overview icon. Tags under Consent Not Configured have their additional consent setting left at its default. Start there to find unreviewed tags, then inspect the configured group for settings that don't match your inventory.
Use the overview's bulk edit option when several tags genuinely require the same permission. Review conversion and remarketing tags individually if they have different purposes. Save the workspace, test it in Preview and publish the container after testing. Google's Tag Manager consent settings guide covers the trigger, per-tag settings and the overview.
Test GTM cookie consent in Tag Assistant and the browser
In the GTM workspace, click Preview, enter the test page URL and connect. If the container is blocked until consent, Tag Assistant may be unable to connect before the visitor makes a qualifying choice. Use browser developer tools for that pre-consent test and connect after granting the permissions for the preview scenario. In Tag Assistant, select the earliest Consent event to inspect defaults and the latest consent event after saving a choice to inspect updates. In the Consent tab, compare On-page Default with On-page Update, then inspect which tags fired on the relevant event. See Google's Preview instructions and its consent debugging guide.
Use a fresh session for each initial decision. Open the Network panel before loading the page so you can capture the first requests. Inspect browser storage as well as requests, including requests to any first-party measurement endpoint you configured. After each choice, reproduce one analytics event and one advertising event, where applicable. In the following test plan, analytics and marketing are independent, and optional tags are blocked until the visitor grants permission for their purpose.
| Visitor action | Expected behavior |
|---|---|
| Open the site and leave the banner untouched | Optional measurement tags and their requests are absent. |
| Reject all | Optional tags stay blocked when you navigate to another page. |
| Enable analytics only | Eligible analytics tags can run. Advertising requests remain blocked. |
| Enable marketing only | Eligible marketing tags can run. Optional analytics remains blocked. |
| Accept all | Each tag can run on its intended event. Verify the destination and check for duplicate events. |
| Withdraw marketing after accepting all | Marketing signals change to denied, and further marketing activity is blocked. Analytics still follows its saved choice. |
When the consent state is right but a request is still sent, look at the request's initiator and check for a second installation on the website or in another container. If the tag is blocked even after permission, inspect the event where you expected it to fire and verify that the trigger matched and every required consent type was granted at that moment. After publishing, repeat the most important scenarios on the live site outside Preview. Keep the tested URL, choice, event and expected destination with the release record. See how to check whether a website sets cookies before consent.
Check consent on both sides of server-side GTM
In Google's server-side setup, a browser tag can send events to a tagging server and include consent parameters in the HTTP request. Tags in the server container can then send data on to destinations. If the endpoint is on your own subdomain, include it in the browser audit. For a setup intended to block optional collection before consent, test that the browser withholds those requests and that the server sends events only to destinations permitted by the choice. Try an analytics-only journey and verify that the server routes the test event to analytics without forwarding it for advertising. See Google's server-side Consent Mode guide.
What to include in your cookie policy when using GTM
Base the policy on what your tests show across the live site. For each service, record the purpose, provider, storage names and lifetimes you observed or verified, and the choice that enables it. Explain how visitors can reopen their settings. If a single container serves multiple destinations, describe the services separately so readers can tell which use is for analytics and which is for advertising. Refresh the inventory when a tag, trigger or destination changes, especially when a tag moves from a one-off campaign page to every page on the site.
consetgo blocks configured scripts on the server before the page reaches the browser and loads them after the visitor consents to the relevant category. The GTM container itself loads at once in advanced Consent Mode, the default from version 1.3.49, with denied signals; in basic mode it loads after consent. It can block tags in a GTM container by category and set Google Consent Mode v2 defaults before Google tags run, then update them after the visitor's choice. Visitors can reopen their settings from an icon or link, and the consent record is stored on your website's server. Try consetgo free for 14 days with no commitment.
Questions and answers
Does Google Tag Manager use cookies?
Google documents GTM as a way to run configured tags and identifies Analytics, remarketing and Google Ads conversion measurement as features that use cookies. Check which tags and destinations your site uses, then reproduce the events that trigger them to see what your configuration stores.
Can a cookie banner run inside a GTM container that waits for consent?
If the banner runs only as a tag in that container, it cannot ask for consent until the container loads. Put the banner outside the gated container or let the container start the CMP while optional measurement tags remain gated.
Why does a tag stay blocked after a visitor accepts cookies?
Check the consent state at the event that should fire the tag. The visitor may have granted consent for a different category, or the original trigger may have fired before the CMP applied the update.
Does a denied signal guarantee there were no Google requests?
In advanced Consent Mode, supported Google tags can send cookieless pings when consent is denied. If you expect zero optional requests, test the browser's Network panel from the start of the page load.
How do I test withdrawal when cookies remain in the browser?
Start with consent granted, withdraw it, and check the updated signals in Tag Assistant before triggering a new measurement event. Then compare the Network panel and the browser's storage before and after that event. A new request or cookie after withdrawal shows activity, but unchanged storage does not prove that no read occurred, so also check which tags fired.
How do I test consent for a server-side tagging endpoint?
Include the endpoint's hostname in your browser checks, even if it belongs to your site. Use a test event to verify both the incoming consent values and which downstream tags the server ran.