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 the setup that matches your website:
| Setup | Loader owner | Basic-mode requirement |
|---|---|---|
| Direct GA4, without GTM | 1Consent's optional Google tag loader | Select Basic and enter your G-… ID; remove the site's separate Google loader/config snippet. |
| Direct GA4 with your own snippet | Your website | Keep 1Consent's Google tag loader off and wrap the loader and initialization in a service-gated template. |
| GTM containing GA4 | Your GTM container | Keep 1Consent's Google tag loader off; gate the container and configure its tags for the services they use. |
Do not combine these loader paths: two owners can initialize the same destination twice.
Enable the integration under Framework settings → Google Tag Manager in your dashboard. Turning it on makes 1Consent push Consent Mode signals and the 1consent:consent event to your dataLayer. Everything below assumes it's enabled.
Install 1Consent synchronously, before Google or GTM snippets, so the bootstrap establishes Consent Mode defaults before a Google tag can execute.
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. 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, enable Google Tag Manager in the framework settings, choose Basic, enable Load Google Tag (gtag.js), 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, leave Load Google Tag off and use the Performance Setup:
<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.
GTM with GA4
Keep Load Google Tag off when GTM owns the destination. Add the Google Analytics service and enable Consent Mode in the framework. For Basic mode, prevent an independent container/tag from loading before the relevant grant.
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 |
| 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.marketingReplace 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-pixelThe 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 grantedequalstrue
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:
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: "A", // "A" all accepted · "D" all denied · "G" granular · 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. decisionandconsentRequiredare there for reporting or conditional logic — most tags don't need them.
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, a valid stored grant can release the matching tag without asking again. A stored rejection keeps it blocked. Expired or otherwise invalid choices must not release it.
Verify the complete setup
Use a browser's Network panel and actual emitted consent state:
- New visitor, Basic: no Google loader, container, collect request, or analytics cookie before consent.
- Reject: Google remains blocked; reload and confirm the stored rejection still blocks it.
- Accept Analytics: exactly one loader/configuration runs and actual GA events reach the intended measurement ID. Advertising consent stays denied for an Analytics-only setup.
- Edit then cancel: a draft grant must not load the tag or send a granted update.
- Withdraw: dispatch stops, denied signals apply, and the configured reload returns to a page without the Google tag. Verify the subsequent stored rejection too.
- Returning accepted visitor: the tag loads once from the valid stored choice.
- Advanced, if selected: verify denied-state cookieless requests and granted-state behavior explicitly. Absence of cookies alone does not prove absence of collection.
Repeat these checks for your chosen direct-GA or GTM path; passing one does not establish the other.
Custom dataLayer name
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 — install 1Consent on any site
- US Privacy — CCPA/US state-law behaviour
Next.js Integration
Install the 1Consent Next.js adapter, preserve Server Component boundaries and verify consent gates across streaming and client navigation.
Lovable
Connect the production 1Consent MCP with OAuth and use your app's installation context to integrate and verify consent in a Lovable project.