Track time on site

Track time-on-site as a conversion event using custom AnyTrack snippets to measure visitor engagement and content quality.

The time a visitor spends on your site can give you a good indication of your content value or the quality of your traffic.

❗️

Before you begin:

You must be familiar with Javascript, HTML, and CSS to use these tracking snippets. If you're not familiar with all of these coding languages, please forward the article to a developer.

The SetTimeOut function

To trigger a "time on site" Event you can use the function: setTimeout

This Event accepts an Event Name as well as a an encoded time value.

The snippet below

setTimeout(function() {  
  //Replace LongVisit with any other event name
	AnyTrack("trigger", "LongVisit");  
  //10 seconds is encoded
}, 10e3);  

This code will trigger an event name called LongVisit 10 seconds after the the user has been on the page.

You can update the triggering time clock as you see fit based on the following encoding.

Examples:

  • 10 seconds is encoded 10e3
  • 120 seconds is encoded 120e3

Find out more about time encoding here.