Blog

Purpose of the Web Page Context in Snowplow

By
Snowplow Team
&
January 13, 2025
Share this post

Snowplow’s web page context is a crucial feature for accurately grouping events and reconstructing user journeys across multiple page views. This post explores the purpose of the web page context and how it simplifies data modeling for Snowplow users.

Q: What is the web page context in Snowplow?

The web page context is a unique identifier generated with every new page view event. This ID is then sent with every subsequent event that occurs on that specific page, allowing data modelers to accurately associate in-page interactions (e.g., clicks, form submissions) with the page view they occurred on.

Q: Why was the web page context introduced?

Prior to the introduction of the web page context, Snowplow users had to rely on assumptions to link in-page events to the correct page view. The typical approach was to associate the event with the last page view URL. However, this method had two key limitations:

  • Ambiguity in Multiple Tabs: If a user had the same URL open in multiple tabs, the logic would incorrectly associate in-page events with the most recent tab, regardless of where the interaction occurred.

  • High Computational Overhead: Window functions were used to identify the relevant page view for each event, increasing query complexity and processing time.

Q: How does the web page context improve data modeling?

The web page context streamlines data modeling by:

  • Eliminating Ambiguity: Events can now be definitively tied to the page view they occurred on, regardless of tab order or URL similarities.

  • Reducing Computational Load: By removing the need for window functions, the web page context reduces the complexity of queries, resulting in faster and more efficient data processing.

Q: How can I use the web page context in my data models?

In data models, the web page context is typically included in Snowplow’s standard page view and event tables as a distinct field (web_page_id). Data engineers can use this field to:

  • Group Events by Page View: Construct session or user journey flows by grouping events by web_page_id.

  • Analyze Multi-Tab Behavior: Identify interactions across multiple tabs by comparing web_page_id values across events.

Example Query: Grouping Events by Page View

To aggregate events by page view, run the following query:

SELECT web_page_id, COUNT(*) AS event_count
FROM atomic.events
GROUP BY web_page_id
ORDER BY event_count DESC;

Final Thoughts

The web page context is a powerful addition to Snowplow’s tracking framework, enabling precise event-to-page associations while reducing computational overhead. For data teams tracking complex user journeys involving multiple tabs or interactions on the same URL, leveraging the web page context can significantly enhance data accuracy and analysis capabilities.

Subscribe to our newsletter

Get the latest content to your inbox monthly.

Get Started

Whether you’re modernizing your customer data infrastructure or building AI-powered applications, Snowplow helps eliminate engineering complexity so you can focus on delivering smarter customer experiences.