ConsentStackDocs

HubSpot Integration

Install ConsentStack on HubSpot CMS, replace HubSpot's cookie banner with your own, and keep your portal's domains in sync automatically.

ConsentStack integrates with HubSpot in two layers. The ConsentStack app for HubSpot connects your portal to a site in your dashboard: it imports your website domains and keeps them in sync automatically. The SDK itself handles the consent behavior on your pages: it turns off HubSpot's built-in cookie banner, shows yours instead, and reports every consent decision to HubSpot's own consent API so HubSpot analytics, chat, and forms follow each visitor's choice.

This page covers the full setup. For the general install reference, see SDK Installation.

Connect your HubSpot portal

From your dashboard, open the site you want to connect, go to Settings, and click Connect on the HubSpot row under Integrations. HubSpot asks you to choose an account and approve the connection, then sends you back to ConsentStack.

The app requests one permission: read access to your portal's website domains (cms.domains.read). It cannot write to your HubSpot content, contacts, or settings.

On connect, ConsentStack imports the domains your portal serves pages on (site, landing page, and blog domains; mail and redirect domains are skipped) into the site's Domains list. After that, domains re-sync automatically once a day, and a Sync now button on the Integrations row runs the same sync on demand.

If you installed the app from the HubSpot marketplace instead, the order flips: after you approve the connection in HubSpot, ConsentStack asks you to sign in (or create an account) and pick which site the portal belongs to. Everything else works the same.

HubSpot loads ConsentStack the same way as any site: three tags at the top of every page. In HubSpot the right place is Site Header HTML:

  1. On the site's Settings page, use Copy script on the Integrations row. The HubSpot settings button next to it takes you straight to your portal's page settings.
  2. In HubSpot, go to Settings > Website > Pages, paste the snippet into Site Header HTML, and save.

The snippet looks like this, with your own site key filled in:

<link rel="preconnect" href="https://cdn.consentstack.io" />
<script src="https://cdn.consentstack.io/consent.js?k=<YOUR_SITE_KEY>"></script>
<script src="https://cdn.consentstack.io/consent-core.js?k=<YOUR_SITE_KEY>"></script>

ConsentStack detects the install automatically on the first page load and the Integrations row flips to Active. Nothing else to verify.

The paste is a one-time manual step by design. HubSpot does not offer marketplace apps an API for writing Site Header HTML, so no third-party app can inject the tag for you. The app gets you as close as possible: the exact snippet on your clipboard and a deep link to the field it goes in.

What happens on a HubSpot page

With the script installed, the SDK detects HubSpot and activates its HubSpot adapter. Two things happen:

  1. HubSpot's banner is turned off. The SDK sets window.disableHubSpotCookieBanner before HubSpot's tracking code boots (your script runs from the page head, HubSpot's tracker loads later), so HubSpot's native cookie banner never renders alongside yours. Visitors see one banner: yours.
  2. Every consent decision is reported to HubSpot. The SDK pushes setHubSpotConsent onto HubSpot's _hsp queue on every consent change, using HubSpot's Cookie Banner API. HubSpot's own tracking (the __hstc and hubspotutk analytics cookies, conversations chat, form tracking) then follows what the visitor chose in your banner.

Categories map to HubSpot's three consent fields:

ConsentStack categoryHubSpot consent field
Analyticsanalytics
Marketingadvertisement
Functionalfunctionality

What about scripts HubSpot does not control?

They are handled by script blocking, not by this integration. Tags you add to your HubSpot pages directly (the Meta Pixel, LinkedIn Insight, heatmap tools) do not read HubSpot's consent record, so ConsentStack blocks them in the browser until the visitor consents. The HubSpot adapter never bypasses that blocking; it adds the HubSpot side on top.

Platforms with native consent APIs of their own (Google, Meta, TikTok, Bing, and others) also get dedicated consent signaling, described in Platform Integrations.

Does the banner need the app?

No. The consent behavior on this page, banner takeover included, comes from the script and works on any HubSpot site where the snippet is installed. The app adds the portal connection on top: automatic domain import, the daily sync, and the guided install. Connecting it is recommended, not required.

Disconnecting

Click Disconnect on the Integrations row to uninstall the app from your portal. ConsentStack calls HubSpot's uninstall API, HubSpot revokes the connection and notifies your portal's admins, and domain sync stops. Your imported domains stay on the site, and the consent script on your pages keeps working exactly as before. You can reconnect at any time.

Uninstalling ConsentStack from your HubSpot account's Connected Apps page has the same effect; the dashboard notices within a day and shows the connection as disconnected.

What's next