Page and screen views
Page and screen view events are important events for tracking the navigation within your app. Page views are tracked on Web and screen views on mobile.
Page view events
Page view tracking is used to record views of web pages.
Under the hood, the page view events are not self-describing events but standard events with the event type pv
.
The tracked information includes the page URL and title.
You can see an overview of the page fields in the atomic events table here.
Additionally, the page view is assigned an identifier – the page view ID.
This is tracked in the web_page
context entity in that page view event and for all events on that page.
Schema for a web page context
Schema URI:iglu:com.snowplowanalytics.snowplow/web_page/jsonschema/1-0-0
Web | Mobile | Tracked automatically |
---|---|---|
✅ | ❌ | ✅ |
👀 Example
{
"id": "024629F0-6B9B-440C-82D4-DB3CF9D31533"
}
📃 Schema properties definition
- Table
- JSON schema
Property | Type | Description | Required? |
---|---|---|---|
id | "string" | ✅ |
{
"description": "Schema for a web page context",
"properties": {
"id": {
"type": "string",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"id"
],
"self": {
"vendor": "com.snowplowanalytics.snowplow",
"name": "web_page",
"format": "jsonschema",
"version": "1-0-0"
},
"$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#"
}
How to track?
See the documentation for the JavaScript tracker to learn how to track a page view event.
Screen view events
Screen view events are the equivalent of the page view events for mobile apps. In contrast with page view events, screen view events are self-describing events.
Schema for a screen view event
Schema URI:iglu:com.snowplowanalytics.mobile/screen_view/jsonschema/1-0-0
Web | Mobile | Tracked automatically |
---|---|---|
❌ | ✅ | Depends on the app framework |
👀 Example
{
"name": "Screen 2",
"type": "feed",
"id": "024629F0-6B9B-440C-82D4-DB3CF9D31533",
"previousName": "Screen 1",
"previousId": "86ffd23c-b844-4ed4-aae9-7796b8b6f1e4",
"previousType": "feed",
"transitionType": "push"
}
📃 Schema properties definition
- Table
- JSON schema
Property | Type | Description | Required? |
---|---|---|---|
name | "string" | The name of the screen viewed. | ✅ |
type | "string" | The type of screen that was viewed e.g feed / carousel. | ❌ |
id | "string" | An ID from the associated screenview event. | ✅ |
previousName | "string" | The name of the previous screen. | ❌ |
previousId | "string" | A screenview ID of the previous screenview. | ❌ |
previousType | "string" | The screen type of the previous screenview. | ❌ |
transitionType | "string" | The type of transition that led to the screen being viewed. | ❌ |
{
"description": "Schema for a screen view event",
"properties": {
"name": {
"type": "string",
"description": "The name of the screen viewed."
},
"type": {
"type": "string",
"description": "The type of screen that was viewed e.g feed / carousel."
},
"id": {
"type": "string",
"format": "uuid",
"maxLength": 36,
"description": "An ID from the associated screenview event."
},
"previousName": {
"type": "string",
"description": "The name of the previous screen."
},
"previousId": {
"type": "string",
"format": "uuid",
"description": "A screenview ID of the previous screenview."
},
"previousType": {
"type": "string",
"description": "The screen type of the previous screenview."
},
"transitionType": {
"type": "string",
"description": "The type of transition that led to the screen being viewed."
}
},
"additionalProperties": false,
"type": "object",
"required": [
"name",
"id"
],
"minProperties": 2,
"self": {
"vendor": "com.snowplowanalytics.mobile",
"name": "screen_view",
"format": "jsonschema",
"version": "1-0-0"
},
"$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#"
}
❓ How to query the event in the warehouse?
- Snowflake
- BigQuery
- Databricks
- Redshift & Postgres
select
unstruct_event_com_snowplowanalytics_mobile_screen_view_1 screen_view_1
from
atomic.events
where
events.collector_tstamp > getdate() - interval '1 hour'
and events.event = 'unstruct'
and events.event_name = 'screen_view'
and events.event_vendor = 'com.snowplowanalytics.mobile'
select
unstruct_event_com_snowplowanalytics_mobile_screen_view_1_0_0
from
PIPELINE_NAME.events events
where
events.collector_tstamp > timestamp_sub(current_timestamp(), interval 1 hour)
and events.event = 'unstruct'
and events.event_name = 'screen_view'
and events.event_vendor = 'com.snowplowanalytics.mobile'
select
unstruct_event_com_snowplowanalytics_mobile_screen_view_1
from
atomic.events events
where
events.collector_tstamp > timestampadd(HOUR, -1, current_timestamp())
and events.event = 'unstruct'
and events.event_name = 'screen_view'
and events.event_vendor = 'com.snowplowanalytics.mobile'
and unstruct_event_com_snowplowanalytics_mobile_screen_view_1 is not null
select
"screen_view_1".*
from
atomic.events events
join atomic.com_snowplowanalytics_mobile_screen_view_1 "screen_view_1"
on "screen_view_1".root_id = events.event_id and "screen_view_1".root_tstamp = events.collector_tstamp
where
events.collector_tstamp > getdate() - interval '1 hour'
and "screen_view_1".root_tstamp > getdate() - interval '1 hour'
and events.event = 'unstruct'
and events.event_name = 'screen_view'
and events.event_vendor = 'com.snowplowanalytics.mobile'
After a screen view event is tracked, the tracker attaches a screen context entity to all the events tracked by the tracker reporting the last (and probably current) screen visible on device when the event was tracked.
Schema for a context that represents information pertaining to the current screen being viewed when an event occurs.
Schema URI:iglu:com.snowplowanalytics.mobile/screen/jsonschema/1-0-0
Web | Mobile | Tracked automatically |
---|---|---|
❌ | ✅ | ✅ |
👀 Example
{
"name": "Screen 2",
"type": "feed",
"id": "024629F0-6B9B-440C-82D4-DB3CF9D31533"
}
📃 Schema properties definition
- Table
- JSON schema
Property | Type | Description | Required? |
---|---|---|---|
name | "string" | The name of the screen viewed. | ✅ |
type | "string" | The type of screen that was viewed e.g feed / carousel. | ❌ |
id | "string" | An ID from the associated screenview event. | ✅ |
viewController | "string" | iOS specific: class name of the view controller. | ❌ |
topViewController | "string" | iOS specific: class name of the top level view controller. | ❌ |
activity | "string" | Android specific: name of activity. | ❌ |
fragment | "string" | Android specific: name of fragment. | ❌ |
{
"description": "Schema for a context that represents information pertaining to the current screen being viewed when an event occurs.",
"properties": {
"name": {
"type": "string",
"description": "The name of the screen viewed."
},
"type": {
"type": "string",
"description": "The type of screen that was viewed e.g feed / carousel."
},
"id": {
"type": "string",
"format": "uuid",
"maxLength": 36,
"description": "An ID from the associated screenview event."
},
"viewController": {
"type": "string",
"description": "iOS specific: class name of the view controller."
},
"topViewController": {
"type": "string",
"description": "iOS specific: class name of the top level view controller."
},
"activity": {
"type": "string",
"description": "Android specific: name of activity."
},
"fragment": {
"type": "string",
"description": "Android specific: name of fragment."
}
},
"additionalProperties": false,
"type": "object",
"required": [
"name",
"id"
],
"minProperties": 2,
"self": {
"vendor": "com.snowplowanalytics.mobile",
"name": "screen",
"format": "jsonschema",
"version": "1-0-0"
},
"$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#"
}
How to track?
- Documentation for the iOS and Android trackers.
- Documentation for the React Native tracker.
- Documentation for the Flutter tracker.
Use in modeling
Page and screen view events are used by our dbt packages to model web and mobile data. The Snowplow Web Package as well as the Snowplow Mobile Package use them to provided aggregated page and screen tables.