---
title: Google Tag Manager
description: Set up Google Consent Mode v2 with the Google tag, a website script alongside GTM, or the 1Consent CMP template. Verify how your tags respond to visitor choices.
url: https://1consent.app/docs/integration/google-tag-manager
---

# Google Tag Manager

1Consent sends Google Consent Mode v2 signals and publishes committed visitor choices to the dataLayer. **Consent signals and script blocking are separate controls.** A Google tag that has already loaded can send cookieless measurements while consent is denied.

## Choose how to connect your Google tags

| Setup | How the banner loads | When to use it |
| --- | --- | --- |
| [Direct Google tag](#direct-ga4-without-a-gtm-container) | Your website loads 1Consent. 1Consent or your site loads the Google tag. | You manage the Google tag in your website code or want 1Consent to load it for you. This includes [Google Ads conversion tracking](#direct-google-ads-conversion-tracking-without-a-gtm-container). |
| [Website script alongside GTM](#install-the-website-script-alongside-gtm) | Your website loads 1Consent before the GTM container. | You manage tags in GTM and load 1Consent from your site. Use this setup for strict Basic mode, regional routing, or 1Consent's automatic blocking. |
| [Install 1Consent from GTM](#install-1consent-from-a-gtm-container) | The 1Consent CMP template loads your published banner. | Your GTM workspace has the template and you use one all-region GDPR banner in Advanced mode. |

Use one banner loader and one source of Google consent defaults on each page. Configure each Google destination once.

In the 1Consent Dashboard, open **Banner → Google Consent Mode** for the banner you will publish. Add the Google services you use to that banner and turn on **Google Consent Mode v2**. The integration sends Google's consent signals and publishes the `1consent:consent` event to the data layer.

For a page-code install, load 1Consent **synchronously, before Google or GTM snippets**, so the bootstrap establishes defaults before a Google tag can execute.

## Install 1Consent from a GTM container

Use the **1Consent CMP** template when it is available in your container. This
option supports a single published, all-region GDPR banner in **Advanced Consent
Mode** with denied defaults, the standard `dataLayer`, and a **500 ms** default wait. The tag loads
your site's published design and settings. It sets consent defaults in GTM as
soon as it fires and passes along choices saved in 1Consent.

1. Add the Google services you use to your banner. In **Google Consent Mode**,
   choose **My website** under **Who loads your Google tag?**, turn on **Load 1Consent with the GTM template**,
   then publish. Set up consent checks for Google and other tags in GTM. This
   install uses GTM for tag blocking; the page-code install retains 1Consent's
   automatic blocking.
2. Add the **1Consent CMP** tag, enter your public **1Consent Site ID**, and
   select **Consent Initialization – All Pages**. Load the GTM container on page
   entry so the tag can display the banner before a choice. In your test setup,
   use this tag as the only banner loader and source of Google consent defaults.
3. Open **Preview** in Tag Manager and [verify the Advanced setup](#verify-the-complete-setup)
   in Tag Assistant and your browser before publishing the container.

Use the [website script alongside GTM](#install-the-website-script-alongside-gtm) for
strict Basic mode, regional banner routing, active banner experiments, or automatic
blocking before GTM loads. Use the platform integration for platform-managed installations.

If your website already loads 1Consent, republish the banner with the GTM install
choice and test the template on a page without the existing embed. Keep the live
site's current loader during testing. After Preview passes, coordinate publishing
the GTM tag with removing the old website embed and any duplicate Google consent
defaults. On the live page, check that 1Consent loads once and consent behaves as
it did in Preview.

To switch back to page code, coordinate the website script rollout and removal
of the 1Consent template tag. Turn off the GTM install choice and publish the
banner. Complete the switch before changing live routing, deleting the live
banner, or restoring a version from before the GTM install.

## Basic and Advanced describe different network behavior

| Mode | Before consent or after rejection |
| --- | --- |
| **Basic** | Prevent the relevant Google tags from loading. There must be no Google measurement requests, including cookieless pings. |
| **Advanced** | Google tags load with the configured denied defaults and can send cookieless measurements. A later grant enables the corresponding consented measurement. |

Select the mode deliberately. In 1Consent, Basic defers **its own optional Google tag loader** until the destination's effective consent is granted. It does not block an independently installed Google/GTM snippet merely because the mode is named Basic. Gate that snippet explicitly or use a correctly configured Autoblocker setup.

Google explains the difference in its [Consent Mode overview](https://developers.google.com/tag-platform/security/concepts/consent-mode). Cookieless requests still transmit information; choosing Advanced does not establish a legal basis or remove disclosure and consent obligations. Review the intended collection before enabling it.

## Direct GA4 without a GTM container

For a single GA4 destination in Basic mode, choose **Basic** under **Banner → Google Consent Mode**, choose **1Consent** under **Who loads your Google tag?**, and enter your `G-…` measurement ID. Add the catalogue's Google Analytics service to an optional category. Keep unrelated advertising and personalization consent defaults denied.

1Consent queues the defaults and, after a committed Analytics grant or a valid stored grant, sends the effective consent update and loads/configures that destination once. Remove the website's separate `gtag.js` loader and `gtag('config', …)` snippet so the destination has one owner.

If your website owns the snippet instead, choose **My website** and use the [Performance Setup](/docs/integration/script-tag):

```html
<template data-1c-service-tag="google-analytics-4">
  <script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
  <script>
    window.dataLayer = window.dataLayer || [];
    window.gtag = function () { window.dataLayer.push(arguments); };
    gtag('js', new Date());
    gtag('config', 'G-XXXXXXXXXX');
  </script>
</template>
```

This example uses the catalogue key for **Google Analytics 4**. Template gates accept the configured service's catalogue key, exact name, or runtime service ID; use the key belonging to the service you actually added. A provider name shared by several services is not a suitable service-specific gate. Keep both scripts inside the template. Application code must also wait for the committed Analytics grant before dispatching measurement events; do not queue pre-consent gameplay history for later transmission. The bootstrap's internal `gtag` helper is not a promise that your application has a global `window.gtag` function.

## Direct Google Ads conversion tracking without a GTM container

The same two choices apply to a Google Ads tag (`AW-…`) that measures conversions. Add the catalogue's **Google Ads Conversion Tracking** service to an optional category and turn on **Google Consent Mode v2** in Basic mode. 1Consent then sends the defaults and, from each choice, the update for that service.

Under **Who loads your Google tag?**, either choose **1Consent** and enter your `AW-…` ID, or choose **My website** and keep the snippet in your website, with the loader and its start together in one gate:

```html
<template data-1c-service-tag="google-ads-conversion-tracking">
  <script async src="https://www.googletagmanager.com/gtag/js?id=AW-XXXXXXXXXX"></script>
  <script>
    window.dataLayer = window.dataLayer || [];
    window.gtag = function () { window.dataLayer.push(arguments); };
    gtag('js', new Date());
    gtag('config', 'AW-XXXXXXXXXX');
  </script>
</template>
```

In React, write the same gate with [`<OneConsent service="google-ads-conversion-tracking" once>`](/docs/integration/react). Do not add your own `gtag('consent', …)` commands on a page where 1Consent sends them: the page then has two sources of consent signals.

Send a conversion only after the visitor's grant, and do not queue conversions before it. Use your own snippet for that: the `window.gtag` it defines exists only once the gate was released, so `gtag('event', 'conversion', { send_to: 'AW-XXXXXXXXXX/LABEL' })` can only run for a visitor who allowed the service. When 1Consent loads the Google tag, it defines no global `gtag`. Send each conversion once, at the moment it happens: a call that runs on every load of a page sends another conversion on each reload.

Check what your tag transmits in the browser's Network panel. In our own tests of Google's library (November 2026):

- **Each page the tag starts on is reported to Google**, also with `send_page_view: false`. Google documents that setting as keeping visitors off remarketing lists; it does not stop the request.
- **The page's real path and title go along with every request**, and so does the address of the referring page as the browser provides it. A `page_location` you pass replaces the address in one field only. Start the tag only on pages whose address and title carry no personal or account identifier. After a client-side move to another page the loaded library sent nothing by itself, also when consent signals changed.
- **The ad click is read from the address of the page the tag starts on** and kept in first-party cookies (`_gcl_aw`, `_gcl_au`) on the highest domain level, which subdomains share. A visitor who allows the service only on a later page, whose address no longer carries the click ID, is not attributed: no click cookie was written in that test.
- To measure conversions without remarketing, add `gtag('set', 'allow_ad_personalization_signals', false)` before `config`. 1Consent's update still grants the consent types of the service the visitor allowed.

### A conversion on another subdomain

1Consent stores a visitor's choice for the origin it was made on. A choice made on `example.com` is not known on `app.example.com`, even though Google's click cookie is shared by both. A page on the other origin that should report the conversion needs that choice first:

- Install the banner there too. The visitor is then asked on that origin as well.
- Or let the origin that holds the choice report it. Serve a page there that contains the banner, the gated tag, and a script that sends the conversion when its parent asks. Open that page in a hidden frame from the other origin and post it a message when the conversion happened. The banner releases the tag only for a visitor who allowed the service, so nobody else sends anything, and Google receives the framed page's address instead of the application's. Name the receiving origin in `postMessage`, check `event.origin` and `event.source` on receipt, and allow framing only from that origin (`frame-ancestors`).

Google advises against sending conversions from inside a frame. A frame on another site cannot read the click cookie; a frame on the same site can: in our test the conversion sent from it carried the click ID. Confirm in Google Ads that such conversions are recorded for your account.

## Install the website script alongside GTM

Choose **My website** under **Who loads your Google tag?** when GTM manages that Google destination. Set up consent checks in the container for each tag. In strict Basic mode, gate the relevant Google loaders so they can run only after the required grant.

### GTM with GA4

Add the Google Analytics service to your banner.

For a container dedicated to this one Google Analytics 4 service, place the **entire standard GTM bootstrap script** inside a `<template data-1c-service-tag="google-analytics-4">`. Keep the 1Consent install outside the template and before it. Do not leave an ungated GTM `<noscript>` iframe, Google loader, or Google preconnect on the page.

A container with several services needs a gating plan for those services: granting Analytics must not release unrelated advertising or custom tags. Configure per-tag consent checks/triggers and ensure the container itself is not sent before the grant required by your Basic setup. Consent Mode's built-in checks adjust Google tag behavior; they do not replace the container loading gate.

1Consent maps catalogue service grants to these Consent Mode types:

| Catalogue service | Types granted by 1Consent for this service |
| --- | --- |
| Google Analytics 4 | `analytics_storage` |
| Google Ads | `ad_storage`, `ad_user_data`, `ad_personalization` |
| Google Ads Conversion Tracking | `ad_storage`, `ad_user_data`, `ad_personalization` |
| Floodlight | `ad_storage`, `ad_user_data`, `ad_personalization` |
| Conversion Linker | `ad_storage` |

These are 1Consent's grant mappings, not an exhaustive list of signals a Google product consumes. For example, denied advertising storage also affects Google Analytics' use of Ads cookies and Google signals. 1Consent resolves the mapping from the catalogue identity of each Google service in the framework. An Analytics-only grant enables `analytics_storage`; it must not grant advertising consent for a service you did not configure and the visitor did not approve.

If Advanced is explicitly selected, Google/GTM loaders may run with denied defaults and send cookieless pings. A service-gated container remains blocked until consent; selecting Advanced alone does not move a template-gated loader outside its gate.

## Non-Google tags: fire on the `1consent:consent` event

For tags that aren't Consent-Mode-aware, use one GTM trigger keyed off a single event. **You only need one trigger per tag** — the `1consent:consent` event covers both returning visitors and in-session changes.

### Create a Data Layer Variable for the category

In GTM: **Variables → New → Data Layer Variable**. Set the variable name to the consent path you care about:

```
1consent.categories.marketing
```

Replace `marketing` with the **actual category key in the emitted dataLayer payload**. The example is illustrative; a display name or template service tag is not automatically a dataLayer key. To gate on a specific service instead of a whole category, use its emitted key in the `services` map:

```
1consent.services.meta-pixel
```

The value is `true` when the visitor has granted that category/service, `false` otherwise. Name the variable something like `1c - marketing granted`.

### Create a Custom Event trigger

In GTM: **Triggers → New → Custom Event**. Configure:

- **Event name:** `1consent:consent`
- **This trigger fires on:** *Some Custom Events*
- **Condition:** `1c - marketing granted` **equals** `true`

Because the same `1consent:consent` event fires both when a returning visitor arrives with stored consent and when a visitor changes consent during the session, this one trigger handles every case.

### Attach the trigger to your tag

Open the tag you want gated (e.g. Meta Pixel), and set this trigger as its firing trigger. The tag now fires the moment marketing consent is present — and never before.

Remove any All Pages / DOM Ready triggers from tags you're gating this way, or they'll fire regardless of consent.

## The `1consent:consent` event payload

Each push looks like this — useful when you want to build richer triggers or read the high-level decision:

```js
window.dataLayer.push({
  event: "1consent:consent",
  "1consent": {
    reason: "ready",          // "ready" = initialized, "update" = a committed/reconciled choice
    consentRequired: false,   // true whenever there is no current valid authoritative choice
    decision: "G",            // "A" all granted · "D" none granted · "G" mixed · null = no decision yet
    categories: { analytics: true, marketing: false },
    services:   { "google-analytics-4": true, "meta-pixel": false },
  },
});
```

- Gate on `categories.<id>` / `services.<id>` for the common case.
- Use `reason: "update"` to distinguish committed/reconciled updates from initialization. It can include an external choice; it does not prove a local user action.
- `decision` and `consentRequired` are there for reporting or conditional logic — most tags don't need them.
- `decision` covers every optional category and service together: `"A"` only when all of them are granted, `"D"` when none is (including a site with nothing optional), `"G"` otherwise. It never stands in for a specific grant, so gate tags on their category or service.

The initial event also exists for a visitor who has not decided: `consentRequired` is then `true` and `decision` is `null`. Require an explicit granted service/category value. Preference toggles are drafts until saved; canceling them does not publish a grant. The event and Consent Mode update share the dataLayer queue; do not assume a Google consent update has already run when a custom trigger handles this event.

## Withdrawal and returning visitors

Keep **Reload page when consent is withdrawn** enabled for Basic setups. A script that already executed cannot be unexecuted by putting its original markup behind a gate. A local withdrawal saves the decision and publishes denied signals before reloading, so the rejected tag is absent on the new page. External/cross-tab reconciliation applies denied signals while the incoming choice is pending, then applies its authoritative result. Application code must stop its own event dispatch as soon as withdrawal begins; it must not treat a reload or an asynchronous save as an immediate network barrier.

On a later visit, 1Consent can apply a valid stored choice without asking again. In strict Basic mode, a stored grant can release the matching tag. A stored rejection keeps it blocked. Expired or otherwise invalid choices cannot release it.

## Verify the complete setup

Start in a fresh browser session. Use [Tag Assistant](https://developers.google.com/tag-platform/security/guides/consent-debugging) to inspect the consent defaults, updates, and tag events. Use your browser's Network and Storage panels to check actual requests and cookies. For a template install, start Tag Assistant from the GTM container's **Preview**.

| Visitor action | Strict Basic | Advanced |
| --- | --- | --- |
| Open the page or choose Reject All | The relevant Google tags stay blocked. Check for zero Google measurement requests and no new analytics or advertising cookies. | Verify the applicable default denials before any Google tag fires and that rejection keeps those signals denied. Cookieless measurements can appear. Check that rejected purposes do not set cookies or send consented measurements. |
| Save Analytics only | The permitted analytics tag loads, and an event reaches the intended GA4 measurement ID. | The analytics consent update permits consented GA4 measurement. Check that an event reaches the intended measurement ID. |
| Withdraw Analytics | The denied update applies, and the relevant tag stays blocked after the configured reload. Check that measurement requests stop, including after another reload. | The denied update applies before any configured reload and persists on return. Check that consented measurement stops. Cookieless requests can continue. |

With either mode, verify that an Analytics-only choice leaves advertising consent denied, a canceled preference edit sends no new grant, and a returning visitor's saved choice is restored. Check for a single banner loader and a single configuration per Google destination.

## Custom dataLayer name for page-code installs

If you renamed your dataLayer via the `l` parameter in the GTM snippet, set the same name in the dashboard's **DataLayer Name** field so 1Consent pushes to the right array. Leave it blank to use the default `dataLayer`.

## Next steps

- [Script tag integration](/docs/integration/script-tag) — install 1Consent on any site
- [US Privacy](/docs/compliance/us-privacy) — CCPA/US state-law behaviour
