HubSpotPlatform APIHubSpot Consent API

HubSpot Consent API

Connect CookieHub with the HubSpot Consent API, so supported HubSpot analytics and advertising services adjust their tracking to each visitor’s consent — and stay in step when that choice changes.

Built-in CookieHub support · HTML and GTM compatible
Consent statecategory: analyticsstate: updatedVisitor choiceanalytics acceptedCookieHubcategory → hubspot fieldHubSpothubspot consent apianalyticsgrantedadvertisementdeniedfunctionalitygranted
Type
Platform consent API
Works with
HubSpot tracking code
Parameters
analytics · advertisement · functionality
Setup
HTML or Google Tag Manager
CookieHub support
Built in, from version 2.8.13
Overview

Why the HubSpot Consent API matters.

Websites rely on HubSpot for analytics, marketing automation and advertising. Without consent signalling, these services can start tracking visitors before consent is given — a compliance risk under the GDPR, the CCPA and other privacy laws. The HubSpot Consent API gives HubSpot a standard way to receive consent signals, so supported HubSpot analytics and advertising services can adjust their behaviour to them.

CookieHub acts as the consent authority. It collects the visitor’s choice, replaces HubSpot’s own cookie banner and supplies HubSpot with accurate, real-time consent data — so HubSpot tracking stays privacy-aware, technically reliable and aligned with what each visitor chose.

CookieHub manages the visitor’s choice. The HubSpot Consent API carries it to HubSpot tracking.

Page lifecycleload order matters
  1. 01CookieHub loadsbefore the hubspot code
  2. 02HubSpot tracking code loadswaits for consent
  3. 03Visitor makes a choicebanner
  4. 04CookieHub sends consent to HubSpotconsent update
  5. 05HubSpot tracks only what was grantedtracking behaviour
Signal flow

From visitor choice to HubSpot tracking.

Pick a visitor state to see the consent CookieHub sends to HubSpot.

Visitor state
Visitor choiceNo choice yet

The visitor has arrived and the banner is showing. No optional category has been accepted.

CookieHubHolds HubSpot analytics and advertisingcategory: nonestored: no
HubSpotdefaultanalyticsdeniedadvertisementdeniedfunctionalitygranted
Visitor choiceAnalytics accepted

The visitor accepted the Analytics category and declined Marketing.

CookieHubAllows HubSpot analytics onlycategory: analyticsstored: yes
HubSpotupdatedanalyticsgrantedadvertisementdeniedfunctionalitygranted
Visitor choiceAll cookies accepted

The visitor accepted both the Analytics and the Marketing category.

CookieHubAllows analytics and advertisingcategory: analytics, marketingstored: yes
HubSpotupdatedanalyticsgrantedadvertisementgrantedfunctionalitygranted
Visitor choiceOptional cookies rejected

The visitor rejected optional cookies, or withdrew a previous choice.

CookieHubKeeps HubSpot tracking offcategory: necessarystored: yes
HubSpotupdatedanalyticsdeniedadvertisementdeniedfunctionalitygranted

Illustrative behaviour for an opt-in configuration. functionality stays allowed in every state, because necessary cookies are always allowed for HubSpot’s core functionality.

Consent parameters

The consent HubSpot listens for.

Three consent parameters, each mapped from a CookieHub category. HubSpot receives each one as allowed or not — shown here as granted or denied.

ParameterWhat it controlsCookieHub categoryBefore choice
analyticsCookies that gather analytics data about visitors, such as HubSpot analytics.Analyticsdenied
advertisementCookies that help serve personalised ads.Marketingdenied
functionalityCookies needed for core site features, such as authentication.Necessary · always allowedgranted
No manual mapping is needed: CookieHub maps its categories to HubSpot’s consent fields automatically and updates them when a visitor changes their choice. The Preferences category is not used by HubSpot.
CookieHub + HubSpot

Consent-aware HubSpot tracking, without custom code.

CookieHub collects the choice, maps it to HubSpot’s consent fields and keeps both in sync — no manual JavaScript configuration or API calls.

See how consent management works
01Enable once
  • Simple integration

    settings → integrations

    Enable the HubSpot Consent API in the CookieHub dashboard. No custom JavaScript or API work is required.

  • Automatic parameter mapping

    category → field

    Marketing maps to advertisement and Analytics to analytics. Necessary cookies are always allowed.

  • Flexible deployment

    html · gtm

    Works with both HTML implementations and Google Tag Manager setups.

