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

Option A — Direct Script

  1. Copy your PUBLIC_BANNER_ID from the CookieBeam dashboard.
  2. 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

  1. Open GTM and navigate to Templates → Gallery. Search for “CookieBeam”.
  2. Add the “CookieBeam Consent Mode v2” template to your container.
  3. Create a new tag with the template and set Banner ID to your PUBLIC_BANNER_ID.
  4. 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.