Back to Guides
Integration12 min read

Google Tag Manager Integration

Complete guide to integrating CookieBeam with Google Tag Manager and implementing Consent Mode v2.

Prerequisites

  • A CookieBeam account with an active banner
  • Google Tag Manager account
  • Basic understanding of GTM
Overview

Google Tag Manager (GTM) is a powerful tool for managing website tags. When combined with CookieBeam, you can ensure all your tracking scripts respect user consent preferences through Google Consent Mode v2.

What is Consent Mode v2?

Consent Mode v2 is Google's framework for adjusting how Google tags behave based on user consent. It enables privacy-respecting measurement while maintaining compliance with regulations like GDPR.

Consent Mode Parameters

ParameterCategoryPurpose
ad_storageMarketingControls advertising cookies
analytics_storageAnalyticsControls analytics cookies
ad_user_dataMarketingControls sending user data to Google
ad_personalizationMarketingControls personalized advertising
functionality_storagePreferencesControls functional cookies

Integration Steps

1

Install CookieBeam via GTM

In GTM, create a new Custom HTML tag. Paste your CookieBeam script and set the trigger to "Consent Initialization - All Pages".

2

Configure Consent Mode Defaults

CookieBeam automatically sets default consent states to "denied" and updates them when users make choices. No additional configuration needed.

3

Update Your Google Tags

Ensure your GA4 and Google Ads tags are set to use Consent Mode. In the tag settings, enable "Require additional consent for ads features".

4

Test with GTM Preview Mode

Use GTM's Preview mode to verify consent states are being set correctly. Check the Consent tab to see the current consent status for each parameter.

Important

The CookieBeam tag must fire before any other tags that set cookies. Use the "Consent Initialization" trigger to ensure proper ordering.