Sunday, April 3, 2016

Piwik track which user access which page

Leave a Comment

I want to use Piwik to trace which user stays on which page in my rails app but I cannot figure out how to trace it. I added a custom variable (page scope) but in Piwik I only see the user_id and its count of visits but not which pages. Also, I got url based view but not for which user. Anybody knows how to deal with this? Also I can not use custom Dimension because my Piwik version is older and I can not upgrade it now. I tried setUserId option as well but no luck.

My code :

<script type="text/javascript">    var _paq = _paq || [];   _paq.push(['setCustomVariable', 1, "user_id", "<%= current_user.id %>", "page" ]);   _paq.push(['setUserId', '<%= current_user.id %>']);   _paq.push(['trackPageView']);   _paq.push(['enableLinkTracking']);   _paq.push(['enableHeartBeatTimer']);    (function() {     var u="//myserver/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.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);   })(); </script> <noscript><p><img src="//myserver/piwik/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript> <!-- End Piwik Code --> 

0 Answers

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment