How to Publish a Consent Banner on Your Website
Captain Compliance is published by installing a domain-specific script on your website. Each domain has its own unique script, and the correct script must be used for the site where the consent banner will appear.
This article explains where to find your Captain Compliance script, the available installation methods, and when to use each option.
Where to find your Captain Compliance script
Captain Compliance scripts are issued per domain and must be copied directly from the Captain Compliance application.
To find your script:
Log in to the Captain Compliance app.
Select Consent banner in the sidebar.
Select the relevant domain.
Under Setup, select Installation script.
Copy the snippet under Script Tag Method.
The same section also provides ready-made snippets for Next.js and React applications. By default the banner chooses its language automatically. To serve one fixed language, add the language-code attribute shown in the app to the script tag, for example language-code="es".
Always confirm that the script you install matches the exact domain where it will be deployed.
The script runs only on the domain it was issued for, with or without www. On a subdomain, the banner appears only if that subdomain has been added in Captain Compliance. On any other address, such as a staging or preview address, the banner does not appear.
Installation options
You can install Captain Compliance directly on the website or through Google Tag Manager (GTM). Both methods are supported. GTM is recommended where it is available, because it also lets you control when every other tag fires.
Platform guides
For step-by-step instructions on a specific platform, see its guide. Each guide shows where the script goes on that platform and what to check afterward.
How to Install the Captain Compliance Consent Banner on WordPress
How to Install the Captain Compliance Consent Banner on Shopify
How to Install the Captain Compliance Consent Banner on Webflow
How to Install the Captain Compliance Consent Banner on Squarespace
How to Install the Captain Compliance Consent Banner on HubSpot
How to Install the Captain Compliance Consent Banner on Next.js, React, and Other Single-Page Apps
On any other platform, paste the script into the setting or template that adds code to the head of every page.
Option 1: Direct install
With a direct install, the Captain Compliance script is added directly to your site’s HTML.
Typical placement options include:
The global
<head>sectionA site-wide header or layout template
A CMS theme or template file
Pros of a direct install
Simple and fast to deploy
Fewer dependencies
Ideal for sites without complex tag management needs
Cons of a direct install
Less flexibility for advanced script orchestration
Changes require code or CMS access
No built-in preview or debug mode
Deferred mode
When using a direct install, Captain Compliance supports a deferred mode option that delays execution of the script until after the initial page load. This can help reduce performance impact and avoid timing conflicts with other scripts that load early on the page.
Deferred mode does not change consent behavior. The consent banner still appears, and consent logic still applies. The only difference is when the script runs during page load.
Deferred mode is most commonly used when:
The site is performance-sensitive
Other scripts depend on the page being fully loaded
You are troubleshooting script interaction or timing issues
To enable deferred mode for a direct install, add the defer attribute to the Captain Compliance script tag:
<script defer src="https://api-prod.cptn.co/banner/script?accessToken=YOUR_TOKEN"></script>Option 2: Install using Google Tag Manager (recommended)
Installing Captain Compliance through GTM gives you more control and visibility, especially on sites with many third-party tags.
Use the Captain Compliance CMP template from the GTM Community Template Gallery. One tag loads the consent banner, sets Google Consent Mode defaults before other tags run, and honors Global Privacy Control (GPC).
Add the Captain Compliance CMP template to your container.
Create a tag from the template and enter the access token for the domain.
Set the tag to fire on Consent Initialization - All Pages.
For the full walkthrough, see How to Install and Configure the Captain Compliance CMP Template in GTM. For an overview of how the pieces fit together, see How to Integrate Google Tag Manager (GTM) with Captain Compliance.
Note: If your container loads the script from a Custom HTML tag instead, plan a move to the template, which also sets Google Consent Mode defaults and honors GPC.
Pros of a GTM install
Greater control over script sequencing
Ability to test changes using GTM Preview mode
Easier coordination with analytics, marketing, and third-party tags
Centralized management for complex implementations
Cons of a GTM install
Requires GTM access and familiarity
Additional configuration complexity
Incorrect trigger selection can cause timing issues
Next steps in GTM
After the banner loads through GTM, finish the setup:
Assign a consent setting to every tag: How to Gate GTM Tags with Native Consent Settings
Move early-loading tags that need consent: How to Fire Early-Loading Tags After Consent with CC - Consent Ready
Serve several domains from one container: How to Deploy Multiple Consent Banners from One GTM Container
Understand the Google signals: How Captain Compliance Works with Google Consent Mode
Test before you publish: How to Test Your GTM Consent Setup
Verify the installation
After you publish the banner:
Load the site in a private or incognito browser window.
Confirm the consent banner appears as expected.
Try Allow, Reject, and Cookie Settings.
Check consent behavior in browser developer tools if needed.
For a full test plan, see How to Test Consent Banner Configuration & Behavior. If you installed through GTM, also see How to Test Your GTM Consent Setup.
Best practices
Keep only one Captain Compliance script active per domain.
Do not install the script both directly and through GTM.
Turn off any other cookie banner, including the one built into your website platform. Captain Compliance should be the only consent banner on the site.
Publish GTM changes only after testing.
Clear caching layers after installation.
If your site sends a Content Security Policy header, allow the Captain Compliance origins. See How to Configure a Content Security Policy (CSP) for Captain Compliance.
Related articles
How to Install and Configure the Captain Compliance CMP Template in GTM
How to Integrate Google Tag Manager (GTM) with Captain Compliance
How to Configure a Content Security Policy (CSP) for Captain Compliance
How to Exclude the Captain Compliance Consent Banner from Specific Pages
How to Add a “Cookie Preferences” Option to Your Website Footer
How to Resolve WP Rocket Caching Issues With Captain Compliance
How to Troubleshoot a Consent Banner That Does Not Appear or Respond
Developer Reference: Captain Compliance Events, Cookies, and Identifiers
How to Share Consent Across Subdomains with Cross-Domain Consent
How to Customize Your Consent Banner with Custom HTML and CSS

