Quantcast
Channel: Piwik Forums - Support & Bugs
Viewing all articles
Browse latest Browse all 13117

Re: Problems tracking Ajax clicks with jQuery

$
0
0
Thanks for the quick reply. I just tried setUrl and setDocumentTitle and neither seems to work for me. Here's the test code:

jQuery('#artLink').click(function(e) {
e.preventDefault();
_paq.push(['setDocumentTitle', 'art']);
});

and

jQuery('#artLink').click(function(e) {
e.preventDefault();
_paq.push(['setUrl', 'http://myDomain.com/art']);
});

Neither registers a click at all in Piwik, unless I also add the trackPageView line:

jQuery('#artLink').click(function(e) {
e.preventDefault();
_paq.push(['trackPageView']);
_paq.push(['setDocumentTitle', 'art']);
});

But then the click just registers as the current page, not "art"

I'm also confused because the documentation in the link you posted does list a parameter for trackPageView:

trackPageView([customTitle])- Log visit to this page

I must be missing some step in the process, maybe someone who has gotten this to work would be willing to post their code?

Thanks,
David

Viewing all articles
Browse latest Browse all 13117

Trending Articles