If you have a website and need to track file downloads, you may be wondering how to do it. Initially, I thought my only option was to use URL shorteners that provided statistics, as I was building a static site without a backend. However, I wasn’t particularly excited about that solution.

Then, I discovered that Plausible can track file downloads, and it’s surprisingly simple to implement. All you need to do is replace the default script with a modified one that lists the file extensions you want to track. For example, if you want to track PDF and EPUB files, you would modify the script like this:

<script defer file-types="pdf,epub" data-domain="yourdomain.com" src="https://plausible.io/js/script.file-downloads.js"></script>

By making this adjustment, PDF files will be tracked by default, but EPUB files won’t. Therefore, you need to add both file extensions to ensure accurate tracking.

Finally, don’t forget to add a goal named “File Download” in your website settings. Once you’ve completed these steps, tracking file downloads becomes super easy and works like a charm.

Tags: file downloads, website tracking, Plausible, analytics