Download stats remain 0

Dear Matomo admins,
I installed Matomo in my journal using OJS platform. I used script track. The issue is download and unique downloads remain 0. Is there any additional setting to have it work?

http://jurnalbeta.ac.id/index.php/betaJTM/stats

Hi,

Piwik detects your downloads simply by checking if the clicked URL ends with a “download” file extension.
https://matomo.org/faq/new-to-piwik/faq_47/
If your download links look like /downloader.php?id=123 Piwik can’t out of the box recognize that this is a download.
But you can add a class to the link to help Piwik:
https://developer.matomo.org/guides/tracking-javascript-guide#recording-a-click-as-a-download

<a href='last.php' class='piwik_download'>Link I want to track as a download</a>

In addition when your visitor goes directly to https://yoursite.example/download.zip without clicking on a link on your website, it is also not tracked as the Javascript Tracking code is never executed.

Thanks for the response,
Here is an article download link in my journal website

http://jurnalbeta.ac.id/index.php/betaJTM/article/view/110/107

How do I write the link to cover all articles dowloaded?

<a href='last.php' class='piwik_download'>Link I want to track as a download</a>

Hi,

Do I understand you correctly that http://jurnalbeta.ac.id/index.php/betaJTM/article/view/110 is the website of the article and you want to track the PDF link in the sidebar as a download?
You could just add the piwik_download class:

<a class="obj_galley_link pdf piwik_download" href="http://jurnalbeta.ac.id/index.php/betaJTM/article/view/110/107">		
	PDF
</a>

But I’m not sure how well this will work as the linked URL isn’t the file but rather another web page that is already tracked in Matomo (http://jurnalbeta.ac.id/index.php/betaJTM/article/view/110/107).
So you could try adding a custom Dimension to this website which saves that this page is the download page.

If you want to track the download button in the top right corner you can simply do it via the piwik_download class, but I am not sure how effective this is as I personally would rather use the save button of the PDF viewer, which can’t really be tracked via Matomo.
grafik
[BTW: The Text is white on white background for me]

1 Like

Thanks a lot @Lukas
I’ll give it a try

<a class="obj_galley_link pdf piwik_download" href="http://jurnalbeta.ac.id/index.php/betaJTM/article/view/110/107">		
	PDF
</a>

Do I put the codes inside the Piwik script?

Which codes?

You have to modify the template of the website so that
instead of

<a class="obj_galley_link pdf" href="http://jurnalbeta.ac.id/index.php/betaJTM/article/view/110/107">		

it outputs

<a class="obj_galley_link pdf piwik_download" href="http://jurnalbeta.ac.id/index.php/betaJTM/article/view/110/107">		

But an alternative (and maybe easier) way would be adding this line to the tracking code:

_paq.push(['setDownloadClasses', "pdf"]);

This way every click on a link with the css class pdf will be tracked as a download.

1 Like