AGAIN: New and old style tracking code


#1

Hi,
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) ? "https://xxx.xx.xx.xxx/piwik/" : "http://xxx.xx.xx.xxx/piwik/");
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.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://xxx.xx.xx.xxx/piwik/piwik.php?idsite=1" 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 || [];
  _paq.push(["trackPageView"]);
  _paq.push(["enableLinkTracking"]);

  (function() {
    var u=(("https:" == document.location.protocol) ? "https" : "http") + "://xxx.xx.xx.xxx/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.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
  })();
</script>
<!-- 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.:
http://forum.piwik.org/read.php?2,107465
http://forum.piwik.org/read.php?2,102624
http://forum.piwik.org/read.php?2,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


#3

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