Addition of onclick tracking to one page broke default javascript tracking on entire site?


(Mack) #1

Scenario:
We had Piwik logging traffic normally on a website using the default Javascript code in the footer.
A single page in the site contains a jQuery accordion widget and we wanted to track clicks on each accordion header, so we added an onclick tracking event to each of the

headers:

onclick="javascript:piwikTracker.trackPageView('page_name');"

But now, only the onclick events are being recorded by Piwik – the default footer Javascript is no longer recording hits on any other page, even the pages that do not use the accordion. This has been confirmed in Visitors > Visitor Log. And the default footer Javascript is not throwing errors in any browser:


<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://www.real_domain_name.com/piwik/" : "http://www.real_domain_name.com/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);
tracker = Piwik.getTracker(pkBaseUrl, 1);
tracker.setCookieDomain('*.real_domain_name.com');
tracker.setDomains('*.real_domain_name.com');
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://www.real_domain_name.com/piwik/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->

Any advice will be greatly appreciated!


(Mack) #2

Nevermind . . . found a cut & paste error in the footer javascript. Argh. Feel free to delete this thread.