Multiple Pages + Ajax + Piwik integration
Hello,
I'm trying to integrate PIWIK Statistics in a Jquery Mobile driven Page.
Page consists of about 10 different pages - all JQuery Mobile Ajax loaded.
For Piwik I have to fire a JS call when a new Page is called.
I already tried it this way:
- $('[data-role=page]').live('pageshow', function (event, ui) {
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
piwikTracker.setDocumentTitle(document.domain + "/" + document.title);
hash = location.hash;
if (hash) {
piwikTracker.trackPageView(hash.substr(1));
} else {
piwikTracker.trackPageView();
}
piwikTracker.enableLinkTracking();
} catch(err) {
}
});
The Problem with this is - everything within the pageshow hook is executed several times. (excactly the amount of pages I preload)
But I'm not sure why it's executed for every page - thought it's only executed once for every called page that is shown right now?
URL of the page: http://mobile.atp-sf.at.ex.ortsinfo.at/
Hope someone can help me on this! :)