Skip to main content
22 min read

Query Studio Schema Reference

Complete reference for all queryable tables available in Zenovay Query Studio. Use this guide to explore the database schema, understand column types, and write accurate SQL queries.

All queries must include WHERE website_id = 'your-website-id' to scope results to your website. Queries without this filter will be rejected.

Query Studio enforces a maximum of 1,000 rows per query and a 10-second timeout. Only SELECT statements are allowed — all write operations (INSERT, UPDATE, DELETE, DROP, etc.) are blocked.


Core Analytics

visitors

Individual visitor records with geolocation, device information, UTM tracking parameters, and behavioral engagement scores. This is the primary table for granular visitor-level analysis.

ColumnTypeDescription
iduuidUnique visitor record identifier
website_iduuidWebsite this visitor belongs to
visitor_idtextAnonymized visitor identifier (hashed)
page_urltextFull URL of the page visited
landing_pagetextFirst page the visitor landed on
referrertextReferring URL that brought the visitor
country_codevarcharISO 3166-1 alpha-2 country code (e.g., US, GB)
country_namevarcharFull country name (e.g., United States)
cityvarcharCity name from IP geolocation
device_typetextDevice category: desktop, mobile, or tablet
browservarcharBrowser name (e.g., Chrome, Firefox, Safari)
osvarcharOperating system (e.g., Windows, macOS, iOS)
utm_sourcevarcharUTM source parameter (e.g., google, newsletter)
utm_mediumvarcharUTM medium parameter (e.g., cpc, email, organic)
utm_campaignvarcharUTM campaign name
channelvarcharAttributed marketing channel (e.g., Organic Search, Direct, Social)
had_interactionbooleanWhether the visitor interacted with the page (clicks, scrolls, etc.)
is_returning_visitorbooleantrue if the visitor has been seen before
time_on_pageintegerTime spent on the page in seconds
scroll_depth_percentageintegerMaximum scroll depth reached (0-100)
value_scoreintegerComputed engagement score (0-100) based on behavior
conversion_eventvarcharName of the conversion event triggered, if any
conversion_valuenumericMonetary value associated with the conversion
visited_attimestamptzTimestamp when the visit occurred

analytics_daily

Pre-aggregated daily statistics for fast dashboard queries. Use this table instead of visitors when you need daily summaries — it is significantly faster for date-range reports.

ColumnTypeDescription
website_iduuidWebsite identifier
datedateThe calendar date for this aggregate
visitorsintegerTotal visitor count for the day
page_viewsintegerTotal page views for the day
unique_visitorsintegerCount of unique visitors
sessionsintegerNumber of distinct sessions
avg_session_durationintegerAverage session duration in seconds
bounce_ratenumericBounce rate as a decimal (e.g., 0.45 = 45%)
top_countriesjsonbTop countries by visitor count
top_devicesjsonbDevice type breakdown
top_browsersjsonbBrowser usage breakdown
top_referrersjsonbTop referring sources
top_pagesjsonbMost visited pages

JSONB columns like top_countries can be queried using the -> (returns JSON) and ->> (returns text) operators. Example: top_countries->0->>'country' returns the top country name.

page_views

Individual page view events with performance and engagement metrics. Each row represents a single page load by a visitor within a session.

ColumnTypeDescription
website_iduuidWebsite identifier
visitor_iduuidReference to the visitor
session_iduuidSession this page view belongs to
page_urltextFull URL of the page
page_titletextHTML title of the page
page_pathtextURL path without domain (e.g., /pricing)
load_time_msintegerPage load time in milliseconds
time_on_page_secondsintegerTime spent on this page in seconds
scroll_depth_percentageintegerMaximum scroll depth reached (0-100)
clicks_countintegerNumber of clicks on this page
had_interactionbooleanWhether meaningful interaction occurred
timestamptimestamptzWhen the page view occurred

live_visitors

Currently active visitors on your website. This table is updated in real-time and reflects visitors who have been active within the last few minutes.

ColumnTypeDescription
website_iduuidWebsite identifier
visitor_iduuidVisitor identifier
current_page_urltextPage the visitor is currently viewing
landing_pagetextFirst page of the current session
pages_viewedintegerNumber of pages viewed in this session
device_typevarcharDevice category
browservarcharBrowser name
country_namevarcharCountry of the visitor
channelvarcharTraffic channel attribution
is_activebooleanWhether the visitor is still actively browsing
is_new_visitorbooleantrue if this is the visitor's first session

Revenue & Payments

payments

