Hola! ¡Tenemos nuestra Comunidad en Español!

GDPR: addPrivacyConsentListener & revokeCookieConsent

Colaborador ocasional

Our code in footer.php is



<script id="hs-script-loader" async defer src="https://js.hs-scripts.com/[Account-ID].js"></script>


How and where can I integrate the code?




// Log the consent status of the current visitor to the console
_hsq.push(['addPrivacyConsentListener', function(consent) {




document.getElementById("removeCookies").onclick = function() {


Thank you for your support. I'm not a programmer.




P.S.: The cookie banner is already displayed correctly.


0 Me gusta
3 Respuestas 3
Gestor de la comunidad

Hello @ThomasKujawa I don't completely understand your goal / question? Could you please elaborate further with detail / context of what you are trying to acheive? Thank you!

0 Me gusta
Colaborador ocasional

I have the same question - I think at least...


Think of this scenario:

1. A new visitor comes to our website and the HubSpot populated cookie banner with I ACCEPT, I DECLINE buttons are shown.

2. Visitor accepts.

3. At a later time visitor decides that he/she no longer wants to be tracked.


The question is how do we go about using these APIs so that the visitor can by him/herself decline tracking. Can a CTA be used to trigger the script?


Ideally the logic would look like this:


if (CTA_opt-out == clicked)

  If (cookie tracking == TRUE)


    ShowDialog("You are no longer tracked. If you also want to remove your complete history, please read more on https://www.asdf.com/exercise-my-rights");


    ShowDialog("You were never being tracked!");


Colaborador ocasional
0 Me gusta