Tracking
Track file downloads
Track when users download files like PDFs, ZIPs, images, or other assets from your website using Umami custom events.
This page covers the Umami implementation. For measurement strategy — which metrics to collect, event design, and how to interpret download data — see the file download tracking guide on the main site.
Using data attributes#
Add data-umami-event attributes to your download links:
Each click will record an event named file-download with a file property containing the filename.
Tracking all downloads automatically#
Use this script to automatically track clicks on any link pointing to common file types:
This finds all links to downloadable files and adds tracking attributes automatically, without modifying each link by hand.
Viewing download data#
- Navigate to your website in Umami.
- Click on Events to see the
file-downloadevent and its counts. - Click on Event data to view a breakdown by the
fileproperty, showing which files are downloaded most.
Tips
- Use consistent event names (e.g., always
file-download) so all downloads are grouped together. - Use the
fileproperty to distinguish between different files rather than creating a separate event name for each file. - If downloads are served from a different domain (like a CDN), the tracking still works since the event fires on the click, not the destination.