02CookieHub manages the state
No choiceheldVisitor choicereceivedConsent sentapplied
  • Real-time updates

    consent update

    When a visitor updates their consent preferences, CookieHub immediately updates the consent sent to HubSpot.

  • Consent records

    stored decision

    When consent logging is enabled and available on your plan, CookieHub keeps a record of each visitor’s consent decision.

03HubSpot tracks with consent
HubSpot consentexampleanalyticsgrantedadvertisementdeniedfunctionalitygranted
  • Accurate consent-driven tracking

    analytics · advertisement

    Supported HubSpot analytics and advertising services adjust their behaviour to the consent granted, supporting compliance and data integrity.

The HubSpot consent shown is an example of one visitor’s choice, not a fixed set of values.
Implementation

Set up the HubSpot Consent API.

Supported from CookieHub version 2.8.13. Three phases, from loading CookieHub to consent signals that apply automatically.

  1. 01

    Install

    Load CookieHub before the HubSpot tracking code, so consent reaches HubSpot before any tracking is allowed to start.

    1. 01HTML: add the CookieHub script to the <head> of your website.
    2. 02Google Tag Manager: add the CookieHub CMP template with the Consent Initialization – All Pages trigger.
  2. 02

    Enable

    Turn the integration on in the CookieHub dashboard.

    1. 03Enable HubSpot Consent API under Settings → Integrations.
    2. 04Check that CookieHub loads before the HubSpot tracking code, or HubSpot’s own banner may appear alongside CookieHub’s.
  3. 03

    Apply

    Consent signals are applied automatically when visitors accept or reject cookies.

    1. 05CookieHub sends analytics and advertisement consent from the Analytics and Marketing choices.
    automaticNo manual JavaScript or API calls are required.
Google Tag Manager

Connect HubSpot consent through GTM.

Use Google Tag Manager to initialise CookieHub early, so HubSpot receives consent signals before any HubSpot tracking begins.

  • Add the CookieHub CMP template from the GTM Community Template Gallery.
  • Enter your CookieHub domain code.
  • Set the trigger to Consent Initialization – All Pages.
  • Save and publish, then enable the HubSpot Consent API in the CookieHub dashboard.
Container viewconceptualGTM containerconsent initializationCookieHub CMP templateall pages
  • HubSpot analyticsanalytics
  • HubSpot advertisingadvertisement
  • HubSpot core featuresfunctionality
Compatibility

Works with HubSpot and your CookieHub installation.

CookieHub passes HubSpot consent through the installation method you already use.

  • HubSpot tracking codeconsent api
  • HubSpot analyticsanalytics
  • CookieHub scriptintegrations setting
  • Google Tag Managercmp template

Built for the HubSpot Consent API.

CookieHub supports the HubSpot Consent API from version 2.8.13. Once the integration is enabled, CookieHub replaces HubSpot’s own cookie banner and keeps HubSpot’s analytics and advertisement consent in sync with each visitor’s choice.

FAQ

HubSpot Consent API questions.

The HubSpot Consent API lets CookieHub pass consent signals to HubSpot, so supported HubSpot analytics and advertising services can adjust how they track visitors based on consent. HubSpot reads three consent parameters: analytics, advertisement and functionality.

No. CookieHub automatically sends the required consent signals to HubSpot once the integration is enabled in the dashboard, under Settings → Integrations.

Yes. CookieHub supports both direct HTML integration and Google Tag Manager using the official CookieHub CMP template, with the trigger set to Consent Initialization – All Pages.

Supported HubSpot analytics and advertising-related tracking respects the analytics and advertisement consent parameters managed by CookieHub: the Analytics category maps to analytics and Marketing to advertisement. Essential functionality remains allowed, and the Preferences category is not used by HubSpot. The API covers HubSpot’s supported services; it does not automatically block other tracking services or custom integrations.

You should enable it if you use HubSpot for analytics, marketing, or to load additional tracking services and need consent-aware session tracking. CookieHub supports it from version 2.8.13.

Yes. Whenever a user updates their consent preferences, CookieHub immediately updates the consent parameters sent to HubSpot.

Yes. CookieHub collects consent in place of HubSpot’s own banner. Load the CookieHub script before the HubSpot tracking code; otherwise HubSpot’s banner may appear alongside CookieHub’s.

Legal note

Disclaimer

This page describes how CookieHub passes consent choices to HubSpot. It is technical guidance, not legal advice — which consent model applies to your visitors depends on the regulations relevant to your site, such as the GDPR or the CCPA.

HubSpot Consent API

Keep HubSpot tracking in step with consent.

Connect CookieHub to HubSpot, enable the HubSpot Consent API and let consent signals apply automatically.

  • 14-day trial
  • No card required