Welcome
The SQL queries will be in this section of the page
when you get to the 'Queries' part of the documentation.
Welcome to the official FlatQuery Documentation 🚀🚀
FlatQuery is a community-led platform for shaping your GA4 data in Google's BigQuery.
The native, datawarehouse integration between these two platforms enables users to take real ownership of their GA event data. We're building FlatQuery to empower teams to champion that data and work it into wider marketing and business tech stacks.
Key Concepts
- The platform FlatQuery, found at https://app.flatquery.com features a series of SQL queries which are sent automatically (over API) to a user's BigQuery project to transform and build reports from the Google Analytics export data held within.
- There are two types of queries, ‘Transformation’ and ‘Reports’. All queries can be configured in FlatQuery's no-code interface to better suit their business needs.
- FlatQuery does not read or ingest your data in any way, it just sends instructions to your Google BigQuery project to create new datasets and tables.
- Queries run by FlatQuery use utlisie BigQuery's free, monthly, 1TB querying quota. FlatQuery's queries are highly efficient and will keep all but the very largest organisations well within the 1TB per month. *If you're going over your free Google BigQuery tier, please get in touch. We can discuss a custom solution which will achieve further efficiency long term: hello@flatquery.com
- FlatQuery lets you run queries as a one-off or schedule them at custom intervals. This allows you to keep transformed datasets and reports up to date.
- FlatQuery is a community platform, it's 100% free to use.
Core features
No-code interface
This is a no-code platform, meaning that to run these queries requires no experience in writing code. The queries are pre-built in the application so all you need to do, is input your BigQuery Dataset ID, configure your query settings then run and / or schedule the query, FlatQuery will handle the rest.
Extracting Parameters
Nested event parameters and user properties are how Google Analytics' 'Custom Dimensions' are exported into Google BigQuery. However, there is also some standard and very useful metadata that is also structured in this format.
The format itself is referred to as a 'struct' and is a great feature of BigQuery, allowing one to nest a set of key / value pairs inside of each row of data. However, this results in an data structure that can be hard to work with.
FlatQuery automatically flattens this 'struct' format and unnests useful values by default whilst letting users define their own custom dimension values to be appended to new fields.
The full range of possible default values can be found below:
String | Integer |
---|---|
page_location | ga_session_id |
page_title | ga_session_number |
page_referrer | entrances |
session_source | |
session_medium | |
session_campaign |
Automated scheduling
Every query can be run as a one-off or scheduled to run at various intervals. Most users typically start with an 'All time' job which backfills the reports before setting a regular, daily or weekly job which updates the new datasets going forwards.
Date-based table partitioning
Whenever there's a date field in any of the transformation or report queries, the resultant table created in BigQuery is partitioned by this date value. This means that the dataset is optimised for efficient date-based querying and optimised for use with dashboarding tools, such as Looker.
Optional enrichment
Most queries allow you to toggle on optional enrichment for your queries. This feature adds additional fields into the datasets to provide more detail.
Here are the optional enrichment fields, depending on the query not all fields will always be relevant, therefore not always available.
Page attributes | Session attributes | First User attributes |
---|---|---|
page_path | session_source_medium | first_user_source_medium |
page_path_query | session_channel | first_user_channel |
The 'page attributes' here are just split from the unnested page_location value which is a full URL. From this we get just the path and the path with whatever URL query is on the end of it.
The session_source_medium and first_user_source_medium values which in Google Analytics are known to many as 'source / medium' are simple concatenation of the ..._source and ..._medium values.
The session_channel and first_user_channel is defined based upon the official and default Google Analytics channel definitions based upon source and medium. This information can be found here: https://support.google.com/analytics/answer/9756891?hl=en
We've got a lot of ideas of how to make the channel sorting a lot more intuitive, a feature will certainly follow in the coming months.
Essential Setup
Start with Google BigQuery
What is Google BigQuery?
BigQuery is Google’s Data Warehouse platform, a product under its Google Cloud services. Google Analytics has a native integration with BigQuery which allows for daily and real-time export of GA event data into BigQuery. FlatQuery works exclusively with this data that is held in BigQuery.
First, you need to ensure that you have access to a Google account, preferably the one that has full admin access to your Google Analytics account. With this account create a Google Cloud project and access the BigQuery Console which is effectively your BigQuery homepage.
You can get started with BigQuery here: https://cloud.google.com/bigquery And you can access the BigQuery console here: https://console.cloud.google.com/bigquery
BigQuery Billing
In Google Cloud you have a 'Payment Profile' which sits at the account level. You assign this payment profile to a projects which contains whatever services you are using for that project, one such service, for example, is Google BigQuery.
To create a payment profile, you have to register a payment card on the Google Cloud account and is essential in order to maintain the full BigQuery product access. Without a valid payment profile attached to your project your Google Analytics event data will only be saved for a maximum of 60 days and you won't be able to connect FlatQuery to it as it requires API access.
To add a card follow the prompts in BigQuery to ‘Upgrade’ or follow this guide: https://cloud.google.com/billing/docs/how-to/payment-methods
The free usage allowances of Google BigQuery per month are generous and most users will exceed them, but you do need a valid payment card behind the account to make full use of this Google Analytics to BigQuery integration and FlatQuery.
Linking Google Analytics
You're now ready to link your Google Analytics to your Google BigQuery account.
You can find the official documentation instructions for this here. https://support.google.com/analytics/answer/9823238
In short, inside of Google Analytics you:
- Click on ⚙️ Admin --> (little cog bottom left hand corner)
- Property Settings column (left hand side)
- Under ‘Product Links’ → click ‘BigQuery’
- Click the blue ‘Link’ button to create one
- Select your BigQuery project and confirm
- For most users a ‘Daily’ export is adequate.
Done. Event data will export into your BigQuery project and will sit in a table called 'events_' inside of a dataset called: 'analytics_XXXXXXXXX'. It will be this new dataset name that you will need to input when configuring your queries.
Connecting FlatQuery to BigQuery
Connecting FlatQuery to BigQuery could not be easier. It's important we remember that FlatQuery does not read or ingest your BigQuery data in anyway. Our connection has been vetted and approved by the Google Cloud Service team after a lengthy approval process.
There are two otions when it comes to connecting to your Google BigQuery project, either through a simple Google Sign In or a Service Account.
To find the connection settings, go to app.flatquery.com/settings
Option 1. Using Google Sign In (Recommended)
- Click on 'Sign in with Google'
- Select the relevant Google Account or Sign In
- Continue and toggle on the relevant permissions before clicking 'Continue'
That's it, you're connected and ready to start using FlatQuery with BigQuery.
Option 2. Using a Google Cloud Service account
To get started with service accounts you'll need to ensure you have the correct permissions to do so. The process is straight forward and offers the same levels of access as the Google Sign In method.
A full guide here to Google Cloud service accounts can be found here: https://cloud.google.com/iam/docs/service-accounts-create
Once you have the Service Account credentials you can select the 'Connect via Service Account' in the BigQuery Connection settings of the FlatQuery settings page linked above.
It's here you copy the json credentials from BigQuery and paste them into the FlatQuery configuration, click 'Save' and you're done.
Using FlatQuery
Once you've followed all the steps to set up BigQuery and connect GA4 (Google Analytics) to it you're all set to start using FlatQuery. Please note you'll need at least 1 day's worth of event data in Google BigQuery to start using it.
Queries
This section is all about the queries.
Whilst some queries are for generally transforming your data, most are for generating reports from it, ready to plug into dashboards or analyse further.
The SQL code in this documentation demonstrates the base query that FlatQuery sends to a user's BigQuery. All these queries demonstrated can be copied directly into Google BigQuery and be ran inside of the console.
The queries outlined in this documentation are either available in platform or are still in the process of being added.
This is indicated by either:
✅ Available in platform
or
⏳ Coming soon to platform
How To Run Queries
Create a project
To set up a query, first start by going to https://app.flatquery.com/project and creating a Project with the + Create new project button, give it a name then hit the ✅
Create a new query
Once inside of your new project click + Create new query. Choose from either the Transformation or Report query you require.
Run & Schedule queries
Once you've finished configuring your query you can click Save & Continue button. This will take you to the run & query section. Although you can't edit a query configuration at this time, you can return to this page at any point to re-run or adjust the schedule of your query.
These two functions exist independently of each other.
Flatten Query
-- Brought to you by the team at FlatQuery
-- For full documentation and details of the free, community platform which deploys these queries automatically, visit https://flatquery.com
-- Flatten Events
select T1.*,
/* --- Calculated Fields (Optional Enrichment)--- */
-- Page Path
case when page_location like '%/?%'
then REPLACE(LEFT(RIGHT(page_location,(LENGTH(page_location)-INSTR(page_location, '/',1,3)+1)),INSTR(RIGHT(page_location,
(LENGTH(page_location)-INSTR(page_location, '/',1,3)+1)), '?')),'?','')
else RIGHT(page_location,(LENGTH(page_location)-INSTR(page_location, '/',1,3)+1)) end AS page_path,
-- Page Path + Query
RIGHT(page_location,(LENGTH(page_location)-INSTR(page_location, '/',1,3)+1)) AS page_path_query,
-- First User Source / Medium
CONCAT( first_user_source, ' / ', first_user_medium ) AS first_user_source_medium,
-- First User Channel
case
when first_user_source = '(direct)' and (first_user_medium in ('(not set)','(none)')) then 'Direct'
when regexp_contains(first_user_campaign, 'cross-network') then 'Cross-network'
when (regexp_contains(first_user_source,'alibaba|amazon|google shopping|shopify|etsy|ebay|stripe|walmart')
or regexp_contains(first_user_campaign, '^(.*(([^a-df-z]|^)shop|shopping).*)$'))
and regexp_contains(first_user_medium, '^(.*cp.*|ppc|paid.*)$') then 'Paid Shopping'
when regexp_contains(first_user_source,'baidu|bing|duckduckgo|ecosia|google|yahoo|yandex')
and regexp_contains(first_user_medium,'^(.*cp.*|ppc|paid.*)$') then 'Paid Search'
when regexp_contains(first_user_source,'badoo|meta|facebook|fb|instagram|linkedin|pinterest|tiktok|twitter|whatsapp')
and regexp_contains(first_user_medium,'^(.*cp.*|ppc|paid.*)$') then 'Paid Social'
when regexp_contains(first_user_source,'dailymotion|disneyplus|netflix|youtube|vimeo|twitch|vimeo|youtube')
and regexp_contains(first_user_medium,'^(.*cp.*|ppc|paid.*)$') then 'Paid Video'
when first_user_medium in ('display', 'banner', 'expandable', 'interstitial', 'cpm') then 'Display'
when regexp_contains(first_user_source,'alibaba|amazon|google shopping|shopify|etsy|ebay|stripe|walmart')
or regexp_contains(first_user_campaign, '^(.*(([^a-df-z]|^)shop|shopping).*)$') then 'Organic Shopping'
when regexp_contains(first_user_source,'badoo|meta|facebook|fb|instagram|linkedin|pinterest|tiktok|twitter|whatsapp')
or first_user_medium in ('social','social-network','social-media','sm','social network','social media') then 'Organic Social'
when regexp_contains(first_user_source,'dailymotion|disneyplus|netflix|youtube|vimeo|twitch|vimeo|youtube')
or regexp_contains(first_user_medium,'^(.*video.*)$') then 'Organic Video'
when regexp_contains(first_user_source,'baidu|bing|duckduckgo|ecosia|google|yahoo|yandex')
or first_user_medium = 'organic' then 'Organic Search'
when regexp_contains(first_user_source,'email|e-mail|e_mail|e mail')
or regexp_contains(first_user_medium,'email|e-mail|e_mail|e mail') then 'Email'
when first_user_medium = 'affiliate' then 'Affiliates'
when first_user_medium = 'referral' then 'Referral'
when first_user_medium = 'audio' then 'Audio'
when first_user_medium = 'sms' then 'SMS'
when first_user_medium like '%push'
or regexp_contains(first_user_medium,'mobile|notification') then 'Mobile Push Notifications'
else 'Unassigned' end as first_user_channel,
-- Session Source / Medium
CONCAT( session_source, ' / ', session_medium) AS session_source_medium,
-- Session Channel
case
when session_source = '(direct)' and (session_medium in ('(not set)','(none)')) then 'Direct'
when regexp_contains(session_campaign, 'cross-network') then 'Cross-network'
when (regexp_contains(session_source,'alibaba|amazon|google shopping|shopify|etsy|ebay|stripe|walmart')
or regexp_contains(session_campaign, '^(.*(([^a-df-z]|^)shop|shopping).*)$'))
and regexp_contains(session_medium, '^(.*cp.*|ppc|paid.*)$') then 'Paid Shopping'
when regexp_contains(session_source,'baidu|bing|duckduckgo|ecosia|google|yahoo|yandex')
and regexp_contains(session_medium,'^(.*cp.*|ppc|paid.*)$') then 'Paid Search'
when regexp_contains(session_source,'badoo|meta|facebook|fb|instagram|linkedin|pinterest|tiktok|twitter|whatsapp')
and regexp_contains(session_medium,'^(.*cp.*|ppc|paid.*)$') then 'Paid Social'
when regexp_contains(session_source,'dailymotion|disneyplus|netflix|youtube|vimeo|twitch|vimeo|youtube')
and regexp_contains(session_medium,'^(.*cp.*|ppc|paid.*)$') then 'Paid Video'
when session_medium in ('display', 'banner', 'expandable', 'interstitial', 'cpm') then 'Display'
when regexp_contains(session_source,'alibaba|amazon|google shopping|shopify|etsy|ebay|stripe|walmart')
or regexp_contains(session_campaign, '^(.*(([^a-df-z]|^)shop|shopping).*)$') then 'Organic Shopping'
when regexp_contains(session_source,'badoo|facebook|fb|instagram|linkedin|pinterest|tiktok|twitter|whatsapp')
or session_medium in ('social','social-network','social-media','sm','social network','social media') then 'Organic Social'
when regexp_contains(session_source,'dailymotion|disneyplus|netflix|youtube|vimeo|twitch|vimeo|youtube')
or regexp_contains(session_medium,'^(.*video.*)$') then 'Organic Video'
when regexp_contains(session_source,'baidu|bing|duckduckgo|ecosia|google|yahoo|yandex')
or session_medium = 'organic' then 'Organic Search'
when regexp_contains(session_source,'email|e-mail|e_mail|e mail')
or regexp_contains(session_medium,'email|e-mail|e_mail|e mail') then 'Email'
when session_medium = 'affiliate' then 'Affiliates'
when session_medium = 'referral' then 'Referral'
when session_medium = 'audio' then 'Audio'
when session_medium = 'sms' then 'SMS'
when session_medium like '%push'
or regexp_contains(session_medium,'mobile|notification') then 'Mobile Push Notifications'
else 'Unassigned' end as session_channel,
/* --- End of Calculated Fields (Optional Enrichment)--- */
FROM
(
select
/* -- Include Existing Fields -- */
-- General Event Info
CONCAT(CAST(event_timestamp AS STRING),user_pseudo_id, (CAST(100*RAND() AS INT64)) ) AS event_id,
parse_date('%Y%m%d',event_date) AS event_date,
event_name,
event_timestamp,
event_previous_timestamp,
event_bundle_sequence_id,
event_server_timestamp_offset,
stream_id,
platform,
-- User Info
user_id,
user_pseudo_id,
user_first_touch_timestamp,
user_ltv.revenue AS user_ltv_revenue,
user_ltv.currency AS user_ltv_currency,
-- Privacy Info
privacy_info.analytics_storage AS privacy_info_analytics_storage,
privacy_info.ads_storage AS privacy_info_ads_storage,
privacy_info.uses_transient_token AS privacy_info_uses_transient_token,
-- App Info
app_info.id AS app_id,
app_info.version AS app_version,
app_info.install_store AS app_install_store,
app_info.firebase_app_id AS app_firebase_app_id,
app_info.install_source AS app_install_source,
-- Mobile Device
device.mobile_brand_name AS mobile_brand_name,
device.mobile_model_name AS mobile_model_name,
device.mobile_marketing_name AS mobile_marketing_name,
device.mobile_os_hardware_model AS mobile_os_hardware_model,
-- General Device
device.category AS device_category,
device.operating_system AS device_os,
device.operating_system_version AS device_os_version,
device.vendor_id AS device_vendor_id,
device.advertising_id AS device_advertising_id,
device.language AS device_language,
device.is_limited_ad_tracking AS device_limited_ad_tracking,
device.time_zone_offset_seconds AS device_time_zone_offset_seconds,
device.browser AS device_browser,
device.browser_version AS device_browser_version,
-- Device Web Info
device.web_info.browser AS device_web_browser,
device.web_info.hostname AS hostname,
-- Geo
geo.continent AS geo_continent,
geo.country AS geo_country,
geo.region AS geo_region,
geo.city AS geo_city,
geo.sub_continent AS geo_subcontinent,
geo.metro AS geo_metro,
-- User Source
traffic_source.source AS first_user_source,
traffic_source.medium AS first_user_medium,
traffic_source.name AS first_user_campaign,
-- Manual Source - Typically UTM & autotagged values - will often match 'session_source' fields
collected_traffic_source.manual_campaign_id AS manual_campaign_id,
collected_traffic_source.manual_campaign_name AS manual_campaign_name,
collected_traffic_source.manual_source AS manual_source,
collected_traffic_source.manual_medium AS manual_medium,
collected_traffic_source.manual_term AS manual_term,
collected_traffic_source.manual_content AS manual_content,
collected_traffic_source.gclid AS gclid,
collected_traffic_source.dclid AS dclid,
collected_traffic_source.srsltid AS srsltid,
/* --- Ecommerce (Optional) Keep or Remove entire section --- */
-- Item Properties
items [SAFE_OFFSET(0)].item_id AS item_id,
items [SAFE_OFFSET(0)].item_name AS item_name,
items [SAFE_OFFSET(0)].item_brand AS item_brand,
items [SAFE_OFFSET(0)].item_variant AS item_variant,
items [SAFE_OFFSET(0)].item_category AS item_category,
items [SAFE_OFFSET(0)].item_category2 AS item_category2,
items [SAFE_OFFSET(0)].item_category3 AS item_category3,
items [SAFE_OFFSET(0)].item_category4 AS item_category4,
items [SAFE_OFFSET(0)].item_category5 AS item_category5,
items [SAFE_OFFSET(0)].price_in_usd AS item_price_in_usd,
items [SAFE_OFFSET(0)].price AS item_price,
items [SAFE_OFFSET(0)].quantity AS item_quantity,
items [SAFE_OFFSET(0)].item_revenue_in_usd AS item_revenue_in_usd,
items [SAFE_OFFSET(0)].item_revenue AS item_revenue,
items [SAFE_OFFSET(0)].item_refund_in_usd AS item_refund_in_usd,
items [SAFE_OFFSET(0)].item_refund AS item_refund,
items [SAFE_OFFSET(0)].coupon AS item_coupon,
items [SAFE_OFFSET(0)].affiliation AS item_affiliation,
items [SAFE_OFFSET(0)].location_id AS location_id,
items [SAFE_OFFSET(0)].item_list_id AS item_list_id,
items [SAFE_OFFSET(0)].item_list_name AS item_list_name,
items [SAFE_OFFSET(0)].item_list_index AS item_list_index,
items [SAFE_OFFSET(0)].promotion_id AS item_promotion_id,
items [SAFE_OFFSET(0)].promotion_name AS item_promotion_name,
items [SAFE_OFFSET(0)].creative_name AS item_creative_name,
items [SAFE_OFFSET(0)].creative_slot AS item_creative_slot,
-- General Ecommerce
ecommerce.total_item_quantity AS ecommerce_total_item_quantity,
ecommerce.purchase_revenue_in_usd AS ecommerce_purchase_revenue_in_usd,
ecommerce.purchase_revenue AS ecommerce_purchase_revenue,
ecommerce.refund_value_in_usd AS ecommerce_refund_value_in_usd,
ecommerce.refund_value AS ecommerce_refund_value,
ecommerce.shipping_value_in_usd AS ecommerce_shipping_value_in_usd,
ecommerce.shipping_value AS ecommerce_shipping_value,
ecommerce.tax_value_in_usd AS ecommerce_tax_value_in_usd,
ecommerce.tax_value AS ecommerce_tax_value,
ecommerce.unique_items AS ecommerce_unique_items,
ecommerce.transaction_id AS ecommerce_transaction_id,
/* --- End of Ecommerce Section ---*/
/* -- Standard Event Params --*/
--Integer values
(select value.int_value from unnest(event_params) where key = 'ga_session_id') as ga_session_id,
(select value.int_value from unnest(event_params) where key = 'ga_session_number') as ga_session_number,
(select value.int_value from unnest(event_params) where key = 'entrances') as entrances,
(select value.int_value from unnest(event_params) where key = 'batch_page_id') as batch_page_id,
(select value.int_value from unnest(event_params) where key = 'batch_ordering_id') as batch_ordering_id,
-- String values
-- Page attributes
(select value.string_value from unnest(event_params) where key = 'page_location') as page_location,
(select value.string_value from unnest(event_params) where key = 'page_title') as page_title,
(select value.string_value from unnest(event_params) where key = 'page_referrer') as page_referrer,
-- Session source attributes
(select value.string_value from unnest(event_params) where key = 'source') as session_source,
(select value.string_value from unnest(event_params) where key = 'medium') as session_medium,
(select value.string_value from unnest(event_params) where key = 'campaign') as session_campaign,
-- Consent
(select value.string_value from unnest(event_params) where key = 'ad_personalization') as ad_personalization,
(select value.string_value from unnest(event_params) where key = 'analytics_storage') as analytics_storage,
(select value.string_value from unnest(event_params) where key = 'ads_storage') as ads_storage,
(select value.string_value from unnest(event_params) where key = 'ad_user_data') as ad_user_data,
/* -- Custom Parameters & Properties - add your own here -- */
/* -- Custom Event Parameters -- */
(select value.string_value from unnest(event_params) where key = '<insert key>') as event_string_value,
(select value.int_value from unnest(event_params) where key = '<insert key>') as event_integer_value,
/* -- Custom User Properties -- */
(select value.string_value from unnest(user_properties) where key = '<insert key>') as user_string_value,
(select value.int_value from unnest(user_properties) where key = '<insert key>') as user_integer_value,
/* -- Custom Item Parameters -- */
(select value.string_value from unnest(items[SAFE_OFFSET(0)].item_params) where key = '<insert key>') as item_string_value,
(select value.int_value from unnest(items[SAFE_OFFSET(0)].item_params) where key = '<insert key>') as item_integer_value,
from
-- Google Analytics 4 export dataset details BigQuery
`<projectame>.<datasetName>.events_*`
-- Example: 'flatquery.analytics_388448675.events_*'
) t1
-- End of query with ALL events
-- Or specify which events you want to 'Flatten'.
WHERE t1.event_name in
('session_start',
'page_view',
'purchase'
)
✅ Available in platform
Overview
'... it all started here'.
This is an important query. This query takes your standard GA4 event export dataset and generates a new one that is ‘flattened’ creating multiple new fields from the data as well as letting you extract the custom event parameters, item parameters and user properties stored within the standard export format.
This flattened dataset becomes the basis for further exploring your event data with further queries, dashboards or integrating it within to your wider tech stack.
Dataset Examples
The below examples show part of a standard GA4 export table for two page_view events and then the resultant effect of this query on the dataset schema. This is real data, taken from our own BigQuery GA4 export.
Default GA4 export:
event_date | event_timestamp | event_name | event_params.key | event_params.value.string_value | event_params.value.int_value | … |
---|---|---|---|---|---|---|
20231003 | 1696363218281734 | page_view | source | null | … | |
campaign | (organic) | null | … | |||
ga_session_id | null | 1696363873 | … | |||
page_referrer | https://www.google.com/ | null | … | |||
entrances | null | 1 | … | |||
page_title | FlatQuery | Welcome | null | … | |||
medium | organic | null | … | |||
ga_session_number | null | 1 | … | |||
page_location | https://flatquery.com | null | … | |||
20231003 | 1696363908064133 | page_view | source | null | … | |
campaign | (referral) | null | … | |||
ga_session_id | null | 1696328489 | … | |||
page_referrer | https://www.reddit.com/ | null | … | |||
entrances | null | 1 | … | |||
page_title | FlatQuery | Welcome | null | … | |||
medium | referral | null | … | |||
ga_session_number | null | 2 | … | |||
page_location | https://flatquery.com | null | … |
Flatten Query Result:
event_id | event_date | event_timestamp | event_name | ga_session_id | ga_session_number | entrances | page_location | page_title | page_referrer | session_source | session_medium | session_campaign | … |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1721590200436111BjhuDwxxISwlwCY4WqtAy+gJS460zasMiCBRmC9XCQM=.172159020090 | 20231003 | 1696363218281734 | page_view | 1696363873 | 1 | 1 | https://flatquery.com | FlatQuery | Welcome | https://www.google.com/ | organic | (organic) | … | |
1721590200436111BjhuDwxxISwlwCY4WqtAy+gJS460zasMiCBRmC9XCQM=.172159020096 | 20231003 | 1696363908064133 | page_view | 1696328489 | 2 | 1 | https://flatquery.com | FlatQuery | Welcome | https://www.reddit.com/ | referral | (referral) | … |
Field list
This query by default persists all existing fields and gives users the option to include enrichment fields as well as toggle ecommerce fields on or off.
Event General Fields
General | Privacy Info | App Info |
---|---|---|
event_id | privacy_info_analytics_storage | app_id |
event_date | privacy_info_ads_storage | app_version |
event_name | privacy_info_uses_transient_token | app_install_store |
event_timestamp | app_firebase_app_id | |
event_previous_timestamp | app_install_source | |
event_bundle_sequence_id | ||
event_server_timestamp_offset | ||
stream_id | ||
platform |
Event User Fields
User |
---|
user_id |
user_pseudo_id |
user_first_touch_timestamp |
user_ltv_revenue |
user_ltv_currency |
Event Device Fields
General Device | Mobile Device | Device Web Info |
---|---|---|
device_category | mobile_brand_name | device_web_browser |
device_os | mobile_model_name | hostname |
device_os_version | mobile_marketing_name | |
device_vendor_id | mobile_os_hardware_model | |
device_advertising_id | ||
device_language | ||
device_limited_ad_tracking | ||
device_time_zone_offset_seconds | ||
device_browser |
Event Geo (user location) Fields
Geo |
---|
geo_continent |
geo_country |
geo_region |
geo_city |
geo_subcontinent |
geo_metro |
Event Source Fields
User Source | Manual Source |
---|---|
first_user_source | manual_campaign_id |
first_user_medium | manual_campaign_name |
first_user_campaign | manual_source |
manual_medium | |
manual_term | |
manual_content | |
gclid | |
dclid | |
srsltid |
Event Ecommerce Fields
General Ecommerce | Item Properties |
---|---|
ecommerce_total_item_quantity | item_id |
ecommerce_purchase_revenue_in_usd | item_name |
ecommerce_purchase_revenue | item_brand |
ecommerce_refund_value_in_usd | item_variant |
ecommerce_refund_value | item_category |
ecommerce_shipping_value_in_usd | item_category2 |
ecommerce_shipping_value | item_category3 |
ecommerce_tax_value_in_usd | item_category4 |
ecommerce_tax_value | item_category5 |
ecommerce_unique_items | item_price_in_usd |
ecommerce_transaction_id | item_price |
item_quantity | |
item_revenue_in_usd | |
item_revenue | |
item_refund_in_usd | |
item_refund | |
item_coupon | |
item_affiliation | |
location_id | |
item_list_id | |
item_list_name | |
item_list_index | |
item_promotion_id | |
item_promotion_name | |
item_creative_name | |
item_creative_slot | |
item_creative_slot |
Event Parameters - automatically extracted
Page attributes | Session values | Session source attributes | Consent attributes |
---|---|---|---|
page_location | ga_session_id | session_source | ad_personalization |
page_title | ga_session_number | session_medium | analytics_storage |
page_referrer | entrances | session_campaign | ads_storage |
batch_page_id | ad_user_data | ||
batch_ordering_id |
Event Enrichment Fields (optional)
Because this query is the full event schema, every optional enrichment field is included. See the full scope of these Enrichment fields earlier in the documentation here.
⏳ Coming soon
We've got a whole host of features in the pipeline.
Reports
- Acquisition
- Session
- User
- Content
- Ecommerce
Features
- Accounts and sub-accounts (perfect for agencies managing multiple clients)
- Account level attributes to be used across queries
- Integrations
- Community insights