---
title: "Install with a script tag"
description: "Add the CookieBeam loader directly to your site's HTML and verify the published banner."
url: "https://cookiebeam.com/docs/install/script-tag"
lang: "en"
---

# Install with a script tag

Add the CookieBeam loader directly to your site's HTML and verify the published banner.

Use the direct script method when you control the site's HTML or its global header template. It uses the same banner, published blocking rules, consent storage, and reporting as the GTM installation. CookieBeam can load independently of a tag manager; this choice does not depend on your subscription plan.

## Copy the production loader

In CookieBeam, open your banner and go to **Install**. Copy the production script. It follows this format:

```html
<script
  id="CookieBeam"
  src="https://cdn.cookiebeam.com/banner/PUBLIC_BANNER_ID/default/loader.js"
  type="text/javascript"
></script>
```

Replace `PUBLIC_BANNER_ID` only when you are constructing the tag manually. Copying from the dashboard already includes the correct ID.

## Add it to every page

Place the script once near the start of `<head>` in the shared site template, before Google tags and other managed scripts. Do not add `async` or `defer`. Publish or deploy the site change through your normal release process.

Do not paste the tag into a single content page unless that page is intentionally the only place where CookieBeam should run.

## Consent Mode and blocking

Direct installation supports Google Consent Mode V2. Enable Google Consent Mode in your published banner settings when using Google tags, and place the loader before any Google `config` or `event` commands. Follow [Google's consent setup requirements](https://developers.google.com/tag-platform/security/guides/consent).

Keep hardcoded non-essential scripts inert until consent with `type="text/plain"`, `data-category`, and `data-src` for external files. See [Script blocking](https://cookiebeam.com/docs/configure/blocking) for examples. A loader cannot undo a request that has already happened, and Consent Mode alone does not block every third-party tag or cookieless request.

Use one CookieBeam installation per page. If you choose the [GTM gallery template](https://cookiebeam.com/docs/install/google-tag-manager), follow that method's Consent Initialization steps instead of adding a second loader.

## Verify the installation

Open a private browsing window and load the site with browser storage cleared. Check that:

1. The consent banner appears without a console error.
2. Accepting consent enables the expected optional services.
3. Rejecting consent keeps non-essential services blocked.
4. Reopening preferences lets you change the stored choice.

If the banner does not appear, confirm that the published Banner ID matches the loader URL and that your content-security policy permits `cdn.cookiebeam.com`.
