What is Barion Payments?
How do I send consent data to the Barion pixel?
To effectively use the Barion pixels for analytical and advertising functions it's needed to make sure the consent changes can be propagated to the Barion pixel. More documentation can be found in their helpdesk here.
We have created a helper script that will make sure the correct signals are sent to the Barion Pixel. Add the following script to your website.
<script>
function handleConsentChange(e) {
var consent = e.detail || {};
var advertisingConsent = consent.advertising || null;
if (advertisingConsent === true) {
bp('consent', 'grantConsent');
} else if (advertisingConsent === false || advertisingConsent === null) {
bp('consent', 'rejectConsent');
} else {
console.error('Unexpected advertising consent value:', advertisingConsent);
}
}
window.addEventListener('cf_consent', handleConsentChange);
window.addEventListener('cf_consent_loaded', handleConsentChange);
</script>