Data Schema

This guide explains the schema structure of Contentsquare data in your data warehouse, helping you understand how to effectively query and analyze the data.

Data Connect creates several tables in your data warehouse, each representing a different aspect of user behavior data. Understanding this schema is essential for effective analysis and joining with other data sources.

Data Connect adopts a hierarchical schema. By default, Data Connect will sync the following tables:

  • One users table (for all user information)
  • One sessions table (for all session information)
  • One pageviews table (for all pageview information)

Data Connect creates the following core tables in your data warehouse.

The users table contains a row for each unique user that has visited your site.

Column NameTypeDescription
user_idBIGINTUnique ID of user, randomly generated by Contentsquare (CSQ).
identityTEXTUser’s username or other unique token, passed identify. Must be unique.
handleTEXTUser’s username or other unique token, passed identify.
emailTEXTUser’s email address, passed in via addUserProperties API.
joindateTIMESTAMPTimestamp without time zone of when the user was first seen. In S3, this is in UNIX timestamp format.
last_modifiedTIMESTAMPTimestamp without time zone of when the user’s data was last modified. In S3, this is in UNIX timestamp format.
user propertiesTEXTThere will be one column for every unique user property you’ve sent via the addUserProperties API (name, gender, account status, etc). The column type is automatically inferred from the underlying property values.

The sessions table represents individual user sessions.

Column NameTypeLibraryDescription
event_idBIGINTAllID of associated session event, randomly generated by CSQ.
user_idBIGINTAllID of associated user, randomly generated by CSQ.
session_idBIGINTAllID of associated session, randomly generated by CSQ.
timeTIMESTAMPAllTimestamp without time zone of when session started.
libraryTEXTAllVersion of Contentsquare library which began the session. Can be one of “web” or “iOS”.
platformTEXTWebUser’s operating system.
device_typeTEXTWebDevice type, which can only be one “Desktop”.
countryTEXTAllCountry in which user session occurred, based on IP.
regionTEXTAllRegion in which user session occurred, based on IP.
cityTEXTAllCity in which user session occurred, based on IP.
referrerTEXTWebURL that linked to your site and initiated the session. If the user navigated directly to your site, or referral headers were stripped, then this value will appear as NULL downstream and as direct in the UI.
landing_pageTEXTWebURL of the first pageview of the session.
browserTEXTWebUser’s browser.
utm_sourceTEXTWebGA-based utm_source tag associated with the session’s initial pageview.
utm_campaignTEXTWebGA-based utm_campaign tag associated with the session’s initial pageview.
utm_mediumTEXTWebGA-based utm_medium tag associated with the session’s initial pageview.
utm_termTEXTWebGA-based utm_term tag associated with the session’s initial pageview.
utm_contentTEXTWebGA-based utm_content tag associated with the session’s initial pageview.
custom_varTEXTWebkey-value pairs that define more information about the pageview.
session_replay_linkTEXTWebContentsquare Platform url link of the session replay.
session_durationTEXTWebTotal duration of the session.
session_languageTEXTWebLanguage displayed during the session.
session_number_of_viewsTEXTWebThe number of page views in the session.
frustration_scoreTEXTWebMeasure of user frustration during the session.
looping_IndexTEXTWebThe proportion of same urls visited during the session (meaning the user is doing back & forth).
page_consumptionTEXTWebProportion of pages where the user spent less than 2s and did less than 2 clicks.
filtered_APVTEXTWebNumber of views in which APVs (Artificial Pageviews) are not counted / a boolean determining whether a given page view is an Artificial Page view.

The pageviews table contains detailed information about each pageview.

