Async Tracking Issue (1.6)


#1

Hello,

I’ve been working with Piwik for the past week (so I’m still new at it), attempting to track user activity on my site. Prior to adding asynchronous tracking, everything was working. Mainly I am using trackPageView and setCustomData in the Javascript API.

Under async tracking, the dashboard is not displaying any information. The last activity recorded in Piwik was when I wasn’t using asynchronous tracking. I’ve read a lot of forum posts and everything on the website about asynchronous tracking but I just can’t get it working. Please help me! Thank you.

I added the tracker as follows (yes my Piwik is on localhost):


<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
(function(){
    var u=(("https:" == document.location.protocol) ? "https://localhost/piwik" : "http://localhost/piwik");
    _paq.push(['setSiteId', 6]);
    _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>
<!-- End Piwik Code -->

and call the tracker functions as follows:


_paq.push(['trackPageView', 'Clicked Log-In Button']);

There are no Javascript errors on my Firebug, and I’m running Firefox 3.6 (old I know).

EDIT: I’m updating my Firefox and Firebug


(vipsoft) #2

It’ll work better with a trailing slash on the paths, i.e., “…localhost/piwik/”

(Edit: Sorry, I had to play with the formatting so it displays properly in the forum.)


var u=(("https:" == document.location.protocol) ? "https:"+"//localhost/piwik/" : "http:"+"//localhost/piwik/" ) ;


#3

I coulda sworn I had that at one point…

But after copying and pasting your code it works, so thank you!!