Skip to main content

Siteimprove Analytics: Custom Visit Tracking

Aleksandra Nowak avatar
By Aleksandra Nowak

Using Siteimprove Analytics code, it is possible to create your own Visit Tracking which is not depending on page load events or changes in URLs.

To do this you will need to carry out the following steps:

  1. Ensure that Siteimprove script is present on all pages/partial pages that you want to track.
  2. Define the event that would trigger a new 'Pageview' - it can be a partial page load or any other change of content.
  3. Decide whether you would like to see the page views as views of different pages, or as many views of a single page. 

If you want to see page views as views of different pages, then you must define pseudo changes in the URL that would be the most descriptive for you. For example, views of different parts of the page ‘xyz.com’ could be tracked as xyz.com/section1, xyz.com/section2, xyz.com/section3, etc.

Note: If you plan on using the hash symbol (#), please replace it with ‘/hash/’ instead. This is because ‘#’, and everything following, is stripped from URLs in the Siteimprove platform.

  1. Add following JavaScript code to be executed when new pseudo page load event happens:
_sz.push(['trackdynamic', [['url', new page URL], ['ref', current page URL], ['title',  new page title]]]);

where, 
new page URL = new pseudo URL that should be recorded,
current page URL = used in the same way as 'document.referrer', URL that was visited before,
new page title = page title for the new pseudo page.

For example, if a user came from http://xyz.com/section1 to http://xyz.com/section2, then when the new part of the page is loaded (i.e. http://xyz.com/section2) you could send following data:

_sz.push(['trackdynamic', [['url', 'http://xyz.com/section2'], ['ref', 'http://xyz.com/section1'], ['title', 'Section 2']]]);

Please contact Siteimprove Technical Support if you have any questions regarding this.

Was this article helpful?
1 out of 1 found this helpful