Column NameTypeLibraryDescription
event_idBIGINTAllID of associated pageview event.
user_idBIGINTAllUnique ID of associated user, randomly generated by CSQ.
session_idBIGINTAllUnique ID of associated session, randomly generated by CSQ.
timeTIMESTAMPAllTimestamp without time zone of when the pageview occurred.
libraryTEXTAllVersion of Contentsquare library which started the session. Can be one of “web” or “iOS”.
platformTEXTWebUser’s operating system.
device_typeTEXTWebDevice type, which can only be one “Desktop”.
countryTEXTWebCountry in which user session occurred, based on IP.
regionTEXTWebRegion in which user session occurred, based on IP.
cityTEXTWebCity in which user session occurred, based on IP.
referrerTEXTWebURL that linked to your site and started the session. If the user navigated directly to your site, or referral headers were stripped, then this value will appear as NULL downstream and as direct in the UI.
landing_pageTEXTWebURL of the first pageview of the session.
browserTEXTWebUser’s browser.
utm_sourceTEXTWebGA-based utm_source tag associated with the session’s initial pageview.
utm_campaignTEXTWebGA-based utm_campaign tag associated with the session’s initial pageview.
utm_mediumTEXTWebGA-based utm_medium tag associated with the session’s initial pageview.
utm_termTEXTWebGA-based utm_term tag associated with the session’s initial pageview.
utm_contentTEXTWebGA-based utm_content tag associated with the session’s initial pageview.
pathTEXTWebThe path of the pageview.
queryTEXTWebThe query parameters associated with the pageview.
hashTEXTWebThe hash parameters associated with the pageview.
titleTEXTWebTitle of the current page.
custom_varTEXTWebkey-value pairs that define more information about the pageview.
dynamic_varTEXTWebkey-value pairs that define more information about the session.
view_numberTEXTWebThe pageview number in the session.
is_firstTEXTWebIf the page is the entry page then value is 1 otherwise value is 0.
is_lastTEXTWebIf the page is the exit page then value is 1, otherwise value is 0.
scroll_rateTEXTWebThe portion of the page which was displayed (in percentage points).
view_duration_msecTEXTWebDuration between the page view event time (view_time) and the timestamp of the last interaction event (in milliseconds).
first_input_delayTEXTWebDelay (in milliseconds) between the first user interaction and when the web browser can handle it (part of Core Web Vitals).
interaction_to_next_paintTEXTWebLongest visual delay (in milliseconds) experienced by a user when interacting with the page (clicks or keystrokes).
time_to_first_byteTEXTWebDelay (in milliseconds) between the request for the web page and when the web browser received the first piece of data.
largest_contentful_paintTEXTWebDelay (in milliseconds) to render the largest piece of content (part of Core Web Vitals).
cumulative_layout_shiftTEXTWebScore about the layout stability of the page rendering (part of Core Web Vitals).
dom_interactive_after_msecTEXTWebThe time in milliseconds required before the user is able to interact with the page (although all resources may not be fully loaded yet).
fully_loadedTEXTWebThe time in milliseconds required to fully load all the resources of the page, from initiation of the pageview to load completion in the browser.
first_contentful_paintTEXTWebDelay (in milliseconds) to render the first piece of content.
start_renderTEXTWebTimestamp sent by tag when the rendering of the page started.
window_heightTEXTWebHeight of the window in which the page is opened.
window_widthTEXTWebWidth of the window in which the page is opened.
session_replay_linkTEXTWebContentsquare Platform url link of the session replay.

Contentsquare will create one table for every labeled event you’ve created within Contentsquare and synced downstream. You currently don’t have access to the UI to self-create your event.

