How to track a permlink that redirects to a document

Hi guys

On our site we use a variety of permanent links that we and our partners use as a way to always download the latest version of a document.

One example is https://bankinvest.dk/permlink/ugekommentar that will return the latest weekly financial report in pdf-format.

The thing is, that these downloads don’t show up in Piwik as neither document downloads or pageviews.

How do we go about tracking these downloads?

Any help appreciated :slight_smile: slight_smile:

Hi @WhyAlsoAUserNameHuh1,

Our enginge responsible for recognizing downloads reads if specific link url contains a file extension available in our default list. You can check this list in following help center article:Download report | Piwik PRO help center
If your links don’t have file extension included, you can also set up specific classes to be recognized as a links or add download attribute to them, according to our documentation: API — Piwik PRO Analytics Suite 18.2 documentation

Hope that helps!

Hi Adam

Hmm, I don’t really have the option to add a class to the download links, as these links are often placed on third party sites or used in newsletters etc.

Perhaps there is a way to add the string “/permlink/” to the list of file extensions Piwik recognize as a downloadable file?

Hi Jesper,

Unfortunately default download tracking won’t recognize it, even if you add additional string to the query. It looks for the file extension. In such scenario I think you can use custom event and include in its parameter link of clicked download file. As a trigger you can use click that checks if clicked link contains “/permlink/”.

Hi Jesper,

I’ve got one more idea how to solve that once you add ‘/permlink’. You can use Custom JS tag and place there following function:
_paq.push([“trackLink”, “{{ Click Url }}”, “download”]);
and trigger tag similarly as I described in previous message, so create a click trigger which with condition that checks if Click URL contains “/permlink/”

Let me know if that’s clear