Legacy
English
cURL
curl --request POST \ --url https://js.hs-scripts.com/addPrivacyConsentListener \ --header 'Content-Type: application/javascript' \ --data '"_hsq.push(['\''addPrivacyConsentListener'\'', function(consent) { console.log('\''Consent status:'\'', consent); }]);"'
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
The body is of type object.
object
Consent listener added successfully
Was this page helpful?