Column NameTypeLibrariesDescription
event_idBIGINTAllID of the associated event, randomly generated by CSQ.
user_idBIGINTAllUnique ID of the associated user, randomly generated by CSQ.
session_idBIGINTAllUnique ID of the associated session, randomly generated by CSQ.
pageview_idBIGINTAllUnique ID of the associated page, randomly generated by CSQ.
timeTIMESTAMPAllTimestamp without time zone of when the event happened.
typeTEXTAllFor web autocaptured events, can be any of view page, click, submit, change, with push state events registered as view page events. For custom events, this will be the custom event name.
libraryTEXTAllVersion of Contentsquare library on which event occurred. Can be one of “web”, “iOS”, or “server”.
platformTEXTWebUser’s operating system.
device_typeTEXTWebDevice type, which can only be one “Desktop”.
countryTEXTWebCountry in which user session occurred, based on IP.
regionTEXTWebRegion in which user session occurred, based on IP.
cityTEXTWebCity in which user session occurred, based on IP.
referrerTEXTWebURL that linked to your site and started the session. If the user navigated directly to your site, or referral headers were stripped, then this value will appear as NULL downstream and as direct in the UI.
landing_pageTEXTWebURL of the first pageview of the session.
landing_page_queryTEXTWebThe query parameters of the first page of the user’s session.
landing_page_hashTEXTWebThe hash route of the first page of the user’s session.
browserTEXTWebUser’s browser.
utm_sourceTEXTWebGA-based utm_source tag associated with the session’s initial pageview.
utm_campaignTEXTWebGA-based utm_campaign tag associated with the session’s initial pageview.
utm_mediumTEXTWebGA-based utm_medium tag associated with the session’s initial pageview.
utm_termTEXTWebGA-based utm_term tag associated with the session’s initial pageview.
utm_contentTEXTWebGA-based utm_content tag associated with the session’s initial pageview.
domainTEXTWebDomain including subdomain, e.g. blog.company.io.
pathTEXTWebPortion of the current URL following your domain, e.g. /docs for company.io/docs.
hashTEXTWebPortion of the current URL following the hash sign, e.g. #install for company.io/docs#install.
queryTEXTWebQuery params of the page’s current URL, e.g. ?utm_id=1234 for company.io?utm_id=1234.
titleTEXTWebTitle of the current page.
hrefTEXTWebhref property of link (used for clicks on anchor tags).
target_textTEXTWeb, iOSButton text of the event target.
Experience Monitoring

The api_errors table contains information about API errors detected during user sessions.

Column NameTypeLibraryDescription
event_idBIGINTErrorsID of associated event, randomly generated.
user_idBIGINTErrorsID of associated user, randomly generated.
session_idBIGINTErrorsID of associated session, randomly generated.
pageview_idBIGINTFrustrationUnique ID of the associated page, randomly generated by CSQ.
timeTIMESTAMPErrorsTimestamp without time zone of when the event happened.
libraryTEXTErrorsVersion of Contentsquare library which began the session. “web” or “iOS”.
platformTEXTErrorsUser’s operating system.
device_typeTEXTErrorsDevice type, which can only be one “Desktop”.
countryTEXTErrorsCountry in which user session occurred, based on IP.
regionTEXTErrorsRegion in which user session occurred, based on IP.
cityTEXTErrorsCity in which user session occurred, based on IP.
landing_pageTEXTErrorsURL of the first pageview of the session.
api_error_durationTEXTErrorsTime taken to resolve API error.
api_error_endpointTEXTErrorsURL where API errors are reported.
api_error_methodTEXTErrorsStandardized communication of API error responses.
api_error_status_codeTEXTErrorsNumerical code identifying API error.
errors_after_clicksTEXTErrorsIssue occurring post-user interaction (boolean).
error_group_idTEXTErrorsIdentifier for categorizing related errors.
error_sourceTEXTErrorsOrigin point of the reported error.
typeTEXTErrorsAPI error.
referrerTEXTErrorsURL that linked to your site and initiated the session. If the user navigated directly to your site, or referral headers were stripped, then this value will appear as NULL downstream and as direct in the UI.
Experience Monitoring

The js_errors table contains information about JavaScript errors detected during user sessions.

Column NameTypeLibraryDescription
event_idBIGINTErrorsID of associated session event, randomly generated.
user_idBIGINTErrorsID of associated user, randomly generated.
session_idBIGINTErrorsID of associated session, randomly generated.
pageview_idBIGINTFrustrationUnique ID of the associated page, randomly generated by CSQ.
timeTIMESTAMPErrorsTimestamp without time zone of when the event happened.
libraryTEXTErrorsVersion of Contentsquare library which began the session. “web” or “iOS”.
platformTEXTErrorsUser’s operating system.
device_typeTEXTErrorsDevice type, which can only be one “Desktop”.
countryTEXTErrorsCountry in which user session occurred, based on IP.
regionTEXTErrorsRegion in which user session occurred, based on IP.
cityTEXTErrorsCity in which user session occurred, based on IP.
landing_pageTEXTErrorsURL of the first pageview of the session.
error_messageTEXTErrorsDescription of the encountered error.
error_line_numberTEXTErrorsLine in the code where the error occurred.
js_error_file_nameTEXTErrorsFile name containing the JavaScript error.
js_error_column_numberTEXTErrorsColumn in the file where the error occurred.
errors_after_clicksTEXTErrorsIssue occurring post-user interaction (boolean).
error_group_idTEXTErrorsIdentifier for categorizing related errors.
error_sourceTEXTErrorsOrigin point of the reported error.
typeTEXTErrorsJS error.
referrerTEXTErrorsURL that linked to your site and initiated the session. If the user navigated directly to your site, or referral headers were stripped, then this value will appear as NULL downstream and as direct in the UI.
Experience Monitoring

