HubSpot cookie banner
Use PrivacyPill as the cookie banner on HubSpot CMS
HubSpot's tracking code has its own consent system. To use a third-party banner, you switch off HubSpot's banner and tell HubSpot what each visitor chose. The snippet below does both.
Updated 28 October 2026
Set it up in 5 steps
- 1Open your site header settingsClick the settings icon → Content → Pages. Choose 'Default settings for all domains' (or a specific domain).
- 2Paste the snippet into Site Header HTMLPaste it at the very beginning of Site Header HTML, above other tracking snippets, and save. For a domain with its own settings, click Override default settings first.
- 3Check every domain overrideA domain-specific header replaces the default one. Add the snippet there too, or click Apply default settings.
- 4Review HubSpot's cookie settingsIn Settings → Privacy & Consent → Cookies, keep consent required for EU visitors. The snippet suppresses HubSpot's banner and passes PrivacyPill's choices through setHubSpotConsent.
- 5Test all content typesCheck website pages, landing pages and blog posts in a private window: no HubSpot analytics cookies before consent, and they appear after accepting analytics.
HTML · HubSpot Site Header HTML
<!-- 1. Use PrivacyPill instead of HubSpot's banner -->
<script>
window.disableHubSpotCookieBanner = true;
window._hsp = window._hsp || [];
function ppToHubSpot(e) {
var c = e.detail.consent;
window._hsp.push(["setHubSpotConsent", {
analytics: !!c.analytics,
advertisement: !!c.marketing,
functionality: !!c.functional
}]);
}
window.addEventListener("privacypill:ready", ppToHubSpot);
window.addEventListener("privacypill:consent", ppToHubSpot);
</script>
<!-- 2. PrivacyPill -->
<!-- PrivacyPill: keep this first in <head>, before Google Tag Manager or analytics -->
<script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments)}gtag('consent','default',{ad_storage:'denied',ad_user_data:'denied',ad_personalization:'denied',analytics_storage:'denied',functionality_storage:'denied',personalization_storage:'denied',security_storage:'granted',wait_for_update:500});</script>
<script src="https://privacy-pill-consent-studio.lovable.app/api/public/v1/pp.js?site=pp_your_site_key"></script>Replace pp_your_site_key with your site key — you'll get it when you save your banner.
How the categories map
PrivacyPill's analytics category maps to HubSpot's analytics, marketing to advertisement, and functional to functionality. The sync runs on every page load (privacypill:ready) and every change (privacypill:consent).
HubSpot may still record anonymous, aggregated page views when cookies are rejected. If you need all measurement to stop, review HubSpot's doNotTrack option.
Frequently asked questions
Set up PrivacyPill on other platforms
See all- Shopify cookie bannertheme.liquid install + Customer Privacy API.
- Webflow cookie bannerPaste one line into Head code and publish.
- WordPress cookie bannerWPCode or functions.php, classic and block themes.
- Wix cookie bannerSettings → Custom Code → Head, all pages.
- Squarespace cookie bannerCode Injection → Header on Core plans and up.
- Framer cookie bannerProject Settings → Custom Code, start of head.
- Lovable cookie bannerOne prompt to the Lovable agent, or one tag.
- Bolt cookie bannerOne prompt to the Bolt agent, then publish.
- v0 cookie bannernext/script in the root layout, publish to Vercel.
- Next.js cookie bannernext/script beforeInteractive in the root layout.
- Ghost cookie bannerSettings → Code Injection → Site header.
Try it on your own site
Design your banner, preview it live, and paste one line. Free for one domain.