Visits (Sessions)

Tracking how people interact with your site

Intro

Visits (or sessions) tables record how people interact with your website. Visit history is required to derive an attribution model. This attribution model allows us to tie your growth levers to downstream elements of your growth funnel (e.g. signups and revenue). In other words, visit tables empower the "cause" of cause and effect.

Note that we use the term visits and sessions interchangeably; when relating these terms to what happens in real life:

  • A visitor can visit your site multiple times.

  • Each visit (or session) consists of multiple page views.

  • During each page view, a visitor can interact or "do something" zero or more times, which we call events.

We support three methods to consume visit data:

  • Internally modeled "gold" table

  • Segment Pages

  • GA4 BigQuery Export

Internally modeled "gold" table

Many customers already have a source-of-truth table for tracking visits to their site. When available, we prefer to derive any downstream modeling from such a table. However, to ensure compatibility with our systems, the visitstable you provide must adhere to the following schema:

Column Name
Type
Description

visit_id

varchar

Unique identifier of the session

visitor_id

varchar

Identifier of the anonymous visitor associated with this session (some systems call this anonymous_id or user_pseudo_id)

visited_at

timestamp

UTC timestamp of when the session started

user_id

varchar (nullable)

Identifier of the user associated with this session

referring_page_url

varchar (nullable)

Full URL of the referrer

landing_page_url

varchar

Full URL of the landing page on your site, including parameters.

Additional Constraints

The following additional constraints apply to the above table:

  • visit_id is the primary key

We do not explicitly require UTM parameter columns, because we extract these directly from the landing_page_urlcolumn.

While we *highly recommend* that warehouse-native integrations with Roadway have an internal source of truth for visits, this is not always the case. Alternatively, Roadway can build your attribution model by directly consuming Segment's Page table or GA4's BigQuery Export data.

Segment Pages

If you are using Segment's analytics tag, issuing Page calls, and extracting the resulting data to your warehouse, we can consume a view of the resulting table (which is typically called pages,by default). This view should be a subset of columns that obscures any PII; it should expose the following schema:

Column Name
Type
Description

anonymous_id

varchar

Unique identifier of the session

timestamp

timestamp

UTC timestamp of when Page was viewed

user_id

varchar (nullable)

Identifier of the user associated with this session

context_page_referrer

varchar (nullable)

Full URL of the referrer

context_page_url

varchar

Full URL of the landing page on your site, including parameters.

context_page_title

varchar (nullable)

Title of the landing page on your site

context_page_path

varchar

Path of the URL of the landing page on your site

context_campaign_source

varchar (nullable)

UTM source parameter from page URL

context_campaign_medium

varchar (nullable)

UTM medium parameter from page URL

context_campaign_name

varchar (nullable)

UTM name parameter from page URL

context_campaign_content

varchar (nullable)

UTM content parameter from page URL

context_campaign_term

varchar (nullable)

UTM term parameter from page URL

Example SQL
select
    anonymous_id
    , timestamp
    , user_id
    , context_campaign_source
    , context_campaign_medium
    , context_campaign_name
    , context_campaign_content
    , context_campaign_term
    , context_page_url
    , context_page_title
    , context_page_path
    , context_page_referrer
from
    <your_segment_destination_schema>.pages

GA4 BigQuery Export

This method is only for customers who use BigQuery for their warehousing needs, AND have previously established a GA4 BigQuery Export.

If you are using Google Analytics and BigQuery, and you have set up the GA4 BigQuery Export for your own use, we can consume a view of the resulting tables. This view should be a subset relevant to visits (sessions) only, such that it obscures any PII and returns rows only for the session_startevent:

Column Name
Type
Description

event_name

varchar

The GA4 event name; should only be session_start (GA4-supplied)

event_timestamp

integer

GA4 timestamp, as micros since the epoch (GA4-supplied)

user_pseudo_id

varchar

Identifier of the anonymous visitor associated with the visit (GA4-supplied)

user_id

varchar (nullable)

Identifier of the user associated with the visit (GA4-supplied)

batch_page_id

integer

A sequential number assigned to a page that increases for each subsequent page within an engagement (GA4-supplied)

batch_ordering_id

integer

A monotonically increasing number that is incremented each time a network request is sent from a given page (GA4-supplied)

batch_event_index

integer

A number indicating the sequential order of each event within a batch based on their order of occurrence on the device (GA4-supplied)

event_params

record

BigQuery RECORD type that stores nested key-value event parameters, including page_location, `page_referrer`, etc.

Example SQL
select
    event_name
    , event_timestamp
    , user_pseudo_id
    , user_id
    , event_params
    , batch_page_id
    , batch_ordering_id
    , batch_event_index
from
    `analytics_<your_GA4_export_property_id>`.`events_*`
where
    event_name = 'session_start'

For more information on the `<your_GA4_export_property_id>`, see the Google Analytics DIrect Connector Guide.

A Brief Note on Visit Modeling

When provided with Segment or GA4 visit data, Roadway will conduct any sessionization internally, subject to the following rules:

  1. A new visit starts whenever a visitor returns with a new page referrer.

  2. A visitor returns after more than 30 minutes of inactivity.

Last updated