Downloads and outlinks not being tracked correctly


(Markus00000) #1

Hi,

I have setup Piwik to analyze several separate folders under my domain:
domain.com/folder1
domain.com/folder2

Downloads in both folders link to folder1/files/file-to-download.zip

Visits seem to be tracked correctly but not downloads and outlinks. It seems almost random. I can download several different files and not a single download is being tracked. I can click outlinks and they are not tracked. But still, from time to time some downloads and outlinks pop up in the stats.

I have no idea where to start, so I appreciate any help. Thanks.

(0.5.4.)


(Markus00000) #2

I think I just made sure something is definitely broken for me. I created a download on a private site, downloaded it, deleted it. The download never showed up in the stats.


(cableghost) #3

The tracking of outlinks on my sites is sporadic. I have tested this on 20 sites and not all links are tracked.

Outside of javascript or flash, is there anything else piwik doesn’t like? Will piwik not track ‘nofollow’ links or the such?

-Scott


(Matthieu Aubry) #4

When a user clicks to download a file, or clicks on an outbound link, Piwik records it. In order to do so, it adds a small delay before the user is redirected to the requested file or link. We use a default value of 500ms.

You can set this delay to a shorter length of time (to reduce the delay between the click and the download starting but you will track less clicks), or you can set it to longer time (if you want to track more downloads/outlinks, you might want to set it to 750). However, setting the timer higher than 500 might cause users to feel the delay between their clicks and the redirect, so use it with care.

[…]
piwikTracker.setLinkTrackingTimer( 750 ); // 750 milliseconds
piwikTracker.trackPageView();
[…]

from http://piwik.org/docs/javascript-tracking/


(Markus00000) #5

Thanks for your help. I will give it a try when I have the opportunity.


#6

I am also not seeing any outlinks in my stats. I tried the fix mentioned above (750 milliseconds) but it hasn’t had any effect. All the links are standard HTML links.


(vipsoft) #7

Check other JavaScript on your page that implement click handlers, e.g., lightboxes. A recurring problem is that the third-party click handler returns a value causing the browser to cancel other registered click handlers (e.g., Piwik’s link tracker).


#8

There are no conflicts. Just to be sure, I created a page called test.html as follows:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">

<head>
<title>Outlink Test Page</title>
</head>

<body>
<a href="http://www.google.com">Google</a>
<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("http:" == document.location.protocol) ? "http://stats.mydomain.com/" : "http://stats.mydomain.com/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
piwikTracker.setLinkTrackingTimer( 750 ); // 750 milliseconds
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://stats.mydomain.com/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Tag -->
</body>
</html>

Somehow the code above is converting these into smileys (I added the spaces to prevent the smileys from showing) :
"http://stats.mydomain.com/ " ) ;
script % 3 E " ) ) ;

I tried it both with and without the optional 750 milliseconds statement. I even tried setting it to 2000ms. No difference – none of my outlinks are tracked. Pageviews are tracked.

I also tried deleting the section to make sure the tracking wasn’t happening through the image tracker. That made no difference, so the pageviews are being tracked through Javascript.

(I changed the https references to http because that works better on my server (shared hosting), but I also tried with https just to be sure that wasn’t the problem either.)


(Matthieu Aubry) #9

Put this page somewhere online and send us the link, we can check what’s wrong


#10

Sorry, it looks like this was a combination of 2 problems at my end:

  • I did need to change the click delay to 750ms (it didn’t work at 500, 650 or even 700), and
  • I think maybe the old page (without click delay code) was caching somehow. Now I am receiving the new pages with the 750ms delay and the outlinks are registering.

Do you happen to know what method Statcounter uses to track outlinks (which they call “exit links”)? I’ve never had a problem with tracking outlinks through Statcounter, and I’m not sure whether they use a click delay.


(Matthieu Aubry) #11

Not sure how statcounter does click tracking?

I updated FAQ with your finding: Troubleshooting - Analytics Platform - Matomo


#12

Here’s the Statcounter tracking tag (the version for self-hosted Wordpress users):

(I have replaced certain personalized variables with 9999999 and XXXXXXXX)


<!-- Start of StatCounter Code -->
<script type="text/javascript">
var sc_project=9999999; 
var sc_invisible=1; 
var sc_security="XXXXXXXX"; 
</script>

<script type="text/javascript"
src="http://www.statcounter.com/counter/counter.js"></script><noscript><div
class="statcounter"><a title="wordpress stats plugin"
href="http://statcounter.com/wordpress.org/"
target="_blank"><img class="statcounter"
src="http://c.statcounter.com/9999999/0/XXXXXXXX/1/"
alt="wordpress stats plugin" ></a></div></noscript>
<!-- End of StatCounter Code -->

As you can see, the tag is calling


http://www.statcounter.com/counter/counter.js

I don’t want to reproduce the script here (out of respect for copyright), but of course anyone can examine the code on the Statcounter site.