Downloads
The download event counts the files your visitors download from your site. It's a built-in event (see Custom events). It shows up as download in the Events tab of the Goals block, on the Statistics screen, and in the CSV export. The Downloads tab of the same block ranks the most downloaded files on your site (its rows don't filter the page).
Automatic, or sent by you
The Snorklee code sends a download event automatically when a visitor clicks a link on your site to a common file: .pdf, .doc/.docx, .xls/.xlsx, .ppt/.pptx, .odt, .ods, .rtf, .csv, .zip, .7z, .gz. It sends the fact, never the file name, which stays in the browser — so these downloads count in the total, not in the file-by-file ranking. To have a file listed in the Downloads tab with its path, or for another file type, send the event yourself with the url property — on links the code doesn't already count, otherwise the click is counted twice:
document.querySelectorAll('a[href$=".epub"], a[href$=".mp3"]').forEach((a) => {
a.addEventListener('click', () => {
window.snorklee('download', {
url: new URL(a.href, location.href).pathname,
ext: a.href.split('.').pop(),
});
});
});
Recommended properties
The download event accepts any properties (10 max). The two most useful:
url— the file path (without the domain), to identify each file in the CSV export.ext— the extension (no dot), to filter by file type.
The Events tab shows the download count; the file-by-file breakdown (via url) is in the events CSV export.
Good habit
Stick to files that actually matter (documents, media, executables). No need to track every image or stylesheet — that's just noise, and the cap of 20 events per pageview applies.