Cookie Notice/ Data Privacy - Optout for Hubspot and Google Analytics in one central place

Quick Disclaimer: We are using HS COS / Marketing / Sales. We have also implemented Google Tag Manger to manage all our Marketing Tags for (Re)targeting + Run Google Analytics in parallel 


  1. You are offering 4 options in your data policy section for the cookie notice (1. No cookies, 2. Acceptance that is using cookies, 3.Option to opt-in / optout from HS tracking, 4. No Cookie notice
  2. With the current upcoming EU Data Privacy regulation, we have to take care of certain things incl the optout cookie (see 3.)
  3. For my website visitors I want to give them a central place where the can optout of tracking ( in our case Hubspot, GA, Facebook / LI / Display retargeting). This place is ideally in the data policy section.
  4. We have implemented this with a Optout Cookie which runs define a firing exception at the Tag Level in Googel Tag Manager
  5. Now to the essential problem
    1. The only way to optout from HS Tracking is via the cookie notice, there is no way to alter the notice and to link a second (let's say "more information") to the data policy where the user could optout the a) hubspot and b) GA tracking
    2. There is no way to replicate the optout link form hubspot tracking on the client side (At least by what your support is telling us)
    3. How do you expect the customer to understand this? Customer will understand the cookie notice, but will definitely not understand that this will only optout from hubspot… I would expect a single point for optout as a customer either in the cookie bar oder in the data policy
  6. Here is my quick fix: make the cookie bar more flexible by allowing an option which is a) accept cookie and b) more information to optout. Under the option b) you put a link to your data policy with an anchor for optout part. Here you can then list all the links to optout from the various system.



HubSpot updates
15 Replies
HubSpot Employee
HubSpot Employee


Sorry I should have been clearer: I am not a developer and couldn't implement that API-based solution myself. If a developer were to look at this and had questions about the implementation or exact capabilities of the Tracking Code API, I would suggest our developer forum as the best resource: Sorry I cannot be more helpful here.



Top Contributor

Took me a while to figure this out but you can use the api to query if consent has been withdrawn and listen for clicks on the cookie banner. A rough draft of such a script is listed here. It prevents scripts like google anlytics being run unless their is consent or a click on the consent button on the cookie banner. When there is no consent then alternative scripts can be run (e.g tracking tools in a non-cookie / anonymous operating mode).


It would be handy to swtich off the decline button in the banner and have it direct to the policy page instead at which point the banner is still visible. There also needs to be a button to toggle off/on consent that they have previosuly given or withdrawn. This isn't possible at the moment as i understand it.


Regular Contributor

@ojobsonsounds great!! I have several questions: Have you implemented it already on your website, where I can check it? Which CMS do you use? and does it make difference that we use Google Tag Manager and not Gogle Analytics Code?

Top Contributor

I still haven't got round to using google tag manager, I should really - the code for calling the tag manager will be different to the GA scripts, but the way the HS API 'addPrivacyConsentListener' code wraps around the code that calls GA should still work fine.

I implemented it briefly on my blog and it seemed to work well with the testing I implemented.

HubSpot Employee
HubSpot Employee

Again on the original point 5.2 (providing a cookie opt-out link to customers), I added a demonstration video using the Tracking Code API in the comments of this post: