The tracking snippet is a small piece of JavaScript code that you embed into your website to track visitor interactions. This document outlines how the tracking snippet works and how you can configure it.

Installation

Your tracking snippet is hosted on your analytics server. To install it on your website, you need to include the following script tag in the <head> section of your website:

<script defer src="https://[your-analytics-server].com/script.js"></script>

Configuration

The tracking snippet can be configured using the following options:

OptionDescription
data-apiOptional hostname + path to the analytics server. Default is the domain where the script is being hosted.
data-hashInclude this to track browser navigations for websites that use a hash router.

Here’s an example of a fully configured tracking snippet:

Example
<script defer src="https://[where-your-script-is-hosted].com/script.js" data-api="[different-analytics-server].com/api/" data-hash></script>