cURL
curl --request POST \ --url https://js.hs-scripts.com/addPrivacyConsentListener \ --header 'Content-Type: application/javascript' \ --data @- <<EOF "_hsq.push(['addPrivacyConsentListener', function(consent) { console.log('Consent status:', consent); }]);" EOF
Check the consent status of the visitor when using the privacy consent banner.
var _hsq = (window._hsq = window._hsq || []); _hsq.push([ "addPrivacyConsentListener", function (consent) { // Handle consent status if (consent.allowed) { console.log("Consent granted"); // Enable additional tracking or analytics } else { console.log("Consent denied"); // Disable additional tracking } }, ]);
allowed
Consent listener callback
Callback function to handle consent status
Consent listener added successfully
Was this page helpful?