Documentation Index

Fetch the complete documentation index at: https://usercentrics.document360.io/llms.txt

Use this file to discover all available pages before exploring further.

Detecting first-time visits by listening to the consent status in dataLayer

Prev Next
<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('FirstUserVisit');
    } else {
      if (e.detail.event == 'consent_status' && e.detail.type == 'EXPLICIT' && page == 0) {
        page = 1;
        dataLayer.push('UserAlreadyConsented');
      } else {
        if (e.detail.event == 'consent_status' && e.detail.type == 'EXPLICIT' && page == 1) {
          dataLayer.push('UserChangedConsents');
        }
      }
    }
  });
</script>