Skip to main content

Retention

info

View this example in Motif here.

This example calculates weekly retention for Motiflix users.

Video

SOL query

// Reduce users sequences down to the key retention events
match split KeyEvents(signup | watch_start)
replace SEQ with KeyEvents
combine

// Add a dimension to each user sequence with their signup week
match signup
set start_week = time_bucket(1w, signup)

// Split user sequences into their active weeks
match split ActiveWeek()+
if time_bucket(1w, SUFFIX[0]) > time_bucket(1w, ActiveWeek[-1])

// For each active week, calculate its distance from the start week
set week = (time_bucket(1w, ActiveWeek[0]) - start_week) / 1w

// Limit our plot to a user's first 10 weeks, and to cohorts in Q1
filter week<=10 and start_week between '2024-01-01' and '2024-03-30'

Key steps

  1. Select the events relevant to retention, and remove all other events.
match split KeyEvents(signup | watch_start)
replace SEQ with KeyEvents
combine
  1. Calculate the start week for every user using their signup event.
match signup
set start_week = time_bucket(1w, signup)
  1. Split the pared down user sequences into active weeks.
match split ActiveWeek()+
if time_bucket(1w, SUFFIX[0]) > time_bucket(1w, ActiveWeek[-1])
  1. Calculate the index of the active week relative to the start week. Limit our analysis to a user’s first 10 weeks, and users that started in Q1.
set week = (time_bucket(1w, ActiveWeek[0]) - start_week) / 1w
filter week<=10 and start_week between '2024-01-01' and '2024-03-30'
  1. Plot the week, by the count, normalized by the largest bin.

retention