File downloads Pro

Capture clicks on anchors that point to a downloadable file. Useful for lead magnets (PDFs, checklists), sample data (CSV, JSON), whitepapers, app installers, and any asset where a click is a meaningful conversion signal.

Enable

init
init("proj_xxx", { extensions: { downloads: true } })

// or, in React:
<Analytics projectId="proj_xxx" extensions={{ downloads: true }} />

What fires

One download event per matched click:

PropertyExampleNotes
urlhttps://clamp.sh/files/guide.pdfFull resolved URL.
filenameguide.pdfLast path segment — use this to group by asset.
extensionpdfLowercased, no leading dot.

Default extensions

Out of the box, these extensions fire a download event:

default list
pdf, zip, dmg, exe, msi, apk, ipa,
doc, docx, xls, xlsx, ppt, pptx, csv,
mp3, mp4, wav, mov, avi,
jpg, jpeg, png, gif, svg, webp,
tar, gz, rar, 7z

Heads up: images (jpg, png, etc.) are in the default list, so a site that wraps inline images in anchor tags will fire a download event on each lightbox click. Override the list to remove image extensions if that’s noise.

Override the list

Pass your own array of extensions. The value replaces the default — it doesn’t merge. Leading dots and case are normalized for you.

Only PDFs and ZIPs
init("proj_xxx", {
  extensions: {
    downloads: { extensions: ["pdf", "zip"] },
  },
})
Add a custom extension
init("proj_xxx", {
  extensions: {
    downloads: {
      extensions: [
        "pdf", "zip", "dmg", "exe",
        "sketch", // custom: Sketch design files
      ],
    },
  },
})

How it works

A single delegated click listener on document (capture phase) walks up to the nearest <a> via closest, resolves the href, and checks whether the pathname ends with one of the configured extensions. No listeners on individual links.

Gotchas