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 near the end of <head> or before </body>.
<script src="https://cdn.cookiebeam.com/api/cdn/banner/PUBLIC_BANNER_ID/loader.js" defer ></script>
This loader sets Consent Mode defaults early and updates consent states after users interact with the banner.
Option B — Google Tag Manager
- Open GTM and navigate to Templates → Gallery. Search for “CookieBeam”.
- Add the “CookieBeam Consent Mode v2” template to your container.
- Create a new tag with the template and set Banner ID to your PUBLIC_BANNER_ID.
- Publish your container.
Template: CookieBeam Consent Mode v2 Field: Banner ID = PUBLIC_BANNER_ID Loader URL used by GTM: https://cdn.cookiebeam.com/api/cdn/banner/PUBLIC_BANNER_ID/loader?gtm=1
GTM’s built‑in consent events are respected. The template keeps Consent Mode values synchronized with the user’s selections.