piwik_log_visit only goes up when I manually surf to piwik/piwik.php?idsite=1

I have a website in the works at

I’ve installed piwik, but the javascript tracker does not seem to work (you’ll see the javascript right at the bottom of the source before /body)

here is the javascript tracker:

<!-- Piwik --> 
<script type="text/javascript"> 
var pkBaseURL = (("https:" == document.location.protocol) ? "" : "");
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);
} catch( err ) {}
</script><noscript><p><img src="" style="border:0" alt=""/></p></noscript> 
<!-- End Piwik Tag -->

If I manually surf to piwik.php?idsite=1 the piwik_log_visit goes up by one. I sure am stumped.

Let me know if there’s anything else I need to provide.

EDIT: A quick note, I ran through the troubleshooting guide:

  1. Incorrect Piwik tracking code - I’ve provided mine above, let me know if it’s wrong.
  2. Testing Piwik with disabled Javascript - Javascript is enabled.
  3. Piwik displays a red cross (on IE) or a broken image icon on your tracked pages, instead of the 1*1 transparent Pixel - No this is not the case. And as stated I can manually surf to the pixel image and doing so DOES track in the database.
  4. Do you have logs registered in your Piwik database? - Only from the times I surf directly to piwik.php. The tracking code does not seem to log the users.
  5. Mysql / php timezones are not configured to be the same - “SELECT @@global.time_zone” returns that the time_zone is set to “SYSTEM” So I think this is fine.

Did you remove the tracking code? I just took a look, and couldn’t find the tracking code anywhere in the page source.

Whoops! My associate must have removed it momentarily while we were troubleshooting the issue. It’s back on the index page now. Still not tracking. style_emoticons/<#EMO_DIR#>/wink.gif

What is your server timezone? What is date.timezone in php.ini?

Ah… okay… it says “no value”

edit: I changed the value in php.ini to EDT. phpinfo() shows this data now:

date/time support  enabled  
Timezone Database Version  0.system  
Timezone Database  internal  
Default timezone  America/New_York  

Directive                Local Value    Master Value 
date.default_latitude    31.7667        31.7667 
date.default_longitude    35.2333        35.2333 
date.sunrise_zenith        90.583333        90.583333 
date.sunset_zenith        90.583333        90.583333 
date.timezone            EDT            EDT

Still no tracking. style_emoticons/<#EMO_DIR#>/smile.gif

To be clear:

I do not believe this is an issue with Piwik logging visits in the database yet simply not displaying them. I can see that piwik is not logging visits in my database.

That is, unless I actually type /piwik/piwik.php?idsite=1 into my address bar, in which case piwik logs a 10 second visit in the database, and that visit does show up in my dashboard results.

So it has something to do with the javascript code, or something (though I’ve triple-checked it). Truthfully I’ve no idea.

Can you please try with Piwik 0.5 just released?

another solution is to enable debug in piwik/piwik.php and then visit the piwik.php?.. set with Firebug when you visit your website.

Okay, turning on debug and using Firebug yielded no errors. Everything seemed to be fine on the piwik.php? page.

So, I upgraded to Piwik 0.5

Still no tracking.

Also, I’m now getting an error on my Dashboard:

Fatal error: Cannot use object of type stdClass as array in /path/to/my/webroot/piwik/plugins/Dashboard/Controller.php on line 143

America/New_York is EDT, so you probably don’t have to configure date.timezone if your server has the same TZ.

What version of PHP are you running?

edit: Ok, response headers on your site says PHP 5.1.6.

Problem should disappear if you upgrade to 5.2.1 or higher…