#
Tracking Pages
By default, CountUp tracks a pageview when a page is loaded automatically. This is true for every page the tracking code is integrated in.
For each pageview, CountUp will capture the full path of the page relative to your sites domain. For example, if the URL is https://www.my-site.com/page1
, the name of the page will be tracked as /page1
.
#
Disable Automatic Pageviews
You can easily disable automatic tracking of pageviews, by setting the data-disable-pageview-tracking
attribute on your snippet:
<script
defer
data-domain="your-domain.com"
data-disable-pageview-tracking
src="https://cdn.countup.io/script.min.js"
></script>
With this configuration, the snippet will not cause an automatic pageview event to be tracked when the page loads. If you include the tracking code once for all pages, this will be true for all pages of your site.
Note
You could still trigger a pageview event manually by calling: countup.trackPageview();
using our JavaScript library.
#
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"
Please Note
The paths must always be relative to your domain! This means they should be specified as they appear in the URL after your domain name. So for example the page https://www.your-domain.com/page
would be specified as a path of /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.