Store user logins

  • 16 March 2023
  • 2 replies

Userlevel 3
Badge +5

Hi all,

I've been looking into the Capture User State via Snapshots documentation, and I can check you use Tealium to capture this type of information.

If I create a 


snapshot will I be able do collect the user login time? I need to know how often our users login. Can I do this with Heap or do I have to integrate our Web App with Tealium too?


Best regards,



Best answer by jonathan 16 March 2023, 21:45

View original

2 replies

Userlevel 5
Badge +3

@bernardo.madeira To answer your question directly, if you want to use `utag_data` (Tealium’s data layer object) you would need to implement Tealium. (If you are a Tealium user, you can use the Tealium integration’s `addEventProperties.custom` mapping to attach this to all events.)

The more general answer, is if you wanted to add some value from a JS object to all events, then 1) you’ll need to expose that data somewhere consistent and 2) either use addEventProperties API or a snapshot on an “any page” event. This will attach to every event the current logged in status of the user.

Whether this solves your problem depends on exactly what outcome you need, and how your product works.

  • Let’s say your app has a 21 day session cookie duration; users may be accessing your product every day but unless they logout, they won’t need to login for weeks. Do you need to know when they physically login, or do you just need to know they had a session in your app?
  • Let’s say you’re an ecommerce store; users can be logged in or out but the experience is otherwise largely the same (same domains, same paths). Do you need to know when the user logged in, or do you just need to know their logged in status while browsing?

If you want a clean “user transitioned from logged out to logged in at this specific time” then emitting a “Login” event is the best approach. 

If you have product urls that are easily targetable as being “logged in”, you could use that as a proxy for “user had a session in our app”. We do that in Heap, as between the domain ( and the path structure (starts with /app/) it’s easy to tell what activity is while logged into the app and what is not logged in. 

And if you want to know the current state of the user, attaching a general property to all events is the way to go. You could use this in a funnel to show users logging in (pageview where loggedin_status = false > pageview where loggedin_status = true) or as a count of users who had a session while logged in (number of sessions with pageviews where loggedin_status = true).


Userlevel 3
Badge +5

Hi Jonathan!

Regarding tracking Logins we don't want to subscribe any additional software. Which is what the Tealium solution looks like. I need to know how to track logins in Heap. I would like to know whch Heap feature could help us tracking this via platform URLs.

We need to create a specific event to track user login and when did it happen. What's the best way to do this with Heap?