Page view and user tables
Page views and users are the two tables every implementation needs.
Page views
A page view is one visit to a page, with the attribution parameters and referrer Roadway needs to model the journey.
Roadway accepts page views from Segment, Google Analytics 4, PostHog, or a custom table.
Schema
Whatever source you use, Roadway expects this shape.
| Column | Type | Description | Required |
|---|---|---|---|
visitor_id |
varchar | Visitor identifier. Segment anonymous_id, GA4 user_pseudo_id, or equivalent |
Yes |
page_viewed_at |
timestamp | UTC time of the page view | Yes |
user_id |
varchar | Authenticated user ID. NULL for anonymous visitors |
Recommended |
landing_page_url |
varchar | Full URL including query parameters | Yes |
referring_page_url |
varchar | Full referring URL. NULL for direct traffic |
No |
city |
varchar | City | No |
region |
varchar | Region (state in the U.S.) | No |
country |
varchar | Country | No |
continent |
varchar | Continent | No |
Source options
Option 1: Segment
Provide your complete Segment pages table. See Segment in your warehouse and Segment's pages table documentation.
Option 2: Google Analytics 4
Provide GA4 page_view events from the GA4 BigQuery export (required). See GA4 BigQuery export.
The mapping:
| Roadway column | GA4 export field |
|---|---|
visitor_id |
user_pseudo_id |
page_viewed_at |
TIMESTAMP_MICROS(event_timestamp) |
user_id |
user_id |
landing_page_url |
event_params where key = 'page_location' |
referring_page_url |
event_params where key = 'page_referrer' |
city, region, country, continent |
geo.city, geo.region, geo.country, geo.continent |
Option 3: PostHog
Roadway reads $pageview events from a PostHog batch export, set up through the in-app PostHog connector. Roadway uses $device_id, falling back to distinct_id, as visitor_id. Page views must come from posthog-js in the browser. See Track users with PostHog.
Option 4: custom data source
Roadway recommends Segment or GA4 schemas. Use a custom table only if you run your own tracking, or model data downstream of a tracking tool.
CREATE TABLE <your_schema>.page_views (
visitor_id VARCHAR NOT NULL, -- your visitor identifier
page_viewed_at TIMESTAMP NOT NULL, -- UTC timestamp of the page view
user_id VARCHAR, -- user identifier (nullable)
landing_page_url VARCHAR NOT NULL, -- full URL with parameters
referring_page_url VARCHAR, -- referring URL (nullable)
city VARCHAR,
region VARCHAR,
country VARCHAR,
continent VARCHAR
);
Example of a custom model built from the GA4 export (BigQuery):
CREATE OR REPLACE VIEW `your-project.roadway_source.page_views` AS
SELECT
user_pseudo_id AS visitor_id,
TIMESTAMP_MICROS(event_timestamp) AS page_viewed_at,
user_id AS user_id,
(SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'page_location') AS landing_page_url,
(SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'page_referrer') AS referring_page_url,
geo.city, geo.region, geo.country, geo.continent
FROM `your-project.analytics_123456789.events_*`
WHERE event_name = 'page_view';
Validation
| Rule | Check |
|---|---|
visitor_id is never null |
COUNT(*) WHERE visitor_id IS NULL is zero |
page_viewed_at is never null and in UTC |
Same |
landing_page_url is never null and well-formed |
Same |
(visitor_id, page_viewed_at) is unique |
GROUP BY ... HAVING COUNT(*) > 1 returns no rows |
| Anonymous traffic exists | Many rows have user_id IS NULL |
| Volume is plausible | Expect roughly 10 to 1,000 times more page views than users |
Other analytics tools
Roadway reads page views from Segment, GA4, PostHog or the Roadway tag. For other tools, model the table yourself.
Users
One row per person who uses your product.
Roadway uses it to count users and link visits to revenue and leads.
Roadway uses three kinds of user data:
- Your internal user ID (
user_id) - Sign-up dates
- Segmentation dimensions, such as persona or use case
Roadway doesn't use PII, such as name, address, phone number, or email, even for users.
Schema
| Column | Type | Description | Required |
|---|---|---|---|
user_id |
varchar | Unique user ID. Must match the user_id in your page views. Primary key |
Yes |
signed_up_at |
timestamp | UTC time the user registered. This is the conversion event for attribution | Yes |
<custom dimensions> |
varchar or boolean | See Custom dimensions | No |
Constraints: user_id is the primary key. Don't put PII in custom dimensions.
Source options
Option 1: Segment
Provide your Segment identifies table. Roadway uses user_id and timestamp for the sign-up time. The link to visits comes from user_id on page views. Custom dimensions need Roadway to map them for your workspace; tell Roadway which traits you want.
- The first
identifycall peruser_idis the sign-up. - Later
identifycalls for the same user don't change the sign-up time.
See Send Segment identify calls.
Option 2: Google Analytics 4
Use GA4 sign-up events, by default sign_up. Requirements:
sign_upevents are tracked, or you tell Roadway your custom event name.- User ID tracking is enabled. See Set user ID in GA4 with gtag.js.
- Multiple sign-up events for the same user are deduplicated by taking the earliest timestamp.
Sign-up events must carry the GA4 User-ID (set with gtag('config', ..., { user_id }) or set), which appears as the top-level user_id in the export. Roadway drops sign-up events where it's empty. See Send a sign_up event.
Geographic and device information is captured automatically by GA4.
Option 3: PostHog
Roadway uses the sign-up event you name during setup, or the first $identify for each user, from the PostHog batch export. See Track users with PostHog.
Option 4: custom table
CREATE TABLE your_schema.users (
user_id VARCHAR PRIMARY KEY, -- unique user identifier
signed_up_at TIMESTAMP NOT NULL, -- UTC sign-up timestamp
-- optional custom dimensions
custom_user_dimension_1 VARCHAR,
custom_user_dimension_2 VARCHAR
);
Validation
| Rule | Meaning |
|---|---|
Unique user_id |
Each user appears once |
Non-null user_id and signed_up_at |
Every row is complete |
| Valid UTC timestamps | |
| ID consistency | user_id values match those in page views, revenue, and the MMP export |