Excluding Pages

Learn how to exclude specific pages from being tracked.

Why Exclude Pages?

There are several reasons you might want to exclude certain pages from tracking:

Admin Areas

Exclude admin panels and dashboards

Thank You Pages

Avoid duplicate conversion tracking

Payment Pages

Exclude checkout and payment flows

Internal Tools

Exclude internal staff-only pages

Using Script Attributes

The simplest way to exclude pages is using the data-exclude attribute on your tracking script.

<script 
  async defer
  src="https://sitetooling.space/track.js"
  data-token="YOUR_TOKEN"
  data-exclude="/admin/*,/dashboard/*,/private/*"
></script>

Use comma-separated patterns. Wildcards (*) match any characters in a path segment.

Using JavaScript

For more complex logic, control exclusions from your own code once track.js has loaded.

// Add exclusion patterns
siteTooling.exclude('/admin/*');
siteTooling.exclude('/dashboard/*');

// Disable tracking on specific pages
if (window.location.pathname.startsWith('/admin')) {
  siteTooling.disable();
}

// Or disable based on user role, and turn it back on later
if (currentUser.isStaff) {
  siteTooling.disable();
}
siteTooling.enable();

// Check if a page is excluded (defaults to the current page)
console.log(siteTooling.isExcluded());               // true / false
console.log(siteTooling.isExcluded('/admin/users')); // true

// List the active exclusion patterns
console.log(siteTooling.getExclusions());

// Remove one pattern, or all of them
siteTooling.unexclude('/admin/*');
siteTooling.clearExclusions();

You can test a path against your saved patterns in your dashboard under Settings → Page exclusions.

Pattern Examples

PatternMatches
/admin/*All pages under /admin/
/dashboardExact match for /dashboard
*/private/*Any /private/ subdirectory
/api/*All API endpoints