setDownloadClasses

The setDownloadClasses() method sets a list of CSS classes that should be tracked as downloads (not outlinks). Downloads are clicks on links to downloadable files. Outlinks are clicks on links to external websites (different domain).

Syntax

setDownloadClasses(classes)
setDownloadClasses(classes): void
setDownloadClasses(classes): void
setDownloadClasses(classes): void
setDownloadClasses(classes): void
setDownloadClasses(classes): void
setDownloadClasses(classes): void

Parameters

classes (string | array, required)

The name of the CSS class to be tracked as a download (not an outlink).

Examples

To track as downloads the elements tagged with the this-is-a-download CSS class:

_paq.push(["setDownloadClasses", "this-is-a-download"]);
setDownloadClasses("this-is-a-download"): void
setDownloadClasses("this-is-a-download"): void
setDownloadClasses("this-is-a-download"): void
setDownloadClasses("this-is-a-download"): void
setDownloadClasses("this-is-a-download"): void
setDownloadClasses("this-is-a-download"): void

Notes

  • Elements tagged with the download attribute, the piwik-download class or the piwik_download class are always treated as downloads.
  • Links that contain a known file extension are treated as downloads. The default known file extensions are: 7z, aac, apk, arc, arj, asf, asx, avi, azw3, bin, csv, deb, dmg, doc, docx, epub, exe, flv, gif, gz, gzip, hqx, ibooks, jar, jpg, jpeg, js, mobi, mp2, mp3, mp4, mpg, mpeg, mov, movie, msi, msp, odb, odf, odg, ods, odt, ogg, ogv, pdf, phps, png, ppt, pptx, qt, qtm, ra, ram, rar, rpm, sea, sit, tar, tbz, tbz2, bz, bz2, tgz, torrent, txt, wav, wma, wmv, wpd, xls, xlsx, xml, z, zip.

Related methods