How to record download events
Jessica Chambers avatar
Written by Jessica Chambers
Updated over a week ago

Download events record when a user downloads a non-HTML file, such as a PDF document. These are shown under our Downloads screen.

Silktide attempts to detect downloads automatically. However, in some cases a website may link to downloads in an unusual way which Silktide cannot detect. In these cases, you will need to use our API to tell Silktide that a download is taking place.

What Silktide records automatically

Download events are automatically fired when the user clicks on a URL which has a file extension matching a long list of common file extensions (e.g. .pdf, .docx). See how Silktide detects downloads.

You can customize this list of extensions, if you have something unusual Silktide doesn’t know about.

However, in some cases a website may link to downloads without a predictable file extension. In these cases, you will need to use our API to tell Silktide that a download is taking place.

Recording your own download event

Use the following JavaScript to record a download event:

silktide("download", { "url": "https://example.com/example.pdf" });

This event accepts a url to specify what file is about to be downloaded.

Recording from a backend server

Alternatively, you may prefer to record download events from a backend server.

First you should learn how to record an event from a server.

You can then POST the following payload, substituting the values for your own:

{ "propertyKey": "7zi4z7hui2", "url": "https://example.com/", "ip": "12.34.56.78", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) ...", "events": [ { "event": "download", "url": "https://example.com/downloaded-file.pdf" }, ] }
Did this answer your question?