US states laws
Code sample
window.didomiOnReady = window.didomiOnReady || [];
window.didomiOnReady.push(function (Didomi) {
const userStatus = window.Didomi.getCurrentUserStatus();
if (
userStatus.regulation == 'cpra'
|| userStatus.regulation == 'cpa'
|| userStatus.regulation == 'ucpa'
|| userStatus.regulation == 'ctdpa'
|| userStatus.regulation == 'vcdpa'
) {
if (
!!Object
.values(userStatus.purposes)
.find(purpose => purpose.enabled === false)
) {
// User has opted out, do not load prebid ads
// Load non-prebid ads via GAM or another ad server
} else {
// User has not opted out, load prebid ads and your usual ad logic without restriction
}
}
});Last updated