Recording Logged-In Sessions in Google Analytics

Chris Vu
Sparkline
Published in
2 min readJun 10, 2020

What happens when the users log out?

One popular use of session-scoped custom dimension is to record logged-in user info. For example:

  • User ID (empty means not logged in)
  • Login Status (values can be logged in / not logged in)

However, we need to ask the question — What happens when the user manually logs out during a session? Should the custom dimension value be updated?

When it comes to recording logged-in user info, we need to ask the right questions:

  • Are we trying to find out the LAST login status of each session?
    In this case then yes, you need to update the session-scoped custom dimension value on every hit, including when the user logs out. To avoid confusion you may also want to rename the custom dimension name to, for example, Last Login Status or Latest Login Status
  • Are we trying to find out if the sessions are from logged-in users?
    In this case, you need to do a few things to make things very clear and easy to understand for everyone using the same GA property:
    (1) Name the session-scoped custom dimension to something like Is Logged In or Is Member.
    (2) When the user logs in or is already persistently logged in, update the custom dimension value to something like “Yes”, “Y”, or “1”. Otherwise we can leave the value empty (undefined).
    (3) This is the important part — When the user manually logs out, do NOT update the custom dimension value. That way, you retain the value of “Is Member”.

The takeaway is that you need to remember how session-scoped dimensions work and to ask the right questions in order to get the business insights that you need.

Sparkline aims to provide data accuracy, comprehension and consolidation, and most importantly, tangible insights for businesses. Get in touch if you’d like to learn more.

--

--

Chris Vu
Sparkline

How did my life bring me to this point being a technical consultant in digital analytics and optimization, I have no idea…