CMS Development

jmclaren
HubSpot Employee
HubSpot Employee

Google Analytics and the HubSpot cookie banner

What’s happening?

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 here.

Jon McLaren

Sr. CMS Developer Advocate

Get started developing on the HubSpot CMS Developer Changelog
How to optimize your CMS Hub site for speed

If my reply answered your question, please mark it as a solution, to make it easier for others to find.

0 Upvotes
3 Antworten
paulschmidt
Mitwirkender/Mitwirkende | Elite Partner
Mitwirkender/Mitwirkende | Elite Partner

Google Analytics and the HubSpot cookie banner

@jmclaren does this same functionality apply to the other native integrations in that same screen including Google Tag Manager or Adroll? So if the user doesn't opt in to be tracked then the GTM and Adroll scripts will NOT be fired for that user.

paulschmidt_0-1620835543214.png

 

0 Upvotes
lhardy
Teilnehmer/-in

Google Analytics and the HubSpot cookie banner

If our website is NOT hosted within HubSpot, is there another way we can have the cookie banner also control the GA cookies in addition to the HubSpot cookies?

0 Upvotes
jmclaren
HubSpot Employee
HubSpot Employee

Google Analytics and the HubSpot cookie banner

You would need to either build a custom cookie banner on your non-HubSpot site or use one of the many cookie banner services online for that. The cookie banner that you can enable for HubSpot Pages, Landing Pages, and blog posts only affects those HubSpot hosted resources. 

Jon McLaren

Sr. CMS Developer Advocate

Get started developing on the HubSpot CMS Developer Changelog
How to optimize your CMS Hub site for speed

If my reply answered your question, please mark it as a solution, to make it easier for others to find.

0 Upvotes