Back to the help center

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

  1. In Google Tag Manager, go to Templates > Tag Templates
  2. Click New and then click the three-dot menu > Import
  3. Download the template from your GetCookies dashboard or from: https://api.getcookies.co/api/v1/gtm-template/download
  4. Import the downloaded JSON file
  5. Click Save

Step 2: Create a GetCookies Tag

  1. Go to Tags > New
  2. Click Tag Configuration and select GetCookies CMP
  3. Enter your Domain ID (find this in your GetCookies dashboard under Domains > Widget Configuration)
  4. Keep Enable Google Consent Mode v2 checked (recommended)
  5. Click Triggering and add Consent Initialization - All Pages
  6. 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.):

  1. Open the tag
  2. Click Advanced Settings > Consent Settings
  3. Select Require additional consent for tag to fire
  4. 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
  1. Save the tag

Step 4: Publish

Click Submit in the top right to publish your changes.

Configuration Options

OptionDescriptionDefault
Domain IDYour GetCookies domain identifier (required)-
Enable Google Consent Mode v2Integrate with Google's consent APIEnabled
Wait for updateMilliseconds to wait for consent before firing tags500ms
Redact ads dataRedact ad identifiers when consent deniedDynamic
URL passthroughPass ad click info via URL when cookies deniedEnabled
Default consent statesInitial consent state per categoryAll denied

How It Works

  1. On Page Load: The template immediately sets all consent types to "denied" before any other tags can fire
  2. Check for Existing Consent: If the user has previously given consent, it's restored from localStorage
  3. Display Banner: The GetCookies widget loads and displays the cookie consent banner
  4. User Interaction: When the user accepts or customizes their consent, the template updates Google's consent state in real-time
  5. Tags Fire Accordingly: Tags with consent requirements only fire if the appropriate consent has been granted

The template supports all Google Consent Mode v2 consent types:

  • ad_storage - Advertising cookies
  • ad_user_data - User data for advertising
  • ad_personalization - Personalized advertising
  • analytics_storage - Analytics cookies
  • functionality_storage - Functionality cookies
  • personalization_storage - Personalization cookies
  • security_storage - Security cookies (always granted)

Verifying Installation

After publishing your container:

  1. Open your website in an incognito/private window
  2. Open Chrome DevTools > Console
  3. Look for messages starting with "GetCookies:" showing consent state
  4. Verify the consent banner appears correctly
  5. Use the Meta Pixel Helper or Google Tag Assistant to confirm tags are blocked before consent

Troubleshooting

  • 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
  • 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
  • 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:

Still stuck?

Email [email protected] with your domain and what you tried. Signed-in customers can also open a ticket from the dashboard.