Purpose of the web page context

I was recently asked by a client what the purpose of the web page context was so thought I’d share it here.

The web page context is a unique ID that is generated with every new page load event, and it sent with every subsequent in page event that occurs on that page. This means that at your data modeling step, it is very easy to group events by the page view they occurred on, and build up a picture of the different steps in a user journey, as compromised the different web page that they navigated to and the different actions that they performed on each of those pages.

Before we introduced a web page context, when we aggregated events at the page view level, we made the following assumption:

The event occurs on the last web page view for the specific URL that was recorded with the event

We would use a window function to determine what that page view event was.

There are two issues with this approach:

  1. It doesn’t necessarily give the right answer. I can have the same URL open on two tabs in my browser - tab A, which I open first, and tab B, that I open second. If I then perform an add-to-basket on tab A, the above approach will assume it occurred on tab B.
  2. It’s computationally expensive. Window functions are costly to run and hard to read and reason about

The web page context makes the modeling step easier, and means we can unambiguously identify what page an event occurred on. This is particularly important when tracking user journeys in scenarios where a user opens and engages with multiple tabs simultaneously - this is very common in retail when users compare different products or services, with one in each tab.