Collecting data with Trackers and Webhooks

  1. Home
  2. Docs
  3. Collecting data with Trackers and Webhooks
  4. Trackers – collecting data from your own applications
  5. JavaScript Trackers (Web and Node.js)
  6. JavaScript Tracker
  7. JavaScript Tracker v2 Reference
  8. Advanced Usage
  9. Getting the most out of performance timing

Getting the most out of performance timing

The domCompleteloadEventStart, and loadEventEnd metrics in the NavigationTiming API are set to 0 until after every script on the page has finished executing, including sp.js. This means that the corresponding fields in the PerformanceTiming reported by the tracker will be 0. To get around this limitation, you can wrap all Snowplow code in a setTimeout call:

setTimeout(function () { // Load Snowplow and call tracking methods here }, 0);
Code language: JavaScript (javascript)

This delays its execution until after those NavigationTiming fields are set.

If you’d like to learn more about Snowplow Insights you can book a demo with our team, or if you’d prefer, you can try Snowplow technology for yourself quickly and easily.