User Profiles Analytics


#1

First off, awesome tool!

How would I go about setting up Piwik to keep analytics on user profiles (analytics for each user session)? I would like to provide each one of my registered users on my site a glance at their own profile analytics. This is challenging because there is only one page that the Piwik javascript is contained in, which only would record analytics for the page and not for each user profile.

I’m assuming I would have to modify the javascript a bit? Any info would be greatly appreciated.


#2

I may have found the answer.

If you track one domain sub directories or pages in different Piwik websites

By default, Piwik uses only one cookie for a domain name, all its pages and sub directories.

In the case where you track a subdirectory in its own Piwik website, if a visitor visits more than a few sub directories, this will cause some inaccuracy in a few reports: Time on site, Count of visits, Conversion referrer, Returning and new visitors. In this use case, you can ensure your reports stay accurate by creating a different cookie for each sub path you are tracking in different Piwik websites. The function setCookiePath() is used to set the Cookie path.

For example, if your website has user profiles, you could track each user profile page analytics in a unique Piwik website. In the main domain homepage, you would use the default Tracking code.
[…]
tracker = Piwik.getTracker(pkBaseUrl, X); // idSite = X for the Homepage
tracker.trackPageView();
[…]

In the /user/MyUsername page, you would write:
[…]
// The idSite Y will be different from other user pages
tracker = Piwik.getTracker(pkBaseUrl, Y);
tracker.setCookiePath(’/user/MyUsername’);
tracker.trackPageView();
[…]