Track logged in users (users with cookie)

First of all, I’m very new to Piwik Pro and analytics, I searched for a solution to this but was unable to find relevant topics or anything useful in the docs.
I have a site with where users can log-in to access specific pages on the site. In analytics, I would like to separate logged-in users from just visitors, and likewise separate page-views and other events for these groups. Is there a way to do that?
I’m assuming there are solutions that someone with no coding background could do, but if not, I could set up a cookie on the site that tracks whether the user is logged in or not, but I also don’t see any way that Piwik Pro allows tracking cookies (but I might be missing something)

Would greatly appreciate the help.

P.S. I believe user groups are managed with dimensions, but dimensions don’t allow checking for cookies (from what I found) and I couldn’t find any other way to check if a user is logged in.

Hi there! Welcome to our community :smile:

First of all, for separating user traffic you can use segments, which let you divide your visitors into smaller groups and analyze them separately in reports and on dashboards. You can learn more on how to set up segments here: Group visitors into segments | Piwik PRO help center.

Using a cookie in a way that you mentioned can definetely be done, but it would require you to write some basic JavaScript code to recognize how the cookie is set and then send this information to Piwik PRO Analytics. This can be done using our custom code tag: Custom code (async) tag | Piwik PRO help center.

The information about whether user is logged in or not can be stored in a custom dimension that belongs to a session scope (Create a custom dimension | Piwik PRO help center, API — Piwik PRO Analytics Suite 17.6 documentation). Based on this dimension you can create segments and divide your users.

Other than that, I would recommend you to look into User ID, which can help you with identifying whether user is logged in and also recognize them across devices. Here is a handy guide on how to set User ID: Set up a user ID | Piwik PRO help center.

1 Like

Thank you so much for the informative reply! This is exactly what I needed.

1 Like