c15t
/
C15T Logo
Frameworks
Welcome to c15t Docs
Introduction to Consent Management (c15t)
AI Tools Integrations
OSS
Contributing to c15t.com
License
Building Privacy Tools in the Open
Legal
Cookie Policy
Privacy Policy
C15T Logo
HomeFrontendIntegrationsSelf HostChangelog
xbskydiscordgithub1.4k
c15t
/
C15T Logo
Frameworks
Welcome to c15t Docs
Introduction to Consent Management (c15t)
AI Tools Integrations
OSS
Contributing to c15t.com
License
Building Privacy Tools in the Open
Legal
Cookie Policy
Privacy Policy
home-2Docs
chevron-rightIntegrations
chevron-rightGoogle-tag-manager

Google Tag Manager

Deploy and manage marketing tags centrally with automatic consent state synchronization.

Google Tag Manager (GTM) is Google's tag management system that lets you deploy and manage marketing tags, analytics scripts, and conversion pixels without modifying your codebase. Instead of hardcoding multiple scripts, you configure them through GTM's web interface.

c15t automatically injects the GTM script into your page and syncs consent state with GTM using Consent Mode v2. By default, c15t loads GTM regardless of consent because GTM manages its own internal consent state and only fires tags when appropriate consent is granted.

This prevents GTM-managed scripts from loading without proper consent while giving you centralized control over your marketing stack.

Implementation

Creating a Tag Manager Container

Info

This step is optional if you already have a Tag Manager container. Ensure your container has consent overview enabled.

After signing into Google Tag Manager, you can create a new container. Continue to Google Tag Manager

  1. In Tag Manager, click Admin > Container Settings.
  2. Under Additional Settings, select "Enable consent overview".

Enable consent overview

Custom Update Trigger

We now need to create a custom trigger in GTM to trigger the update event, this is the trigger that is fired when the consent state is updated, e.g. user gives consent to a specific purpose.

In GTM, you can create a new trigger by clicking on the "Triggers" tab and then clicking on "New".

For the event name, you can use the default "consent-update", this is customizable later so you can change it if you want.

Create trigger

Adding / Updating tags

Now for your existing tags, you can add the "consent-update" trigger to the tag, this will fire the update event when the consent state is updated & it has the appropriate consent state.

Update tags

Setting up c15t with Google Tag Manager

After creating your container, you can set up c15t with Google Tag Manager. All you need to do is copy and paste your container ID & begins with "GTM-".

import { configureConsentManager } from 'c15t';
import { googleTagManager } from '@c15t/scripts/google-tag-manager';

configureConsentManager({
  // ... 
  scripts: [
    googleTagManager({
      id: 'GTM-XXXXXXX',
    }),
  ],
});

Types

GoogleTagManagerOptions

Property
Types

Script

Property
Types
C15T Logo
Leverage native React components for seamless integration and high performance in a robust Consent Management solution that empowers your development team while prioritizing privacy and compliance.
Product
  • Documentation
  • Components
Company
  • GitHub
  • Contact
Legal
  • Privacy Policy
  • Cookie Policy
c15t