Advanced features
Script options
Every attribute the script tag takes: Do Not Track, excluded paths, single-page apps and more.
The script tag takes these optional attributes:
| Attribute | Example | What it does |
|---|---|---|
data-respect-dnt | data-respect-dnt="true" | Skip visitors whose browser sends Do Not Track. |
data-spa-tracking | data-spa-tracking="false" | Turn off pageviews on client-side URL changes (on by default for single-page apps). |
data-exclude | data-exclude="/app/**,/share/*" | Stop tracking on matching paths; * is one path segment, ** is anything. |
data-scroll-depth | data-scroll-depth="false" | Turn off scroll depth (on by default). |
data-host-url | data-host-url="https://stats.example.com" | Send events to a different origin than the one serving the script. |
Exclude pages
data-exclude takes a comma-separated list of paths. * matches one path segment and ** matches anything:
HTML<script defer data-website-id="YOUR-SITE-ID" data-exclude="/app/**,/admin/**,/preview/*" src="https://calmstats.com/script.js"></script>
Excluded pages send nothing, including events, and moving in and out of an excluded area in a single-page app is handled.
Respect Do Not Track
data-respect-dnt="true" skips visitors whose browser sends the Do Not Track signal. You can also switch it on in Settings → Tracking.
Settings in the script URL
Where you can't add attributes, as in some tag managers, put settings in the URL with underscores instead of dashes:
HTML<script defer src="https://calmstats.com/script.js?website_id=YOUR-SITE-ID&respect_dnt=true"></script>