<script>
var page = 0;
window.addEventListener('uc-event', function (e) {
if (e.detail.event == 'consent_status' && e.detail.type == 'IMPLICIT' && page == 0) {
page = 1;
dataLayer.push({ event: 'FirstUserVisit' });
} else {
if (e.detail.event == 'consent_status' && e.detail.type == 'EXPLICIT' && page == 0) {
page = 1;
dataLayer.push({ event: 'UserAlreadyConsented' });
} else {
if (e.detail.event == 'consent_status' && e.detail.type == 'EXPLICIT' && page == 1) {
dataLayer.push({ event: 'UserChangedConsents' });
}
}
}
});
</script> Detecting first-time visits by listening to the consent status in dataLayer
- Updated on Nov 17, 2026
- Published on Sep 29, 2025
- 1 minute(s) read
Was this article helpful?