Integrations
GTM Template Installation Guide
Install GetCookies consent management via Google Tag Manager
Available on the Pro plan and above. See pricing for what each plan includes.
Install GetCookies consent management via Google Tag Manager with full Google Consent Mode v2 support. This template ensures tracking scripts like Meta Pixel, Google Ads, and Google Analytics are properly blocked until user consent is given.
Why Use the GTM Template?
The GetCookies GTM template provides:
- Full Google Consent Mode v2 Support - Sets default consent state BEFORE any tags fire
- Automatic Blocking - Meta Pixel, Google Ads, and other tracking is blocked until consent
- Real-time Updates - Consent state updates immediately when users interact with the banner
- Consent Persistence - Remembers user choices across sessions
- URL Passthrough - Preserves ad click information (gclid, dclid) even when cookies are denied
Prerequisites
Before installing, ensure you have:
- A Google Tag Manager account with container access
- A GetCookies account with at least one domain configured
- Your GetCookies Domain ID (found in Dashboard > Domains > Widget Configuration)
Installation Steps
Step 1: Download the GetCookies Template
- In Google Tag Manager, go to Templates > Tag Templates
- Click New and then click the three-dot menu > Import
- Download the template from your GetCookies dashboard or from:
https://api.getcookies.co/api/v1/gtm-template/download - Import the downloaded JSON file
- Click Save
Step 2: Create a GetCookies Tag
- Go to Tags > New
- Click Tag Configuration and select GetCookies CMP
- Enter your Domain ID (find this in your GetCookies dashboard under Domains > Widget Configuration)
- Keep Enable Google Consent Mode v2 checked (recommended)
- Click Triggering and add Consent Initialization - All Pages
- Save the tag
Important: The trigger MUST be "Consent Initialization - All Pages" to ensure consent defaults are set before any other tags fire.
Step 3: Configure Your Tracking Tags
For each tracking tag (Google Analytics, Google Ads, Meta Pixel, etc.):
- Open the tag
- Click Advanced Settings > Consent Settings
- Select Require additional consent for tag to fire
- Add the appropriate consent types:
- Google Analytics:
analytics_storage - Google Ads:
ad_storage,ad_user_data,ad_personalization - Meta Pixel:
ad_storage,ad_user_data,ad_personalization - Other advertising:
ad_storage
- Save the tag
Step 4: Publish
Click Submit in the top right to publish your changes.
Configuration Options
| Option | Description | Default |
|---|---|---|
| Domain ID | Your GetCookies domain identifier (required) | - |
| Enable Google Consent Mode v2 | Integrate with Google's consent API | Enabled |
| Wait for update | Milliseconds to wait for consent before firing tags | 500ms |
| Redact ads data | Redact ad identifiers when consent denied | Dynamic |
| URL passthrough | Pass ad click info via URL when cookies denied | Enabled |
| Default consent states | Initial consent state per category | All denied |
How It Works
- On Page Load: The template immediately sets all consent types to "denied" before any other tags can fire
- Check for Existing Consent: If the user has previously given consent, it's restored from localStorage
- Display Banner: The GetCookies widget loads and displays the cookie consent banner
- User Interaction: When the user accepts or customizes their consent, the template updates Google's consent state in real-time
- Tags Fire Accordingly: Tags with consent requirements only fire if the appropriate consent has been granted
Supported Consent Types
The template supports all Google Consent Mode v2 consent types:
ad_storage- Advertising cookiesad_user_data- User data for advertisingad_personalization- Personalized advertisinganalytics_storage- Analytics cookiesfunctionality_storage- Functionality cookiespersonalization_storage- Personalization cookiessecurity_storage- Security cookies (always granted)
Verifying Installation
After publishing your container:
- Open your website in an incognito/private window
- Open Chrome DevTools > Console
- Look for messages starting with "GetCookies:" showing consent state
- Verify the consent banner appears correctly
- Use the Meta Pixel Helper or Google Tag Assistant to confirm tags are blocked before consent
Troubleshooting
Banner not showing?
- Ensure the Domain ID is correct and matches your website domain exactly
- Check the browser console for any JavaScript errors
- Verify the domain is active in your GetCookies dashboard
Consent not updating?
- Check that the trigger is set to "Consent Initialization - All Pages"
- Ensure Google Consent Mode v2 is enabled in the tag settings
- Look for "GetCookies: Consent updated by user" in the console
Tags firing before consent?
- Verify each tracking tag has consent requirements configured
- Ensure the GetCookies tag uses "Consent Initialization" trigger (not "All Pages")
- Check tag firing sequence in GTM Preview mode
Meta Pixel still firing?
- Add consent requirements to the Meta Pixel tag:
ad_storage,ad_user_data,ad_personalization - Ensure the GetCookies tag fires before the Meta Pixel tag
Support
For additional help:
- Visit getcookies.co/support
- Email [email protected]
- Check the GitHub repository: github.com/getcookiescmp/getcookies-gtm-template
Still stuck?
Email [email protected] with your domain and what you tried. Signed-in customers can also open a ticket from the dashboard.