How to Install the Captain Compliance Consent Banner on HubSpot
This article explains how to add the Captain Compliance consent banner to pages hosted on HubSpot, such as website pages, landing pages, and blogs. You paste the script into the domain’s site header HTML, or load it through Google Tag Manager (GTM). No app is required.
Before you start
Add the site’s domain in Captain Compliance and set up its consent banner. See How to Set Up Captain Compliance: A Step-by-Step Checklist.
Copy the script for that domain. In the Captain Compliance app, select Consent banner in the sidebar, select the domain, and under Setup select Installation script. Copy the snippet under Script Tag Method.
Check your subscription and permissions. HubSpot offers site header HTML with Marketing Hub Professional or Enterprise and with Content Hub Starter, Professional, or Enterprise. You also need the Website settings permission.
Turn off HubSpot’s own cookie consent banner for the domain. In HubSpot, go to Settings → Privacy & Consent, open the Cookies tab, and make sure the banner for that domain is not active. Captain Compliance should be the only consent banner on the site.
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, the banner does not appear. For example, a HubSpot preview address does not show the banner. To add a domain or subdomain, see How to Scan Websites and Manage Domains.
The Installation script section in the Captain Compliance app:
Add the script to the site header HTML
In HubSpot, select the settings icon in the top navigation bar.
In the left sidebar, go to Content → Pages.
In the Choose a domain to edit its settings menu, select the domain that matches your Captain Compliance script.
In the Site header HTML field, paste the script, above any other code.
Select Save.
<script src="https://api-prod.cptn.co/banner/script?accessToken=YOUR-ACCESS-TOKEN"></script>Select the specific domain, not Default settings for all domains, unless the account has only one domain. Each Captain Compliance script belongs to one domain.
HubSpot notes
Header HTML that you set for a specific domain replaces the default header HTML on that domain. If Default settings for all domains already contains code that you still need, copy it into the domain’s field too.
Keep HubSpot’s own cookie consent banner off for the domain. Two banners confuse visitors and can record different choices.
HubSpot’s own tracking code follows HubSpot’s consent banner settings. The Captain Compliance script does not write to HubSpot’s consent system. HubSpot documents an API that lets another banner pass consent to HubSpot. See HubSpot’s cookie banner API, and ask your Captain Compliance representative for help with this setup.
After you save, check a website page, a landing page, and a blog post on the domain.
Pages that are not hosted on HubSpot need the script too. Install it with the method for the platform that hosts them.
Install through Google Tag Manager instead
If the domain’s pages already load GTM, you can load the banner from GTM instead of pasting the script. Add the Captain Compliance CMP template to the container, enter the access token for the domain, and set the tag to fire on Consent Initialization - All Pages. See How to Install and Configure the Captain Compliance CMP Template in GTM.
Use one method only. If you install through GTM, do not also paste the script into the site.
Confirm the banner is live
Open the published site in a private or incognito browser window.
Confirm that the banner appears, and try Allow, Reject, and Cookie Settings.
View the page source and search for
api-prod.cptn.coto confirm that the script is in the head.
If the banner does not appear, see How to Troubleshoot a Consent Banner That Does Not Appear or Respond. For a full test plan, see How to Test Consent Banner Configuration & Behavior.
For HubSpot’s own instructions, see Add code snippets to HubSpot content in the HubSpot Knowledge Base.