Payment transactions synced from connected payment providers (Stripe, LemonSqueezy, Polar). Each row represents a single transaction.

ColumnTypeDescription
website_iduuidWebsite identifier
amountnumericTransaction amount in the specified currency
currencyvarcharISO 4217 currency code (e.g., USD, EUR)
statusvarcharPayment status: succeeded, pending, failed, refunded
providervarcharPayment provider: stripe, lemonsqueezy, polar
marketing_channelvarcharAttributed marketing channel for this payment
utm_sourcevarcharUTM source tied to this transaction
customer_emailvarcharCustomer email address
customer_namevarcharCustomer display name
created_attimestamptzWhen the payment was created

revenue_attribution

Revenue attributed to marketing channels over defined time periods. Use this table for channel ROI analysis and marketing performance reporting.

ColumnTypeDescription
website_iduuidWebsite identifier
period_startdateStart date of the attribution period
period_enddateEnd date of the attribution period
marketing_channelvarcharMarketing channel name
utm_sourcevarcharUTM source for this attribution
total_revenuenumericTotal revenue attributed to this channel
transaction_countintegerNumber of transactions
unique_customersintegerCount of unique paying customers
conversion_ratenumericConversion rate as a decimal

identified_users

Known users who have been identified via the visitor identification API. Includes subscription status and lifetime revenue data.

ColumnTypeDescription
website_iduuidWebsite identifier
emailvarcharUser email address
namevarcharUser display name
total_revenuenumericLifetime revenue from this user
subscription_statusvarcharCurrent status: active, canceled, past_due, trialing
subscription_planvarcharPlan name (e.g., Pro, Enterprise)
total_sessionsintegerTotal number of sessions
first_seen_attimestamptzWhen the user was first identified
last_seen_attimestamptzMost recent activity timestamp

Goals & Funnels

custom_goals

Goal definitions configured in the dashboard. Each goal tracks a specific user action such as visiting a URL or triggering a custom event.

ColumnTypeDescription
website_iduuidWebsite identifier
namevarcharHuman-readable goal name
goal_typevarcharGoal type: url, event, pageview
url_patterntextURL pattern to match (for URL-type goals)
event_namevarcharEvent name to match (for event-type goals)
is_activebooleanWhether the goal is currently active
default_valuenumericDefault monetary value per completion

goal_completions

Individual goal conversion events. Each row represents a single instance of a visitor completing a defined goal.

ColumnTypeDescription
goal_iduuidReference to the goal definition
website_iduuidWebsite identifier
visitor_idtextVisitor who completed the goal
completion_valuenumericValue of this specific completion
page_urltextPage where the completion occurred
utm_sourcevarcharUTM source at time of completion
device_typevarcharDevice used
country_namevarcharCountry of the visitor
completed_attimestamptzWhen the goal was completed

funnels

Funnel definitions for multi-step conversion tracking.

ColumnTypeDescription
iduuidUnique funnel identifier
website_iduuidWebsite identifier
namevarcharFunnel name

funnel_steps

Individual steps within a funnel, ordered sequentially. Join with funnels on funnel_id to get the full funnel configuration.

ColumnTypeDescription
funnel_iduuidReference to the parent funnel
step_orderintegerPosition in the funnel sequence (1-based)
step_namevarcharDisplay name for this step
step_typevarcharStep type: url, event
url_patterntextURL pattern to match (for URL steps)
event_namevarcharEvent name to match (for event steps)

Errors & Performance

error_groups

Grouped error types with occurrence counts and severity. Errors are automatically deduplicated and grouped by type and message.

ColumnTypeDescription
website_iduuidWebsite identifier
error_typevarcharError category: javascript, network, unhandled_rejection
error_messagetextThe error message string
occurrence_countintegerTotal number of times this error has occurred
user_countintegerNumber of unique users affected
severityvarcharSeverity level: low, medium, high, critical
statusvarcharTriage status: open, resolved, ignored
first_seentimestamptzWhen this error was first recorded
last_seentimestamptzMost recent occurrence

error_occurrences

Individual error events with full context including stack traces and environment details.

ColumnTypeDescription
website_iduuidWebsite identifier
error_typevarcharError category
error_messagetextThe error message
stacktracejsonbFull stack trace as structured JSON
page_urltextPage where the error occurred
browservarcharBrowser name and version
osvarcharOperating system
severityvarcharSeverity level
timestamptimestamptzWhen the error occurred

performance_metrics

Core Web Vitals measurements (LCP, CLS, INP) collected from real user monitoring. Each row is a single measurement from a page load.