The custom_errors table contains information about custom errors detected during user sessions.

Column NameTypeLibraryDescription
event_idBIGINTErrorID of associated session event, randomly generated.
user_idBIGINTErrorID of associated user, randomly generated.
session_idBIGINTErrorID of associated session, randomly generated.
pageview_idBIGINTErrorUnique ID of the associated page, randomly generated by CSQ.
timeTIMESTAMPErrorTimestamp without time zone of when the event happened.
libraryTEXTErrorVersion of Contentsquare library which began the session. “web” or “iOS”.
platformTEXTErrorUser’s operating system.
device_typeTEXTErrorDevice type, which can only be one “Desktop”.
countryTEXTErrorCountry in which user session occurred, based on IP.
regionTEXTErrorRegion in which user session occurred, based on IP.
cityTEXTErrorCity in which user session occurred, based on IP.
landing_pageTEXTErrorURL of the first pageview of the session.
error_messageTEXTErrorDescription of the encountered error.
errors_after_clicksTEXTErrorIssue occurring post-user interaction (boolean).
error_group_idTEXTErrorIdentifier for categorizing related errors.
error_sourceTEXTErrorOrigin point of the reported error.
typeTEXTErrorCustom Error.
referrerTEXTErrorURL that linked to your site and initiated the session. If the user navigated directly to your site, or referral headers were stripped, then this value will appear as NULL downstream and as direct in the UI.

The following data schema table will be the same for every frustration factor (rage click, excessive hovering, multiple use element, multiple field interactions, multiple button interactions, loading time high and low activity).

Column NameTypeLibraryDescription
event_idBIGINTFrustrationID of the associated event, randomly generated by Contentsquare.
user_idBIGINTFrustrationUnique ID of the associated user, randomly generated by Contentsquare.
session_idBIGINTFrustrationUnique ID of the associated session, randomly generated by Contentsquare.
pageview_idBIGINTFrustrationUnique ID of the associated page, randomly generated by Contentsquare.
timeTIMESTAMPFrustrationTimestamp without time zone of when the event happened.
libraryTEXTFrustrationFrustration
platformTEXTFrustrationUser’s operating system.
device_typeTEXTFrustrationDevice type, which can only be one “Desktop”.
countryTEXTFrustrationCountry in which user session occurred, based on IP.
regionTEXTFrustrationRegion in which user session occurred, based on IP.
cityTEXTFrustrationCity in which user session occurred, based on IP.
landing_pageTEXTFrustrationURL of the first pageview of the session.
typeTEXTFrustrationrage click
referrerTEXTFrustrationURL that linked to your site and initiated the session. If the user navigated directly to your site, or referral headers were stripped, then this value will appear as NULL downstream and as direct in the UI.
domainTEXTFrustrationDomain including subdomain, e.g. http://blog.company.io.
pathTEXTFrustrationPortion of the current URL following your domain, e.g. /docs for company.io/docs.
hashTEXTFrustrationPortion of the current URL following the hash sign, e.g. #install for company.io/docs#install.
queryTEXTFrustrationQuery params of the page’s current URL, e.g. ?utm_id=1234 for http://company.io?utm_id=1234.
target_textTEXTFrustrationThe text displayed on the button clicked.
frustration_scoreTEXTFrustrationFrustration score of the pageview.
target_pathTEXTFrustrationTarget path of the HTML component where the event happens.
relative_timeINTFrustrationThe point in time when the event happens.
valueINTFrustrationThe number of clicks.

The ecommerce_transactions table contains information about e-commerce transactions.

