# Exclude Pages from Tracking

Sometimes you want to exclude certain pages of your website from tracking. This can be useful for different reasons, for example to exclude:

  • Irrelevant or Testing Pages: Excluding pages that don't contribute meaningful insights, such as error pages, testing environments, or development pages, to maintain the accuracy and relevance of analytics data.
  • Frequently Crawled Pages: Pages that are often crawled by search engines or bots might be excluded to avoid skewing analytics data with non-human traffic.
  • High Traffic Pages: To manage the consumption of page views, which are often a pricing factor in analytics services. Excluding high-traffic pages can help control costs associated with tracking and analytics.

# How it Works

The exclusion feature works by allowing you to provide a list of paths that should be excluded from tracking. So for example: /page or /page/subpage.

To make things easier, you can also use the wildcard symbol %, to represent variable parts of the path. A single wildcard can be used at the beginning or end of a path segment, while using two wildcards, one at the beginning and one at the end, allows for matching any part of the path that includes the specified pattern. For example:

  • /page% would ignore all paths that start with "/page"
  • %page% would ignore all paths that include the string "page" anywhere
  • %page would ignore all paths that end with the string "page"

# Configuring the Tracking Snippet

You can set your list of paths you want to exclude on the tracking snippet using the data-excluded-paths attribute. You pass your list as a comma separated list of paths, for example: "/path1,/path2,/path3". Here is an example tracking snippet:

<script
  defer
  data-domain="your-domain.com"
  data-excluded-paths="/ignore/this/page,%ignore_this_everywhere%",
  src="https://cdn.countup.io/script.min.js">
</script>

In this example, pageviews of the page /ignore/this/page and all pages that include the string ignore_this_everywhere would not cause a pageview to be tracked.