ColumnTypeDescription
website_iduuidWebsite identifier
page_urltextPage where metrics were collected
lcp_valuenumericLargest Contentful Paint in milliseconds
lcp_ratingvarcharLCP rating: good, needs-improvement, poor
cls_valuenumericCumulative Layout Shift score
cls_ratingvarcharCLS rating: good, needs-improvement, poor
inp_valueintegerInteraction to Next Paint in milliseconds
inp_ratingvarcharINP rating: good, needs-improvement, poor
device_typevarcharDevice type used for this measurement
browservarcharBrowser name
recorded_attimestamptzWhen the measurement was recorded

Uptime Monitoring

uptime_checks

Individual uptime check results from the monitoring system. Each row represents a single health check ping to your website.

ColumnTypeDescription
website_iduuidWebsite identifier
checked_attimestamptzWhen the check was performed
is_upbooleanWhether the site responded successfully
status_codeintegerHTTP response status code
response_time_msintegerResponse time in milliseconds
error_messagetextError message if the check failed
regionvarcharMonitoring region (e.g., us-east, eu-west, ap-south)

uptime_daily

Daily uptime aggregates. Use this for SLA reporting and trend analysis instead of querying individual checks.

ColumnTypeDescription
website_iduuidWebsite identifier
datedateCalendar date
uptime_percentagenumericUptime as a percentage (e.g., 99.95)
avg_response_time_msintegerAverage response time in milliseconds
incidents_countintegerNumber of downtime incidents
checks_totalintegerTotal number of checks performed

User Behavior

heatmap_data

Aggregated click and scroll heatmap data on a grid overlay. Each row represents a grid cell with accumulated interaction counts.

ColumnTypeDescription
website_iduuidWebsite identifier
page_pathvarcharPage path for this heatmap
heatmap_typevarcharType: click, scroll, move
grid_xsmallintHorizontal grid coordinate
grid_ysmallintVertical grid coordinate
hit_countintegerNumber of interactions in this grid cell
intensitynumericNormalized intensity value (0.0 to 1.0)

heatmap_sessions

Session-level summaries of heatmap interaction data per page.

ColumnTypeDescription
website_iduuidWebsite identifier
page_urltextFull URL of the page
total_clicksintegerTotal clicks recorded
total_movementsintegerTotal mouse movements recorded
total_scroll_eventsintegerTotal scroll events recorded

replay_sessions

Session replay recording metadata. Each row represents a recorded browsing session that can be replayed in the dashboard.

ColumnTypeDescription
website_iduuidWebsite identifier
visitor_idvarcharVisitor who was recorded
duration_msintegerTotal recording duration in milliseconds
total_eventsintegerNumber of DOM events captured
total_sizeintegerRecording data size in bytes
started_attimestamptzWhen the recording started

frustration_events

Detected user frustration signals including rage clicks, dead clicks, and error clicks.

ColumnTypeDescription
website_iduuidWebsite identifier
frustration_typevarcharType: rage_click, dead_click, error_click, thrashed_cursor
page_urltextPage where frustration was detected
timestamptimestamptzWhen the event occurred

scroll_depth_stats

Aggregated scroll depth statistics by page, showing how far visitors scroll on each page.

ColumnTypeDescription
website_iduuidWebsite identifier
page_pathvarcharPage path
depth_percentagesmallintScroll depth bucket (e.g., 25, 50, 75, 100)
reach_countintegerNumber of visitors who reached this depth

session_history

Completed session summaries with engagement and conversion metrics.

ColumnTypeDescription
website_iduuidWebsite identifier
visitor_iduuidVisitor identifier
total_duration_secondsintegerTotal session duration in seconds
pages_viewedintegerNumber of pages viewed in the session
bouncebooleantrue if the visitor left after one page
convertedbooleantrue if a conversion event was triggered
conversion_valuenumericTotal conversion value for the session

B2B & Companies

b2b_companies

Identified companies visiting your website, enriched with firmographic data from IP-to-company resolution.

ColumnTypeDescription
idtextUnique company identifier
nametextCompany name
domaintextCompany website domain
industrytextIndustry classification
employee_countintegerEstimated number of employees
revenue_rangetextEstimated annual revenue range (e.g., $10M-$50M)

b2b_company_visits

Company-level visit aggregates. Join with b2b_companies on company_id = id for full company details.

