#
File Download Tracking
Tracking downloads of files on a website is essential for many website owners. CountUp will automatically track file downloads on your website by default. This allows you to easily understand which files and file types (extensions) are viewed the most. This is because CountUp will automatically capture the file name and extension for all downloads.
Tracking works for all common file extensions. This includes: pdf
, xlsx
, docx
, txt
, rtf
, csv
, exe
, key
, pps
, ppt
, pptx
, 7z
, pkg
, rar
, gz
, zip
, avi
, mov
, mp4
, mpeg
, wmv
, midi
, mp3
, wav
, wma
.
Note
These automatic events count towards your billable monthly events. If you want to disable automatic download tracking, see below.
#
How it Works
File download tracking works out-of-the-box with no additional configuration. Behind the scenes, CountUp will analyze clicks on anchor <a>
elements and see if they refer to a path with a file extension or if they have a download
attribute.
#
Add additional Extensions
By default automatic download tracking works for the extensions listed above. However you can easily add additional file extensions by providing a comma separated list of in the data-track-file-extensions
attribute of your script tag. For example:
<script
defer
data-domain="your-domain.com"
data-track-file-extensions="js,css",
src="https://cdn.countup.io/script.min.js">
</script>
In the example above, all links that end on .js
or .css
would also be tracked as file downloads (in addition to the default ones).
#
Disable Automatic Download Tracking
If you don't want file downloads to be tracked automatically, you can disable this feature by setting the data-disable-download-tracking
attribute on the tracking snippet:
<script
defer
data-domain="your-domain.com"
data-disable-download-tracking
src="https://cdn.countup.io/script.min.js">
</script>
Note
You can still manually track your downloads by calling: countup.trackDownload('my-file.pdf');
.