Skip to main content

Siteimprove Analytics: Custom Visit Tracking

Modified on: Thu, 12 May, 2022 at 2:46 PM

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 follow the following steps:

  1. Ensure that the 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 by default, ‘#’, and everything following, is stripped from URLs in the Siteimprove platform.

  1. Add the following JavaScript code to be executed when the new pseudo page load event happens:
_sz.push(["trackdynamic",{

       "url": "new page URL",

       "ref": "current page URL",

       "title": "new page title"

}]);
  • 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 the following data:

_sz.push(["trackdynamic",{

       "url": "
http://xyz.com/section2",

       "ref": "
http://xyz.com/section1",

       "title": "
Section 2"

}]);


Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.