Skip to main content

Behavioral segmentation

info

View this example in Motif here.

This examples calculates summary metrics at the session and user level that are used to find and record two categories of user segments: binge watchers and casual watchers.

Video

SOL query

// Split user sequences into sessions with an hour or more in between
match split Session()+
if duration(Session[-1], SUFFIX[0]) > 1h

// Count watch_ends per session by splitting, then recombining with a calculation
match split watch_end
combine session_movies_watched = max(split_count)

// Re-combine sessions into users, calculating the average watches per session
combine avg_session_movies = avg(session_movies_watched)

// Assign a dimension to the sequence called segment based on the calculated average
set segment = if(avg_session_movies > 1.5, "binge", "casual")

Key steps

  1. The watch_end event is the key behavior we’re considering, and we do a match split because we’re focused on how often that happens.
match split watch_end
  1. After splitting the session by watch_end, we recombine to get a count of movies watched in each session.
match split watch_end
combine session_movies_watched = max(split_count)
  1. Running another combine will collapse our sessions back to the user level, where we’re calculating the average number of movies watched in each session.
combine avg_session_movies = avg(session_movies_watched)
  1. We plot this value to see if there are any natural segments, and we see that there is a natural split at 1.5 between what appear to be casual watchers (less than 1.5) and binge watchers (greater than 1.5).

    behavioral segmentation

  2. We save the user’s segment as a sequence dimension, labeling their categories.

set segment = if(avg_session_movies > 1.5, "binge", "casual")