Skip to content

Listening to Window Event dispatches

It is also possible to listen to events that we dispatch with Window Event.

The Window Event name can be configured in the admin interface under Implementation -> Data Layer and Events -> Window Event.

In the following example we assume that you configured the Window Event events that we dispatch, with the name "ucEvent" in your admin interface.

window.addEventListener("ucEvent", function (e) {    
  if(e.detail && e.detail.event == "consent_status") {
    // check for consent status of service "Google Ads Remarketing"
    if(e.detail['Google Ads Remarketing'] === true) {
      console.log('Google Ads Remarketing has consent');
    }
    else {
      console.log('Google Ads Remarketing has no consent');
    }
  }
});