Solved

How I split apart signed in events from signed out events in Heap?

  • 16 May 2023
  • 2 replies
  • 32 views

One challenge I am having is that with our application, you can be signed in or signed out, and we want to view metrics for things like sessions for just people signed in versus all events. How can we filter to just events where the user is signed in? 

icon

Best answer by dlad 19 May 2023, 22:25

View original

2 replies

Userlevel 4
Badge +2

Hi Dillon! 

This is the textbook use case for Heap’s addEventProperties() API. Once you call the API, all of that user’s event data will contain the key-value pairs contained in the API call going forward, until overwritten with another AEP() call or removed via removeEventProperty() or clearEventProperties(). 

In practice, you should add the property {“logged_in”:”true”}; as part of a user’s authentication process, so that on all future events the user has “logged_in”:”true” as an ever property.

On non-logged-in or non-authenticated pages, run heap.clearEventProperties() so the user doesn’t have this property on non-authenticated event data.

Make the calls immediately after heap.load(ENVID);

thanks!

Reply