AGAIN: New and old style tracking code


my now 3 year old piwik server and db is still running fine, but i added new pages many month ago. All of my running pages are tracked with the old tracking code:

<!-- 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 Tracking Code -->

Now i added a bunch of new pages and was surprised that the tracking code was changed and is not working for me.
New generated tracking code:

<!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];

  (function() {
    var u=(("https:" == document.location.protocol) ? "https" : "http") + "://";
    _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.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
<!-- End Piwik Code -->

Both codes are used between the body tags.
There are just no hits registered. I opened the page with my phone and from home and also one of the urls was promoted via facebook, which should have brought over a few hundred visits.

I was checking this forum with google and there are a lot of threads with this problem - e.g.:,107465,102624,101608

NONE had any solution for the problem and just died off? Do i have to copy and adjust the old code now myself or is there anything simple iam overlooking?

(Matthieu Aubry) #2

The old tracking code still works, but you may also use the new one if you prefer


yo matt,
maybe i wrote too much for the limited amount of time you seem to have per post - i updated php5 to 5.5 and the apache. does not seem to have an effect. i got another idea though…

edit: sry that i wasted your time, matt. our marketing-people tried to “adapt” the piwik code and broke the script tag. all is well now. thank you anyway