---
title: "GTM Integration Guide | CookieBeam"
description: "Learn how to integrate CookieBeam with Google Tag Manager and implement Google Consent Mode v2 for compliant analytics."
url: "https://cookiebeam.com/guides/gtm-integration"
lang: "en"
last_updated: "2026-10-17T12:02:29.412Z"
---

# Google Tag Manager Integration

Complete guide to integrating CookieBeam with Google Tag Manager using the official GTM template. Includes Consent Mode v2, Microsoft Clarity, and regional defaults.

## Overview

CookieBeam provides an official Google Tag Manager template that handles all consent management automatically. This template supports Google Consent Mode v2, Microsoft Consent Mode (Clarity & UET), and regional consent defaults.

### Template Features

- **Google Consent Mode v2**: Full support for ad_storage, analytics_storage, ad_user_data, ad_personalization
- **Microsoft Consent Mode**: Native support for Microsoft Clarity and UET consent signals
- **Regional Defaults**: Configure different defaults for EEA, UK, US, and other regions
- **Zero Dependencies**: High-performance CDN loading with no external dependencies

> **Note: Find CookieBeam in the Gallery**
>
> In your GTM web container, open **Templates > Search Gallery** and search for **CookieBeam**. Select **CookieBeam Consent Mode**, review its permissions, and click **Add to workspace**.

## Installation Steps

### Step 1: Get Your Banner ID

Open your banner in the CookieBeam dashboard, go to Deployment > Install, choose the Google Tag Manager tab, and copy the Banner ID.

### Step 2: Add the Gallery Template

Open **Templates > Search Gallery**, search for **CookieBeam**, and select **CookieBeam Consent Mode**. Review the requested permissions and click **Add to workspace**.

### Step 3: Create the Tag

Go to Tags > New. Select "CookieBeam Consent Mode" as the tag type. Enter your Banner ID in the configuration field.

### Step 4: Set the Trigger

Click **Triggering** and choose **Consent Initialization – All Pages**. Review the consent settings for each downstream tag; Consent Mode does not automatically block every tag or request.

### Step 5: Configure Regional Defaults (Optional)

Expand "Regional Settings" in the tag configuration. Set different consent defaults for EEA (denied by default for GDPR), US (granted by default for opt-out model), or other regions as needed.

### Step 6: Save and Publish

Test acceptance, rejection, and withdrawal in GTM Preview, including the consent state and requests from downstream tags. Save, submit, and publish your container version.

![CookieBeam dashboard, Deployment > Install with the Google Tag Manager tab open: three setup steps, the Banner ID with a Copy button, and the container-import fallback download](https://cookiebeam.com/images/guides/gtm-integration/01-dashboard-banner-id.png)

_Step 1: in the dashboard, open Deployment > Install > Google Tag Manager and copy your Banner ID. A container file download is there as a fallback._

![Google Tag Manager Templates screen with Tag Templates and Variable Templates sections and the New and Search Gallery buttons](https://cookiebeam.com/images/guides/gtm-integration/02-templates-page.png)

_Step 2: in GTM, open Templates, choose Search Gallery, and search for CookieBeam._

![GTM tag configuration for the CookieBeam Consent Mode tag: Wait for Update, Regional and Google and Microsoft Consent Mode sections, the Banner ID field, and a Consent Initialization - All Pages trigger](https://cookiebeam.com/images/guides/gtm-integration/03-tag-config.png)

_Steps 3–4, Configure the CookieBeam Consent Mode tag with your Banner ID, then trigger it on “Consent Initialization – All Pages.”_

## Google Consent Mode v2

Google Consent Mode v2 is required for EU compliance since March 2024. CookieBeam automatically signals consent states to Google Analytics 4 and Google Ads.

### Consent Mode Parameters

|  | Parameter | CookieBeam Category | Purpose |
| --- | --- | --- | --- |
| **ad_storage** | Marketing | Controls advertising cookies (Google Ads, remarketing) |  |
| **analytics_storage** | Analytics | Controls analytics cookies (GA4, measurement) |  |
| **ad_user_data** | Marketing | Controls sending user data to Google for ads |  |
| **ad_personalization** | Marketing | Controls personalized advertising and remarketing |  |
| **functionality_storage** | Preferences | Controls enhanced website functionality |  |
| **personalization_storage** | Preferences | Controls personalization features |  |
| **security_storage** | Necessary | Always granted (security features) |  |

## Microsoft Consent Mode (Clarity & UET)

CookieBeam also supports Microsoft Consent Mode for Clarity session recordings and UET (Universal Event Tracking) for Microsoft Ads. The template automatically sends consent signals to both platforms.

## Microsoft Clarity

Clarity respects the Analytics consent category. When users grant analytics consent, Clarity will record sessions. When denied, Clarity enters a privacy-safe mode. No additional configuration needed - the CookieBeam template handles this automatically.

## Microsoft UET (Bing Ads)

Microsoft UET for Bing Ads respects the Marketing consent category. Conversion tracking and remarketing only activate when users grant marketing consent. The template sends the appropriate consent signals to the Microsoft advertising platform.

## Configure Your Existing Tags

After installing CookieBeam, update your existing Google and Microsoft tags to respect consent settings.

## Update Google Analytics 4 Tags

### Step 1: Open your GA4 Configuration tag

In GTM, find your Google Analytics 4 Configuration tag and click to edit it.

### Step 2: Enable Consent Settings

Expand "Advanced Settings" > "Consent Settings". Check "Require additional consent for tag to fire" and select "analytics_storage".

## Update Google Ads Tags

### Step 1: Open your Google Ads tags

Edit each Google Ads Conversion Tracking and Remarketing tag.

### Step 2: Enable Consent Settings

In "Advanced Settings" > "Consent Settings", check the consent requirement box and select both "ad_storage" and "analytics_storage".

> **Warning: Important: Tag Firing Order**
>
> The CookieBeam tag MUST fire before any other marketing or analytics tags. Always use the "Consent Initialization - All Pages" trigger for CookieBeam. This ensures consent defaults are set before other tags attempt to fire.

## Testing Your Setup

### Testing Checklist

- Banner appears on page load — Visit your website and verify the consent banner displays
- Consent Initialization fires first — In GTM Preview, check that CookieBeam fires on "Consent Initialization"
- Default consent is "denied" — Check the Consent tab in GTM Preview shows denied states before interaction
- Consent updates on acceptance — Accept cookies and verify consent states change to "granted"
- GA4 respects consent — Verify GA4 only fires after analytics consent is granted
- Preferences persist — Reload the page and verify your consent choice is remembered

## Troubleshooting

## Banner not showing?

- Check that the CookieBeam tag is firing in GTM Preview mode
- Verify your Banner ID is correct (no typos)
- Clear your browser cache and cookies, then reload
- Check browser console for JavaScript errors

## Tags firing without consent?

- Ensure CookieBeam uses "Consent Initialization" trigger (not "All Pages")
- Verify other tags have consent requirements configured in Advanced Settings
- Check that no tags are set to fire on "Consent Initialization" except CookieBeam

## Consent Mode not working in GA4?

- Enable Consent Mode v2 in your CookieBeam dashboard under Banner Settings
- Check GA4 Realtime report for consent signals
- Verify GA4 property has Consent Mode enabled in Admin > Data Streams > Consent settings

> **Tip: Need Help?**
>
> If you're still having issues, contact us at support@cookiebeam.com or visit our troubleshooting page. Our team is happy to help you get set up correctly.
