Managing HubSpot cookies when you use a third party cookie management tool

kaburke
HubSpot Employee

The worst thing about working in tech?  Cookies no longer have the delicious connotations they once had...........

 

giphy.gif

 

Here is a solution that will assist you in managing HubSpot cookies when you are leveraging a third-party tool.

 

We know that HubSpot cookies are managed by the HubSpot banner so we can set up the HubSpot cookie banner as per this post.  Turn on all of the options to use cookies, notify visitors that your site uses cookies and require opt-in.  When you do this and enter the relevant URLs/domain, as long as the tracking code is firing you will now see the HubSpot cookie banner firing across all pages.

 

image-Jul-15-2020-04-08-24-08-PM.png

 

But for this solution, you don't want the users to see the HubSpot banner because they have a third party banner, so let's make it invisible!  In the website stylesheet, add the below code which will target all of the HubSpot cookie banners that are loading and set them to disappear.  This means that the banners are loading but they cannot be viewed.

 

image-Jul-15-2020-04-12-01-29-PM.png

Next up, in your third party tool, you need to build in logic so that when the 'accept' option for HubSpot cookies is selected the below JS fires.  Essentially what is happening in the below code is 'an invisible hand' clicking on the 'accept' button in the HubSpot banner that has been hidden.  You can see this in action here (my test website) so that when you click on the red 'Accept' button it selects the 'Yes' button in the HubSpot banner (that I haven't hidden for this purpose).

 

image-Jul-15-2020-04-14-54-23-PM (1).png

 

What about if they don't accept the HubSpot cookies? 

Do nothing! The main reason that HubSpot requires the drop of the __hs_do_not_track cookie is that it stops us constantly asking the user for permission again but we have already used the CSS code above to hide this banner so we don't need to drop the __hs_do_not_track cookie.  If the banner has been set up correctly we will also not drop cookies unless we are explicitly told to (eg. require to opt in).

 

What about if they accept cookies and later decide to delete them?

No problem!  Build-in logic that if they decline the cookies then we remove cookies as per the logic you can find here.

 

I hope that people find this helpful!

 

*** Before implementing anything regarding compliance, it is important that you check with your legal team whether the solution meets their requirements ***

1 Reply 1
kaburke
HubSpot Employee

The same day I post this the Cookiebot integration gets released!!!!! 😂 https://support.cookiebot.com/hc/en-us/articles/360015961639-Cookiebot-HubSpot-integration