Docs
Tracking Script

Tracking Script

Installing script on your website

The code snippet of tracking script is shown once you add new site in the dashboard. You can copy the code and paste it in the header of your website. The script should be placed before the closing tag of the head section.

In case you missed the snippet, you can go to the dashboard, click on the site and go to the Settings.

Snippet looks like this:

<script src="https://statsy.observer/<SITE_ID>.js" defer></script>

The script is unique for every site inside the team. Please make sure you use the correct snippet for your website.

Script Customization

Tracking Script Settings
Tracking Script Settings

The basic version of script tracks only pageviews and custom events. You can extend its functionality by enabling some options listed below.

💡

If you change any option, script will be automatically revalidated and put on a CDN to guarantee fast response globally.

Tracking Web Vitals

Enable this option to track Web Vitals. Web Vitals are a set of metrics that measure the user experience of a web page. They are designed to help you understand the performance of your site and to identify areas for improvement.

Tracking Outbound Links

Outbound link is a link on your website that leads to another domain. You can track all outbound links by enabling this option. The script will track clicks on all outbound links and you will be able to see it in the dashboard.

Respecting Do Not Track Settings

Do Not Track (DNT) is a formerly official HTTP header field, designed to allow internet users to opt-out of tracking by websites—which includes the collection of data regarding a user's activity across multiple distinct contexts, and the retention, use, or sharing of data derived from that activity outside the context in which it occurred.

Enabling Debug Mode

Debug mode is disabled by default. It will log all the events to the console. You can enable it by unchecking the option.

Custom Domains

You can use your own domain for the script. This is useful if you want to serve tracking script from your own domain. It will also help you to avoid issues with ad blockers.

Add custom domain to tracking script
Add custom domain to tracking script