Get started

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:

AttributeExampleWhat it does
data-respect-dntdata-respect-dnt="true"Skip visitors whose browser sends Do Not Track.
data-spa-trackingdata-spa-tracking="false"Turn off pageviews on client-side URL changes (on by default for single-page apps).
data-excludedata-exclude="/app/**,/share/*"Stop tracking on matching paths; * is one path segment, ** is anything.
data-scroll-depthdata-scroll-depth="false"Turn off scroll depth (on by default).
data-host-urldata-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>