TrackLinks with Class and funktion


(MROXZ) #1

Hello,

it seems to me that class piwik_download is currently not working. The actions are all tracked as normal site view but not as download as it should be!

can anybody help?

thanks!


(Matthieu Aubry) #2

could you prepare a small HTML page where the problem can be reproduced?


(MROXZ) #3

here you go


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <title>Titel der Webseite</title>
    <!-- weitere Kopfinformationen -->
    <!-- Kommentare werden im Browser nicht angezeigt. -->
  </head>
  <body>
    <p>Inhalt der Webseite</p>

    <a class="piwik_download" href="http://www.ibumedia.de" target="_blank">download</a>

    <!-- Piwik --> 
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://piwik.ibumedia.de/" : "http://piwik.ibumedia.de/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">

var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 44);
piwikTracker.setCustomVariable(2, 'Thessaurus', '/Technik/Gestaltung/1234567890/1234', 'page');
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();

</script><noscript><p><img src="http://piwik.ibumedia.de/piwik.php?idsite=44" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->

  </body>
</html>

If I click on the link the view will be recorded but no download!


(Matthieu Aubry) #4

If you link to an external domain, the click will be counted as “Outlink” — is this the behavior you are observing (that the click is tracked as outlink) ?


(MROXZ) #5

Correct. The link is tracked as outlink. But I thought it will be tracked as download if it has the css class “piwik_download”


(Matthieu Aubry) #6

Good suggestion! I created a ticket Piwik.js: when using class="piwik_download" on an outlink, it should track a download and not an outlink · Issue #3292 · matomo-org/matomo · GitHub


(MROXZ) #7

ok if that isn’t the already intended behavior of the css class “piwik_download” then the documentation is misleading

http://piwik.org/docs/javascript-tracking/#toc-force-a-click-on-a-link-to-be-recorded-as-a-download-in-piwik