Tracking downloads served through ZotPress
-
Blown away by this plugin. Very well-executed and amazing that it basically all works out of the box!
Here’s one of the few things I couldn’t get to work (yet). I’m using ZotPress to generate publication lists with PDF download links, for which I would like to track downloads using Matomo. Thing is, downloads are not on the same server but retrieved via the Zotero API, which means for instance the links don’t end in
.pdf
and are not natively recognised as downloads. The links all look like this:<a title="Download" class="zp-DownloadURL" href="https://mydomain.net/wp-content/plugins/zotpress/lib/request/request.dl.php?api_user_id=1234567&dlkey=HDSBBZ9D&content_type=application/pdf">PDF</a>
BTW, baseline checks: Matomo can and does detect downloads on this site: a direct link to a PDF on same server is detected as a download, and a click on an URL with
piwik-download
class or an additionalzp-DownloadURL
class is also detected as a download.My problem is with the dynamic links generated by ZotPress.
I’ve tried a few things, to no avail:
1. I added the CSS class
zp-DownloadURL
to setDownloadclasses so that Matomo will recognize clicks on these links as downloads.Result: Clicks in ZotPress-generated lists are not detected as a download. (Note that this class does work when I create my own URL manually; see baseline check above.)
2. I added a Goal triggered when visiting an URL that contains
zotpress/lib/request/request.dl.php
(middle part of the ZotPress download link)Result: click doesn’t trigger goal.
3. I added a Goal triggered when visiting an URL that matches the expression
application\/pdf
(final part of the ZotPress download link)Result: click doesn’t trigger goal.
4. I added
application\/pdf
to the filetypes recognized as downloadResult: isn’t recognised as download (and yes I was getting desparate)
Not being a JS person at all, I’m at a loss where to start debugging this. (I mention this because the FAQ for troubles with download tracking mentions “you might have to manually edit your Javascript code to return false in onclick events” β I wouldn’t know where to do this.) Help appreciated!
The page I need help with: [log in to see the link]
- The topic ‘Tracking downloads served through ZotPress’ is closed to new replies.