Call Cookie Consent "Accept" or "Decline" from outside the cookie banner


#1

Hi

We've been asked to integrate Hubspot into a website run from within the UK, so all the GDPR rules apply. As such the client has enabled the cookie consent banner, with Accept and Decline buttons.

They now wish to move the Decline option to another location on the site, and outside the banner.

There appears to be no documentation detailing how to trigger an "Accept" or "Decline" via Javascript - but presumably the banner buttons themselves are just triggering JS functions via an event listener. You can easily get the status:

I just need to set it. Does anyone know how to do so?

Thanks in advance for any help

Tom


#4

Hi @tomatmnd, to my knowledge, there isn't a direct way to Accept Cookies outside the banner. You can remove cookie consent or place a do not track token, but not easily opt people in outside the banner. The one thing I might suggest that others have come across is to simulate a click on the Accept button which should work. This article in the section "Dealing with the HubSpot Banners" is super useful information: https://www.napierb2b.com/2017/08/hubspot-cookies-work/


#6

Hi Connor

Thanks for your reply, and for the link - the solution detailed there is pretty much what we've come up with, also - controlling the Hubspot-generated banner with CSS and JS. It's kindof a messy workaround but seems to do the job. I'm not sure if there's any procedure for feature requests, but would be great if Hubspot could expose the functions that are triggered by its banner Accept / Deny buttons via an API call in future.

Thanks again,

Tom


#7

Hey @tomatmnd, agreed for sure. Not the greatest way to do something like this. We do have an ideas forum here: https://community.hubspot.com/t5/custom/page/page-id/ideaslandingpage that our product team monitors closely. I can also pass along feedback internally!