intempt:page

Usage example

The following JavaScript snippet demonstrates how to listen for the intempt:page event, which is automatically emitted by the auto-tracker for various Page View events. This custom event includes a detail property that provides additional information about the event triggered:

 document.addEventListener('intempt:page', (event) => {
 const { detail } = event;
 const { eventName, fullUrl, title, windowWidth, pageId, duration, previousPage } = detail;
   
 //Your logic here
 
 })

This Page View listener event contains a detail property, which is a part of the custom event. The detail object contains:

  • eventName: name of the event which was passed to intempt:page event , like "View page"and "Leave page".
  • fullUrl: The full URL of the page where the event occurred.
  • title: The title of the page associated with the event.
  • windowWidth: The width of the device window at the time of the event.
  • pageId: A unique identifier for the page.
  • duration: The time spent on the page before the event was triggered.This value is undefined for the "View page" event as no time on the page has yet been accumulated.
  • previousPage: The URL of the previous page visited before the current page view event.