TermsBox
PricingBlog
LoginGet Started
PricingBlogLogin
Get Started
  1. Home
  2. Install guides
  3. Google Tag Manager

Install the TermsBox Cookie Banner with Google Tag Manager

Google Tag Manager (GTM) is a free Google tool that lets you add code to your website without editing your website's files. If you already use GTM, you can add the TermsBox cookie banner through it. This method works on almost any website, no matter how it is built.

Please read the important note at the end first. GTM works, but because of how GTM loads code, a direct install in your site's <head> is more reliable. Use GTM if editing your site directly is not an option, or if GTM is already how you manage all your tags.


What you need

  1. Your site id. This is a short code that tells TermsBox which website is loading the banner.
  2. Where to get it: Log in to TermsBox, then go to Dashboard, Consent Banner, Install tab (the page at /dashboard/banner). Your site id is already filled into a ready-to-copy snippet there.
  3. Access to your Google Tag Manager container for the website, with permission to create and publish tags.

Tip: If you manage more than one website in TermsBox, make sure the correct site is selected before you copy. Each website has its own site id.


The snippet to copy

This is the exact code you will paste into GTM. Replace YOUR_SITE_KEY with your real site id (or copy the pre-filled version from the dashboard, which already contains your site id).

<script src="https://termsbox.com/cmp/termsbox-cmp.js" data-site-id="YOUR_SITE_KEY" data-auto-block="on"></script>

Do not add async or defer to this tag, and do not change the data-site-id. If the site id is missing or empty, a banner may appear but it will not connect to your account and will not work.


Step by step in Google Tag Manager

  1. Sign in to Google Tag Manager and open the container for your website.
  2. In the left menu, click Tags, then click New.
  3. Give the tag a clear name at the top, for example TermsBox Cookie Banner.
  4. Click the Tag Configuration box, then choose Custom HTML.
  5. Paste the snippet above into the HTML field, exactly as shown, with your real site id.
  6. Click the Triggering box to choose when the tag fires. You have two good options:
    • Consent Initialization, All Pages. This is the earliest trigger GTM offers and is the best choice, because the TermsBox banner should load before your tracking tags. Pick this if it is available.
    • All Pages (the built-in page-view trigger). Use this if you do not see a Consent Initialization option. It still fires on every page.
  7. Click Save.
  8. Click Preview to test, or click Submit and then Publish to make it live.

That is all. Once published, the banner loads on every page in that container.


Verify it works

  1. Publish your GTM container so the change is live.
  2. Open your website in a browser and do a hard refresh (hold Shift and click reload) to avoid a cached page.
  3. Look for the cookie banner to appear on screen.
  4. Confirm it on the correct address. TermsBox checks the main website address saved on your account, so make sure your live homepage shows the banner.
  5. Use the dashboard button. Go back to Dashboard, Consent Banner, Install tab and click Verify Installation. TermsBox will fetch your homepage and confirm the snippet is present. On success the status changes to verified.

You can also use GTM's own Preview mode to confirm the TermsBox tag fired on the page.


Important note: load order matters

The TermsBox banner works best when it loads before your tracking and analytics tools, so it can hold those tools back until the visitor gives consent. GTM often loads its tags a little later than code placed directly in your site's <head>. Two things follow from that:

  1. Fire the TermsBox tag as early as possible. The Consent Initialization trigger is the earliest one GTM offers, which is why it is the recommended choice above.
  2. Ideally, GTM itself should load with or after consent. If your Google Analytics, ads, or other tracking tags are also managed inside GTM, set them to respect consent so they do not fire before the visitor agrees. If you cannot control that, the most reliable setup is to install the TermsBox snippet directly in your site's <head> instead of through GTM. See the server-rendered install guide for that method.

In short: GTM is a fine way to install TermsBox, but for the strongest blocking of trackers before consent, a direct <head> install is best.


Troubleshooting

The banner does not appear.

  • Confirm you clicked Submit and then Publish in GTM. Saving a tag alone does not make it live.
  • Confirm the tag type is Custom HTML and the snippet was pasted exactly, with your real site id.
  • Check the trigger is Consent Initialization, All Pages or All Pages, so it fires everywhere.
  • Do a hard refresh, since your browser or a CDN may still show an old page.

The banner appears but nothing happens, or consent is not saved.

  • Check that data-site-id still has your real site id and is not empty. A blank site id shows a banner that does not actually work, with no error.
  • Make sure you copied the site id for the correct website if you manage more than one.

Trackers seem to fire before the banner shows.

  • This is the load-order issue described above. Move the TermsBox tag to the Consent Initialization trigger if you have not already.
  • Make sure your other tracking tags in GTM respect consent, or install TermsBox directly in your <head> for the earliest possible loading.

"Verify Installation" says it could not find the script.

  • The verifier checks your main saved site address (usually your homepage). Make sure the GTM container that includes the TermsBox tag actually loads on that address.
  • If your homepage is behind a login, a password, or strong bot protection, the verifier may be blocked from reading it. The banner can still work for real visitors. Load the page yourself and check the page source for termsbox-cmp.js to confirm.
  • Wait a moment and try again. There is a short limit of a few checks per minute.
View install guides for all platforms
TermsBox

Scan your website, auto-generate legal documents, add a consent banner, and stay compliant. One platform for everything.

Product

  • Cookie Scanner
  • Consent Banner
  • Cookie Policy Generator
  • Pricing

Generators

  • Privacy Policy Generator
  • Terms and Conditions Generator
  • EULA Generator
  • Disclaimer Generator
  • Return and Refund Policy Generator

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service
  • Cookie Policy
GDPR
ePrivacy
CCPA
LGPD
Google Consent Mode v2
IAB TCF 2.2
© 2026 TermsBox. All rights reserved.