CookieChest CMP · Installation
Install CookieChest
Installing takes about 10 minutes. There are two ways to do it. Pick one, not both.
<head>. Works whether or not you use GTM.AlternativeGoogle Tag ManagerIf you can publish GTM but can't edit your site's code.Before you start, read What a consent banner can and can't control. Where your tracking scripts live decides how much any banner, ours included, can actually hold back.
Before you begin
Log in to your CookieChest portal and open your site. The Install tab has your Site Token and your direct-install code.
Method 1 · Recommended
Direct install
Use this if you (or your developer) can edit your site's HTML, theme or template. It sets consent before anything else on the page loads, so it's already watching when other scripts start adding trackers, and can hold back the known ones.
- In the CookieChest portal, open your site's Install tab and copy the code under Direct install. It looks like this:
<script src="https://cmp.cookiechest.com/v1/cmp.js?t=YOUR_SITE_TOKEN"></script>
- Paste it into your site's
<head>as the very first script: above Google Analytics, Meta Pixel, GTM or anything else that tracks. - Paste it exactly as given. Don't add
asyncordefer, and don't load it through a plugin that delays or combines scripts (WP Rocket's "Delay JavaScript", Autoptimize and similar). Exclude it from those settings if you use them. - Save and publish.
Google tags (gtag.js, and Google tags inside GTM) read the banner's consent automatically. For anything else hard-coded, see Hard-coded scripts below.
Also use GTM? Keep GTM as it is, below the CookieChest line. Its non-Google tags (Meta Pixel, TikTok, Hotjar, Custom HTML and so on) still need a consent check each: see Set consent checks on your other tags. You don't need the CookieChest GTM template.
Method 2
Google Tag Manager
Use this if you can publish a GTM container on your site but can't edit the site's own code. You need permission to publish the container.
Why direct is better where you can: installed through GTM, the banner can only start once GTM has loaded, so it misses any tracker another script on the page adds before then. And if a visitor's ad blocker blocks GTM, the banner goes with it.
- In the CookieChest portal, open your site's Install tab and copy your Site Token.
- Download the CookieChest CMP tag template. In GTM, go to Templates, then under Tag Templates click New. Click the three-dot menu at the top right, choose Import, select the file you downloaded, then click Save and close the template editor.
- Go to Tags, click New, then Tag Configuration, and choose CookieChest CMP from the list.
- Paste your Site Token into the Site Token field.
- Leave Redact ads data when ad_storage is denied ticked unless you have a specific reason not to.
- Under Triggering, choose Consent Initialization - All Pages. This matters: it makes the CookieChest tag run before every other tag, so consent defaults are in place before anything tries to track.
- Name the tag (for example "CookieChest CMP") and save.
- Set consent checks on your other tags (below), then click Submit and publish the container.
Set consent checks on your other tags
Google's own tags (Google Analytics 4, Google Ads, Floodlight, Conversion Linker) read Consent Mode automatically. They need no changes.
Every other tag needs telling which consent it depends on. That includes Meta Pixel, TikTok, LinkedIn, Pinterest, Hotjar, Microsoft Clarity, and any Custom HTML tag. For each one:
- Open the tag, then Advanced Settings, then Consent Settings.
- Choose Require additional consent for tag to fire.
- Add the consent type that matches what the tag does (table below).
- Keep the tag's existing trigger (for example All Pages). GTM will hold it until the visitor grants that consent, then fire it straight away, on the same page.
Why this step matters: GTM fires tags very quickly. Without a consent check, a non-Google tag can run before the banner has finished loading. The consent check is what makes GTM wait.
What a consent banner can and can't control
This is the part most banner providers don't explain. It's the difference between a banner that looks right and a site that actually behaves right.
How a banner holds tracking back
A consent banner can only control what happens after it has loaded, and only through three routes:
- Consent Mode. Google's tags check the visitor's choice themselves and stay in cookieless mode until consent is given. This is reliable and needs nothing from you beyond installing the banner.
- Tag Manager consent checks. GTM holds any tag with a consent check until that consent is granted. Reliable, as long as every non-Google tag has its check set.
- Blocking scripts as they're added. CookieChest watches for around 40 known tracking and chat scripts being added to the page by other scripts, and holds them until the visitor consents to the right category. That covers advertising pixels (Meta, TikTok, LinkedIn, Pinterest, Bing, X/Twitter, Snapchat, Reddit, Quora, Criteo, Taboola, Outbrain, AdRoll, HubSpot, Awin and Impact affiliate tags), session recording and analytics tools (Hotjar, Microsoft Clarity, Mouseflow, Crazy Egg, FullStory, Lucky Orange, Smartlook, Heap, Mixpanel, Amplitude, Segment) and chat widgets (Intercom, Drift, Tawk.to, Zendesk, LiveChat, Crisp, Tidio, LeadConnector). This is a safety net, not a guarantee: it only knows the vendors on its list, and only catches scripts added in the usual way.
What no banner can control
- Scripts that run before the banner. Anything placed above the banner in the page, or loaded earlier by a plugin, has already run by the time the banner arrives.
- Scripts written directly into the page HTML as
<script src="...">. The browser runs these the moment it reads them, wherever they sit on the page. No banner can intercept that from inside the browser. - Server-side tracking. Tags running on your server or a server-side GTM container never pass through the visitor's browser, so the banner can't see them. Your server-side setup must read the consent signal itself.
- Trackers outside the known list, and tracking that doesn't load a script at all (image pixels, direct data calls). These go straight through unless they sit behind a GTM consent check or the markup below.
How to get it right
In order of preference:
- Install CookieChest directly as the very first script in
<head>, not deferred and not delayed by a plugin. - Keep your other tracking tags in Google Tag Manager where you can, with a consent check on each non-Google tag. That's the setup that's easiest to keep right.
- Mark up any hard-coded tracker so it can't run on its own (below). This applies wherever it sits on the page.
- Run a scan (below) to check nothing slipped through. Repeat after any change to your site's tracking.
Hard-coded scripts
If a tracker has to stay in your page HTML, change it so it doesn't run by itself. CookieChest will switch it on once the visitor consents to that category, and never before.
For a script loaded from a URL, change src to data-cc-src, and add type and data-cc-category:
<!-- Before --> <script src="https://example-tracker.com/pixel.js"></script> <!-- After --> <script type="text/plain" data-cc-category="marketing" data-cc-src="https://example-tracker.com/pixel.js"></script>
For an inline snippet (code between <script> tags, like Meta's standard Pixel code), add the same two attributes and leave the code as it is:
<script type="text/plain" data-cc-category="marketing"> /* your existing Meta Pixel code, unchanged */ </script>
data-cc-category must be one of analytics, marketing or functional, matching what the tracker does.
If your tracking is added by a WordPress or Shopify plugin that you can't edit, the best fix is usually to switch the plugin's tracking off and add the same tag in GTM instead.
Check it worked: run a scan
Seeing the banner appear only proves it's installed. A scan proves it's working: that trackers stay off until a visitor agrees, and stay off if they say no.
Run a scan
- In the CookieChest portal, open your site's Overview.
- Next to Last cookie scan, click Scan now.
- The scan starts within a few minutes. Larger sites can take up to an hour.
We also scan your site automatically (weekly on Pro, monthly on Growth), so changes to your site (a new plugin, a new tag from your agency) get picked up even if nobody tells us.
What the scan does
- Finds your pages from your sitemap (
/sitemap.xml) and checks a sample of every type of page, not just the homepage. With no sitemap, it follows links from your homepage instead and tells you so, because that can miss whole sections. Keep your sitemap up to date for the best coverage. - Visits each page as a new visitor twice: once clicking Reject, once clicking Accept.
- Records every cookie and tracker it sees in each case, and where each one was loaded from.
Reading your results
Open the Scan results tab in the portal. Your results come in three parts:
- Managed. Trackers that stayed off until consent was given. Nothing to do.
- Not managed. Trackers that ran before a choice, or after Reject. Each one comes with where it's loaded from and how to fix it (usually: move it into GTM with a consent check, or use the markup above).
- Needs your input. Cookies we couldn't identify. Tell us what sets them and which category they belong to, and we'll categorise them for you from then on.
Server-side tracking is listed as "cannot verify from the browser" rather than passed or failed, for the reasons above. If a page can't be scanned (for example, it crashes or blocks automated visits), the results say "could not scan". We never report a page as clean when we couldn't check it.
The same scan also keeps the cookie list on your cookie policy page up to date.
Quick manual check
You can also check by hand in a private or incognito window:
- Visit your site. The banner should appear.
- Click Reject. Open your browser's developer tools, then Application (Chrome) or Storage (Firefox), then Cookies. You should see no
_ga,_fbp,_gcl_auor similar. - Clear the site's cookies, reload, and click Accept. Those cookies should now appear.
- Reload once more. The banner shouldn't reappear, and a small icon should let you change your choice.
Need help?
If the scan flags something you're not sure how to fix, or you'd rather we install it for you, get in touch. We'll tell you exactly what's needed.