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); }]);"
EOFCheck the consent status of the visitor when using the privacy consent banner.
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); }]);"
EOFvar _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 (boolean): Whether the visitor has granted consentConsent listener callback
Callback function to handle consent status
Consent listener added successfully
Was this page helpful?