Install CookieBeam
Choose the method that fits your stack. CookieBeam supports direct script embeds and a Google Tag Manager (GTM) template. Both initialize Google Consent Mode v2 correctly.
Before you start
- Sign up and create a banner to get your PUBLIC_BANNER_ID.
- Make sure your site allows loading scripts from cdn.cookiebeam.com.
- Publish changes to production when you’re ready.
Option A: Direct Script
- Copy your PUBLIC_BANNER_ID from the CookieBeam dashboard.
- Paste the script as the first element in <head>, loaded synchronously before any other script.
<script src="https://cdn.cookiebeam.com/banner/PUBLIC_BANNER_ID/default/loader.js" ></script>
This loader sets Consent Mode defaults early and updates consent states after users interact with the banner.
Option B: Google Tag Manager
Prefer the direct script installation to load first and synchronously. The GTM template loads after GTM and does not gate scripts hardcoded outside the container.
- Download the template from GitHub, then import it into your GTM workspace.
- Import the template and create a new tag.
- Set your Banner ID and use the "Consent Initialization" trigger.