ColumnTypeDescription
company_idtextReference to the company
website_iduuidWebsite identifier
total_visitsintegerTotal number of visits from this company
total_page_viewsintegerTotal page views from this company
engagement_scorenumericComputed engagement score (0-100)
last_visittimestamptzMost recent visit timestamp

Marketing & Campaigns

campaign_performance

UTM campaign performance metrics aggregated by date. Use this for marketing ROI analysis and campaign comparison.

ColumnTypeDescription
website_iduuidWebsite identifier
utm_sourcevarcharUTM source parameter
utm_campaignvarcharUTM campaign name
visitorsintegerNumber of visitors from this campaign
conversionsintegerNumber of conversions attributed
revenuenumericTotal revenue attributed
bounce_ratenumericBounce rate as a decimal
datedateDate of the metrics

gsc_keyword_data

Google Search Console keyword performance data synced via the GSC integration. Shows how your pages perform in Google search results.

ColumnTypeDescription
website_iduuidWebsite identifier
querytextSearch query (keyword)
clicksintegerNumber of clicks from search results
impressionsintegerNumber of times shown in search results
ctrnumericClick-through rate as a decimal (e.g., 0.034 = 3.4%)
positionnumericAverage position in search results
datedateDate of the search data

Custom Events

custom_events

User-defined tracking events sent via the custom events API. Each row represents a single event occurrence with optional properties and revenue data.

ColumnTypeDescription
website_iduuidWebsite identifier
event_namevarcharName of the custom event (e.g., signup, add_to_cart)
event_categoryvarcharEvent category for grouping
visitor_iduuidVisitor who triggered the event
propertiesjsonbCustom key-value properties attached to the event
revenuenumericRevenue value associated with this event
page_urltextPage where the event was triggered

The properties column is JSONB. Query specific properties using properties->>'key_name'. Example: WHERE properties->>'plan' = 'pro'.

events

System-level events tracked automatically by the Zenovay tracker. Includes page views, clicks, form submissions, and other built-in event types.

ColumnTypeDescription
website_iduuidWebsite identifier
visitor_iduuidVisitor identifier
event_typetextEvent type: pageview, click, form_submit, video_progress, file_upload, scroll, custom
event_nametextSpecific event name
event_valuetextString value associated with the event
event_datajsonbAdditional structured event data
timestamptimestamptzWhen the event occurred

Other

chart_notes

Dashboard annotations attached to specific dates. These appear as markers on time-series charts to provide context for data trends.

ColumnTypeDescription
website_iduuidWebsite identifier
note_datedateDate the annotation is attached to
contenttextAnnotation text content
show_on_chartbooleanWhether to display this note on dashboard charts

alerts

Configured alert rules that trigger notifications when specified conditions are met.

ColumnTypeDescription
website_iduuidWebsite identifier
alert_typetextAlert category: traffic_spike, traffic_drop, error_rate, uptime, goal
nametextHuman-readable alert name
conditionsjsonbAlert trigger conditions as structured JSON
statustextAlert status: active, paused, triggered

websites

Website configuration records. Each tracked website has an entry here with its settings and tracking code.

ColumnTypeDescription
iduuidUnique website identifier (used as website_id everywhere)
domainvarcharWebsite domain (e.g., example.com)
namevarcharDisplay name for the website
is_activebooleanWhether tracking is currently active
tracking_codevarcharUnique tracking code for the embed script
timezonevarcharTimezone for date aggregations (e.g., America/New_York)

Example Queries

Core Analytics

Top 10 pages by visitors this monthSQL
SELECT page_url, COUNT(*) as visits, AVG(time_on_page) as avg_time
FROM visitors
WHERE website_id = 'YOUR_WEBSITE_ID'
AND visited_at >= date_trunc('month', now())
GROUP BY page_url
ORDER BY visits DESC
LIMIT 10;
Daily traffic trend for the last 30 daysSQL
SELECT date, visitors, page_views, bounce_rate
FROM analytics_daily
WHERE website_id = 'YOUR_WEBSITE_ID'
AND date >= now() - interval '30 days'
ORDER BY date ASC;

Revenue & Payments

Revenue by marketing channel this monthSQL
SELECT marketing_channel, SUM(amount) as total_revenue, COUNT(*) as transactions
FROM payments
WHERE website_id = 'YOUR_WEBSITE_ID'
AND status = 'succeeded'
AND created_at >= date_trunc('month', now())
GROUP BY marketing_channel
ORDER BY total_revenue DESC;
Top customers by lifetime revenueSQL
SELECT email, name, total_revenue, subscription_status, subscription_plan
FROM identified_users
WHERE website_id = 'YOUR_WEBSITE_ID'
ORDER BY total_revenue DESC
LIMIT 20;

