No rows in piwik_log_visit


Good morning,

Just finished installing Piwik. Looks wonderful, however it’s not inserting any visitor data.

mod_security is not installed. Logs show the script that does the work is being called without a problem and returns HTTP 200. The javascript points to the correct URLs and uses the correct site ID. On-access archiving of data is enabled. Definitely viewing the correct website.

How do I proceed to debug this?


After some further testing, it appears that it works, but only in IE. Firefox and Chrome do not seem to execute the javascript properly.


Seems to be fixed by adding:

<script src="/path/to/piwik.js" type="text/javascript></script> <p>Above the provided JS by piwik. Surely there’s a better way?</p>

(vipsoft) #4

Should work. Are you obfuscating the javascript, or splitting the document.write across lines?


Hi Anthon,

Nope, copy and pasting as is, with the same exact formatting.

(vipsoft) #6

Some browsers disable document.write when the page is XHTML-Strict.


That would explain it, our entire website is written in XHTML strict; our httpd sends the proper mime headers for it, too. What would be the best reliable alternative?

(vipsoft) #8

This won’t help with GA…

But since you’re hosting Piwik, you would simply replace the document.write with a tag to load piwik.js, as you did.


<!-- if piwik is hosted on the same domain as the page being tracked -->
<script src="/path-to-piwik/piwik.js" type="text/javascript"></script>

<!-- this should work in all cases where piwik is on the same domain for http and https; note the double slash -->
<script src="//host/path-to-piwik/piwik.js" type="text/javascript"></script>

In the second example, the relative URI is resolved by prepending the base URL’s scheme (either https or http), per the rules in RFC3986 (Section 4).

The only case not handled by the above is where Piwik is hosted on different domains, e.g.,

https;// vs http: //



Wonderful, thank you, that was very helpful.

Interesting, is there any reason why document.write is being used over this solution? It seems more sensible to provide this as default tracking code.

(vipsoft) #10

We use document.write because one of the unwritten precepts that guides Piwik development is that: as an alternative to GA, Piwik mimics some elements of GA to make it more familiar for GA users who make the switch.

But I agree, the relative URI (schemeless) is nicer, so I’ve opened a ticket.