I wonder how I can make piwik track ajax requests. There is an API, but I don't understand what I must do exactly, to see ajax loaded pages in the dashboard.
perhaps this:
_paq.push([ 'API_method_name', parameter_list ]);
Where should I place this (globally or for every ajax call) and what are the right API_method_name
and parameter_list
?
Thanks for help
I found Event Tracking .
_paq.push(['trackEvent', 'Photo Viewer', href]);
Which I call in my ajax function. It shows arrows in the dashboard.
For those who are a bit newer at web development, here's the detailed explanation:
Add the piwik tracking code to the page head as usual, then add the following in the html link which loads the ajax content:
onclick="javascript:_paq.push(['trackEvent', 'NavMenu', 'CV']);"
So, the full ajax link that you wish to track, in context might look like this:
<li class="cv"><a href="./main/cv.html" onclick="javascript:_paq.push(['trackEvent', 'NavMenu', 'CV']);">CV</a></li>
"NavMenu" and "CV" should be changed according to your links & preferences.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.