Goals & Funnels

Goal completions by source this weekSQL
SELECT utm_source, COUNT(*) as completions, SUM(completion_value) as total_value
FROM goal_completions
WHERE website_id = 'YOUR_WEBSITE_ID'
AND completed_at >= date_trunc('week', now())
GROUP BY utm_source
ORDER BY completions DESC;

Errors & Performance

Top unresolved errors by occurrence countSQL
SELECT error_type, error_message, occurrence_count, user_count, severity, last_seen
FROM error_groups
WHERE website_id = 'YOUR_WEBSITE_ID'
AND status = 'open'
ORDER BY occurrence_count DESC
LIMIT 10;
Core Web Vitals averages by pageSQL
SELECT page_url,
ROUND(AVG(lcp_value), 0) as avg_lcp_ms,
ROUND(AVG(cls_value), 3) as avg_cls,
ROUND(AVG(inp_value), 0) as avg_inp_ms
FROM performance_metrics
WHERE website_id = 'YOUR_WEBSITE_ID'
AND recorded_at >= now() - interval '7 days'
GROUP BY page_url
ORDER BY avg_lcp_ms DESC
LIMIT 10;

Uptime Monitoring

Uptime percentage over the last 30 daysSQL
SELECT date, uptime_percentage, avg_response_time_ms, incidents_count
FROM uptime_daily
WHERE website_id = 'YOUR_WEBSITE_ID'
AND date >= now() - interval '30 days'
ORDER BY date ASC;

User Behavior

Pages with the most frustration eventsSQL
SELECT page_url, frustration_type, COUNT(*) as occurrences
FROM frustration_events
WHERE website_id = 'YOUR_WEBSITE_ID'
AND timestamp >= now() - interval '7 days'
GROUP BY page_url, frustration_type
ORDER BY occurrences DESC
LIMIT 10;
Session replay recordings over 2 minutesSQL
SELECT visitor_id, duration_ms / 1000 as duration_seconds, total_events, started_at
FROM replay_sessions
WHERE website_id = 'YOUR_WEBSITE_ID'
AND duration_ms > 120000
ORDER BY started_at DESC
LIMIT 20;

B2B & Companies

Most engaged companies visiting your siteSQL
SELECT c.name, c.industry, c.employee_count, v.total_visits, v.engagement_score, v.last_visit
FROM b2b_company_visits v
JOIN b2b_companies c ON c.id = v.company_id
WHERE v.website_id = 'YOUR_WEBSITE_ID'
ORDER BY v.engagement_score DESC
LIMIT 15;

Marketing & Campaigns

Campaign performance comparisonSQL
SELECT utm_source, utm_campaign, SUM(visitors) as total_visitors,
SUM(conversions) as total_conversions, SUM(revenue) as total_revenue,
ROUND(AVG(bounce_rate), 3) as avg_bounce_rate
FROM campaign_performance
WHERE website_id = 'YOUR_WEBSITE_ID'
AND date >= now() - interval '30 days'
GROUP BY utm_source, utm_campaign
ORDER BY total_revenue DESC;
Top search queries from Google Search ConsoleSQL
SELECT query, SUM(clicks) as total_clicks, SUM(impressions) as total_impressions,
ROUND(AVG(ctr), 4) as avg_ctr, ROUND(AVG(position), 1) as avg_position
FROM gsc_keyword_data
WHERE website_id = 'YOUR_WEBSITE_ID'
AND date >= now() - interval '28 days'
GROUP BY query
ORDER BY total_clicks DESC
LIMIT 20;

Custom Events

Custom event frequency with revenueSQL
SELECT event_name, event_category, COUNT(*) as occurrences, SUM(revenue) as total_revenue
FROM custom_events
WHERE website_id = 'YOUR_WEBSITE_ID'
AND properties->>'source' IS NOT NULL
GROUP BY event_name, event_category
ORDER BY occurrences DESC
LIMIT 20;

Other

Dashboard annotations for the current monthSQL
SELECT note_date, content
FROM chart_notes
WHERE website_id = 'YOUR_WEBSITE_ID'
AND note_date >= date_trunc('month', now())
AND show_on_chart = true
ORDER BY note_date ASC;
Active alert rulesSQL
SELECT name, alert_type, status, conditions
FROM alerts
WHERE website_id = 'YOUR_WEBSITE_ID'
AND status = 'active'
ORDER BY name;
Was this page helpful?