Column NameTypeLibraryDescription
event_idBIGINTContentsquareID of associated session event, randomly generated.
user_idBIGINTContentsquareID of associated user, randomly generated.
session_idBIGINTContentsquareID of associated session, randomly generated.
timeTIMESTAMPContentsquareTimestamp without time zone of when the pageview occurred.
libraryTEXTContentsquareVersion of Contentsquare library which began the session. “web” or “iOS”.
platformTEXTContentsquareUser’s operating system.
countryTEXTContentsquareCountry in which user session occurred, based on IP.
regionTEXTContentsquareRegion in which user session occurred, based on IP.
cityTEXTContentsquareCity in which user session occurred, based on IP.
referrerTEXTContentsquareURL that linked to your site and initiated the session. If the user navigated directly to your site, or referral headers were stripped, then this value will appear as NULL downstream and as direct in the UI.
typeTEXTContentsquareE-commerce transaction.
device_typeTEXTContentsquareDevice type, which can only be one “Desktop”.
transaction_amountTEXTContentsquareThe total monetary value of a purchase or payment made by a user during a session.
transaction_currencyTEXTContentsquareThe currency in which the transaction amount was processed.

Table Does Not Sync For S3. The all_events table does not sync for S3. You can create an all_events view of all synced tables after the data synced to S3 has gone through ETL processing.

Column NameTypeDescription
event_idBIGINTID of associated event, randomly generated by Contentsquare.
user_idBIGINTUnique ID of associated user, randomly generated by Contentsquare.
session_idBIGINTUnique ID of associated session, randomly generated by Contentsquare.
timeTIMESTAMPTimestamp without time zone of when event happened.
event_table_nameTEXTName of the table where similar events can be found.

Contentsquare creates a table called _sync_history that contains a record for every attempted sync. This table is helpful for monitoring sync performance and scheduling dependent jobs. All timestamps are in UTC for Redshift and BigQuery and in local time for Snowflake.

Column NameTypeDescription
statusSTRINGTakes value running/succeeded/failed based on the outcome of the sync attempt.
start_timeTIMESTAMPStart time of the sync attempt.
finish_timeTIMESTAMPFinish time of the sync attempt.
errorSTRINGError message if sync fails.
next_scheduled_sync_atTIMESTAMPTime of the next scheduled sync (estimated at the time of sync based on sync frequency settings).

Contentsquare creates a table called _sync_info that contains metadata around the sync process and last updated times.

Column NameTypeDescription
event_table_nameTEXTThe event name.
sync_startedTIMESTAMPA timestamp for when that table began syncing.
sync_endedTIMESTAMPA timestamp for when that table completed syncing.
synced_to_timeTIMESTAMPA timestamp that reflects the most recent occurrence of the event.
inserted_row_countBIGINTThe number of rows inserted during the most recent sync.

When a user is identified, a migration occurs to aggregate the data under the new identity. These migrations are recorded in this table. Time is a column for Redshift and S3 destinations only. Snowflake and BigQuery do not have a column for time.

Column NameTypeDescription
from_user_idBIGINTThe migrating user’s ID.
to_user_idBIGINTThe destination user’s ID.
timeTIMESTAMPA timestamp for when the migration occurred.

This table contains metadata about the names of events, which allows you to build automated jobs that use this metadata. This table is re-created on each sync to stay updated with the latest event metadata.

Column NameTypeDescription
table_nameTEXTFor each event, this row contains the sanitized name of the table containing the event’s data synced to your warehouse.
ui_nameTEXTFor each event, this row contains the name of the event in Contentsquare.
last_updated_atTIMESTAMPTime event label was last updated.
last_updated_byTEXTUser who last updated event label.
notesTEXTNotes attached to the event.
sourceTEXTData capture source (ex: web, ios, android).
verified_atTIMESTAMPTime event was verified.
verified_byTEXTUser who verified the event.

The event_metadata table shows up differently for S3. You can query it as follows:

{
"ui_name": "Stripe charge",
"table_name": "stripe_charge",
"source": "stripe",
"last_updated_at": "1609459200000",
"last_updated_by": "sales@contentsquare.com",
"notes": "This is a note",
"verified_at": "1640995200000",
"verified_by": "admin@contentsquare.com"
}