Skip to content
HubSpot Developer Changelog

Google Analytics and the HubSpot cookie banner

What’s happened?

On November 1, 2019, we made a change to the Google Analytics integration that will prevent the Google Analytics tracking script from firing until a visitor opts in to cookie tracking via the HubSpot cookie banner.

Why are we doing this?

So customers hosting their website with HubSpot can ensure their Google Analytics tracking is compliant with GDPR and EU cookie laws. If visitors don’t opt in to cookie tracking, the Google Analytics script won’t fire. This may result in a decrease in the traffic recorded on HubSpot-hosted pages in your Google Analytics account.

What do I need to do?

If you’re using the Google Analytics with HubSpot integration, you don’t need to take further action.Your HubSpot cookie banner will control your native Google Analytics integration on your HubSpot-hosted pages. 

If you’re not using the Google Analytics with HubSpot integration but want the cookie controlled by the banner, you will need to set up the integration. 

If you don’t want your HubSpot cookie banner to control your Google Analytics script on your HubSpot-hosted pages, you can add your Google Analytics tracking code to your site header HTML instead. When you add your Google Analytics tracking code snippet to the header HTML instead of integrating Google Analytics with HubSpot, the Google Analytics script cannot be controlled by the HubSpot cookie policy banner. By default, it will record data on visitors regardless of whether a visitor opts in or out unless you customize your Google Analytics script. 

This Google document on disabling the Google Analytics tag may be a helpful resource. Next steps are as follows: 

  • Disable the native integration here. (If you don't see this setting on as default across all domains, it might only be enabled for a specific domain. Toggle between your connected domains in the drop-down at the top of your screen to check whether the Google Analytics integration is only enabled on a specific domain.)  Note: If you turn off the Google Analytics integration, it will turn it off for AMP-rendered blog posts too. There’s no way to enable it for AMP separately.
  • Next, follow these steps to install your customized Google Analytics tracking code via the header HTML settings here.

If you have any questions about this change, or how it might have impacted your reporting in Google Analytics, please reach out to your HubSpot Customer Success Manager or the HubSpot Support team. We’re here to help however we can. If you have general non-account specific development questions or comments please join the conversation in the developer forums.