Just installed - no data


#1

Hi,

I have installed piwik and it is currently running but shows no data. I checked faq’s but nothing seems to work.

checked stats for today - nothing
turned javascript on the site I am tracking - nothing
alternatively, I ran the code as an image - nothing
set up cron - nothing.

should I reinstall???


(Matthieu Aubry) #2

Do you see the code in your website page?
when you visit yourwebsite do you see any JS error?

if not, try to debug the tracking code as explained in Tracking HTTP API: API Reference - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3


#3

I had the same issue and noticed the tracker code being generated was missing the protocol. For example, in the tracker code I had something like this:


 var u="//www.example.com/piwik/"

Instead of:


 var u="http://www.example.com/piwik/"

I changed it manually, and now see traffic data in the dashboard. Very annoying problem to have out of the box, but at least an easy fix. I tried to delve a bit deeper in the code to figure out what is causing it, but I gave up once I fixed it. I’m not sure if this is an issue that should have a bug report opened on it, or if it was something I messed up during configuration, but if it was my fault it was not obvious where I went astray.


(Matthieu Napoli) #4

Which version of Piwik have you installed?

The tracking code should not look like what you posted, it should detect “http” or “https” and add it automatically, here is what the Javascript code should look like:


<script type="text/javascript">
    var _paq = _paq || [];
    (function(){ var u=(("https:" == document.location.protocol) ? "https://{$PIWIK_URL}/" : "http://{$PIWIK_URL}/");
    _paq.push(['setSiteId', {$IDSITE}]);
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['trackPageView']);
    _paq.push(['enableLinkTracking']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.defer=true; g.async=true; g.src=u+'piwik.js';
    s.parentNode.insertBefore(g,s); })();
</script>


#5

I was using version 2.9. I have just now upgraded to version 2.10.0. Here is what my tracker code looks like currently (doesn’t appear to have changed in the new version).


<!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//marymcclernon.com/piwik/";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', 1]);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<noscript><p><img src="//marymcclernon.com/piwik/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->



(Matthieu Napoli) #6

Ah my bad, your code is correct indeed.

Which browser are you testing with? Maybe it’s an old one that doesn’t support the “//” format.


#7

I’m using the latest firefox. Can you explain, or point me to documentation on this // feature of javascript? I’d like to understand how that works. The code you posted has this line:


(function(){ var u=(("https:" == document.location.protocol) ? "https://{$PIWIK_URL}/" : "http://{$PIWIK_URL}/");

The code I posted seems to be missing that. I am by no means an expert in javascript or web coding in general, so I’m probably just not understanding something, but I’d love to learn how this piece works.


(Matthieu Napoli) #8

Find more information about that here: url - Can I change all my http:// links to just //? - Stack Overflow

The tracking code I pasted was from documentation that must have been outdated, the tracker has been changed since (to what you have).

Is your website is in HTTPS? Maybe that causes the Piwik tracker to call Piwik with HTTPS, which might not work?


#9

Yes, I am forcing https on all pages. As I was looking into this I noticed a couple other symptoms that may or may not be relevant. In the visitor details, piwik shows “Page URL not defined” for all visits. Also in the main dashboard the browser widget shows “Widget not found” as it’s title (although this seems to be the case even in the piwik demo on piwik.org). I am going put the javascript code you say is correct back in there and test again. I will also test removing the redirect to https and see what happens.


(Matthieu Napoli) #10

Yes maybe your website is in HTTPS but Piwik is not, thus the problem.

Try and see in the javascript console if there’s any message.


#11

I’m not sure what you mean by the javascript console, could you explain that? However, I changed the tracking code back to what it should be and everything seems to be working, both with or without https. Thanks for your patience and advice!


#12

Here the same!

i installed piwik 2.10 as upgrade on a 2.91 and afterwarth i have no data, i delete my database and put the old one back (those from 2.91) and the same with the piwik instalation (with other words i downgrade it all to 2.91 and everything is back normal)