I've got a problem. I want to track the users of my mobile Web App with Piwik, but because of AJAX only the views on the first page are tracked. So I tried to use the pageinit function to load the Piwik tracking script on every page. But this also fails (Piwik also only tracks the first page). I have bound in the script in the -section. What I am doing wrong?
<script type="text/javascript">
$(#ac).on('pageinit', function(){
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://url/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 -->