From: Theo Lindqvist, product manager at Juniper Lane
Re: Where do we lose shoppers?
web_events.csv logs every product view, add-to-cart and purchase on the web shop, with the user, a UTC timestamp and the device. I want a funnel by device: of the sessions that viewed a product, what share added to cart, and of those, what share bought.
There's no session id in the log. Use the usual rule: a new session starts with a user's first event, or when 30 minutes or more have passed since that user's previous event. A session belongs to the device of its first event.
Sessionizing an event log is a classic analyst task and a classic interview question. You'll sort the log, measure gaps within each user, flag session starts, number the sessions with a cumulative sum, and summarize each session before building the funnel.
The trap at every step is letting one user's events leak into another's: every difference and every count has to be per user or per session.