Tracking Impressions

You can send impressions data to Heap using the track API. Our recommendation is to use a dedicated library. We've listed the following two options in order of the estimated engineering effort required.

Waypoints

Waypoints is a package you can install to abstract away all the more complicated calculations that you need to do to check whether an element is in a view, etc. For example:

var waypoint = new Waypoint({
  element: document.getElementById('waypoint'),
  handler: function(direction) {
    heap.track('Scrolled to waypoint!')
  }
})

To get started, check out the Waypoint Library.

IntersectionObservers

IntersectionObservers are relatively cutting-edge JavaScript, and are still listed as Experimental by MDN. It is very customizable, but requires more engineering effort. It is not compatible with Internet Explorer and offers questionable support across other popular browsers. You can use a polyfill to provide compatibility for older browsers.

Review their Intersection Observer API documentation to learn more.

You can also use the Google Tag Manager's element visibility trigger for impression tracking. See Google's support documentation to learn more.

Updated 4 months ago

Tracking Impressions


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.