Nov 12, 2020 3:56 AM - edited Nov 14, 2020 6:40 AM
The worst thing about working in tech? Cookies no longer have the delicious connotations they once had...........
Here is a solution that will assist you in managing HubSpot cookies when you are leveraging a third-party tool.
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.
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).
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 ***
Jan 6, 2022 2:44 PM
Hi @lsmith77 ! The comment with those links in relation to the particular query from GZakraoui. This post goes through how to leverage a banner and css to manage cookies for those that do not have coding experience. I am not aware of a way that you can opt in people via API. It may be best to start a new thread with this query. Sorry I am no longer a Technical Consultant so not sure what improvements have been made in the meantime with this feature!
Jan 6, 2022 2:19 PM
@kaburke Following your links I landed on https://developers.hubspot.com/docs/api/events/cookie-banner
What is not clear to me from this page is if I configure my cookie consent policy to be opt-in, what API call do I need to do in order to opt-in as I only see an API call to opt-out.
May 27, 2021 8:36 AM
Hi @GZakraoui ! Yes we have more information here, this solution is an old one and for those that don't have that much code experience! My understanding of your question is that when a customer who has previously declined cookies and then updates their settings so that they consent to being tracked, you want to be able to start to track them again. This was something that at the time I was not able to figure out as you would either need to wait until the revoke cookie expires or you would need to clear the cookie and then update but this would require a refresh which I was unable to figure an eloquent solution to. How often is this likely to occur though? 🤔 I havent looked through our docs recently and I know that there have been loads of updates. Have you checked this out?
May 20, 2021 11:52 AM
Hello @kaburke, reviving this thread to talk about another workaround i found out about tweaking yours.
but, navigating from page to page will set cookies back, so just calling it conditionally given the preferences set in your banner on page views will do the trick.
But i couldnt figure out or find the opposite command : so for example when a user changes the cookie preferences in your third party banner, a command to trigger to grant it back.
is there a command that grantsCookieConsent programatically ?
Thanks in advance
Nov 12, 2020 9:08 AM
The same day I post this the Cookiebot integration gets released!!!!! 😂 https://support.cookiebot.com/hc/en-us/articles/360015961639-Cookiebot-HubSpot-integration