[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"blogEntry::product\u002Fgoogle-analytics-bigquery:en":3},{"title":4,"slug":5,"description":6,"body":7,"author":8,"category":9,"urlCategorySlug":13,"coverImageUrl":14,"ogImageUrl":14,"createdAt":15,"updatedAt":16,"datePublished":17,"locale":18},"The Definitive Guide to Advanced Google Analytics for 2025","google-analytics-bigquery","How to export Google Analytics data to BigQuery and integrate it with your company's data for advanced analysis? We cover schema details, data integration methods, and practical techniques for visualizing the complete picture of customer behavior.","\u003Cp>How to export Google Analytics data to BigQuery and integrate it with your company's data for advanced analysis? We cover schema details, data integration methods, and practical techniques for visualizing the complete picture of customer behavior.\u003C\u002Fp>\u003Ch2>The Importance of Exporting Google Analytics to BigQuery\u003C\u002Fh2>\u003Cp>Google Analytics 4 (GA4) is a standard analytics tool used by many websites and applications. However, the standard GA4 interface has limitations when it comes to deeper data analysis and flexible data utilization. This is where the BigQuery export function becomes extremely important.\u003C\u002Fp>\u003Ch3>Use Cases\u003C\u002Fh3>\u003Cp>Here are specific benefits and use cases for GA4 data exported to BigQuery:\u003C\u002Fp>\u003Col>\u003Cli>\u003Cp>\u003Cb>Integrated Data Analysis\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Integrate data from sites, apps, and internal systems in one place to comprehensively understand customer behavior.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cb>Long-term User Behavior Analysis\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: While the GA4 UI has period limitations, BigQuery allows you to retain and analyze user behavior history over extended periods.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cb>Advanced Segment Analysis\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Leverage BigQuery's SQL to extract user segments with complex conditions that would be difficult through the GA4 UI.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cb>Custom Metric Creation\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Freely define and calculate complex metrics based on your unique business logic.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cb>Integrated Dashboard Building\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Connect with various BI tools to build a single dashboard integrating GA4 data with internal data.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cb>Detailed Conversion Analysis\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Analyze complex purchase paths and exit points in detail to optimize conversions.\u003C\u002Fp>\u003C\u002Fli>\u003C\u002Fol>\u003Ch2>Schema\u003C\u002Fh2>\u003Cp>The data exported from GA4 to BigQuery has a unique schema structure. Here we'll explain the schema related primarily to web events.\u003C\u002Fp>\u003Cp>\n\u003Cdiv class=\"LinkPreview_Wrapper\">\n  \u003Ca class=\"LinkPreview\" href=\"https:\u002F\u002Fsupport.google.com\u002Fanalytics\u002Fanswer\u002F9234069\" target=\"_blank\" rel=\"noopener noreferrer\">\n    \u003Cstrong class=\"LinkPreview_Title\">Automatically collected events - Analytics Help\u003C\u002Fstrong>\n    \u003Cem class=\"LinkPreview_Description\">Automatically collected events are triggered by basic interactions with your app and\u002For site (as indicated under the event name in the table below). As long as you use the Google tag or the Google Ana\u003C\u002Fem>\n    \u003Cdiv class=\"LinkPreview_HostnameWrapper\">\n      \u003Cimg class=\"LinkPreview_Favicon\" src=\"https:\u002F\u002Fwww.google.com\u002Fs2\u002Ffavicons?domain=support.google.com&amp;sz=12\" alt=\"support.google.com\">\n      \u003Cem class=\"LinkPreview_Hostname\">support.google.com\u003C\u002Fem>\n    \u003C\u002Fdiv>\n  \u003C\u002Fa>\n  \n\u003C\u002Fdiv>\n\u003C\u002Fp>\u003Ch3>Event Types\u003C\u002Fh3>\u003Cp>GA4 records various events, but here are the main event types that are particularly useful:\u003C\u002Fp>\u003Cul>\u003Cli>\u003Cp>\u003Cb>page_view\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Event that occurs when a user views a page\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cb>session_start\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Event recorded at the start of a user session\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cb>first_visit\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Event recorded during a user's first visit\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cb>form_submit\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Event that occurs when a form is submitted\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cb>user_engagement\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Event recorded when a user interacts with content\u003C\u002Fp>\u003C\u002Fli>\u003C\u002Ful>\u003Ch3>Key Columns\u003C\u002Fh3>\u003Ch4>event_name\u003C\u002Fh4>\u003Cp>A string indicating the type of event. The event types explained above (page_view, session_start, etc.) are stored here.\u003C\u002Fp>\u003Ch4>event_date\u003C\u002Fh4>\u003Cp>Indicates the date the event occurred. Note that this column is stored as a \u003Cb>STRING type\u003C\u002Fb> (YYYYMMDD format). Conversion is necessary when computing as a date:\u003C\u002Fp>\u003Cpre>\u003Ccode class=\"hljs language-sql\">\u003Cspan class=\"hljs-keyword\">SELECT\u003C\u002Fspan>\n  PARSE_DATE(\"%Y%m%d\", event_date) \u003Cspan class=\"hljs-keyword\">as\u003C\u002Fspan> event_date \n\u003Cspan class=\"hljs-keyword\">FROM\u003C\u002Fspan> ...\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch4>event_timestamp\u003C\u002Fh4>\u003Cp>An \u003Cb>INT64 type\u003C\u002Fb> value that records the exact time the event occurred in microseconds. It represents the elapsed time from the UNIX epoch (January 1, 1970) in microseconds.\u003C\u002Fp>\u003Ch4>event_params\u003C\u002Fh4>\u003Cp>A complex structure that stores detailed parameters related to the event. The structure of this field is somewhat special, with the following structure:\u003C\u002Fp>\u003Cpre>\u003Ccode class=\"hljs\">\u003Cspan class=\"hljs-keyword\">ARRAY\u003C\u002Fspan>\u003Cspan class=\"hljs-operator\">&lt;\u003C\u002Fspan>STRUCT\u003Cspan class=\"hljs-operator\">&lt;\u003C\u002Fspan>\n        key STRING,\n        \u003Cspan class=\"hljs-keyword\">value\u003C\u002Fspan> STRUCT\u003Cspan class=\"hljs-operator\">&lt;\u003C\u002Fspan>\n            string_value STRING,\n            int_value INT64,\n            float_value FLOAT64,\n            double_value FLOAT64\n        \u003Cspan class=\"hljs-operator\">&gt;\u003C\u002Fspan>\n    \u003Cspan class=\"hljs-operator\">&gt;\u003C\u002Fspan>\n\u003Cspan class=\"hljs-operator\">&gt;\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>Each parameter is a key-value pair, with values stored in different fields (string_value, int_value, etc.) depending on the type. This structure contains important properties, so we'll explain how to extract them in the \"Data Handling Techniques\" section.\u003C\u002Fp>\u003Ch4>user_pseudo_id\u003C\u002Fh4>\u003Cp>A pseudo-ID value used to identify users. This ID is generated for each device and browser and functions as a cookie-based identifier. A new ID is generated when users delete cookies or use a different device or browser.\u003C\u002Fp>\u003Cp>\n\u003Cdiv class=\"LinkPreview_Wrapper\">\n  \u003Ca class=\"LinkPreview\" href=\"https:\u002F\u002Fwww.optizent.com\u002Fblog\u002Fwhat-is-user_pseudo_id-in-ga4-bigquery-export\u002F\" target=\"_blank\" rel=\"noopener noreferrer\">\n    \u003Cstrong class=\"LinkPreview_Title\">What is user_pseudo_id in GA4 BigQuery Export? - Optizent\u003C\u002Fstrong>\n    \u003Cem class=\"LinkPreview_Description\">When you send GA4 data to BigQuery then you will see two user id columns in the table that’s created…\u003C\u002Fem>\n    \u003Cdiv class=\"LinkPreview_HostnameWrapper\">\n      \u003Cimg class=\"LinkPreview_Favicon\" src=\"https:\u002F\u002Fwww.google.com\u002Fs2\u002Ffavicons?domain=www.optizent.com&amp;sz=12\" alt=\"www.optizent.com\">\n      \u003Cem class=\"LinkPreview_Hostname\">www.optizent.com\u003C\u002Fem>\n    \u003C\u002Fdiv>\n  \u003C\u002Fa>\n  \u003Ca class=\"LinkPreview_Image\" href=\"https:\u002F\u002Fwww.optizent.com\u002Fblog\u002Fwhat-is-user_pseudo_id-in-ga4-bigquery-export\u002F\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"background-image: url('https:\u002F\u002Fwww.optizent.com\u002Fwp-content\u002Fuploads\u002F2022\u002F12\u002Fuser-identity-2.png')\">\u003C\u002Fa>\n\u003C\u002Fdiv>\n\u003C\u002Fp>\u003Ch4>user_id\u003C\u002Fh4>\u003Cp>The actual user ID explicitly set when a site or app implements user authentication. This allows for more accurate user analysis by tracking the same user across devices. It can also be used for data integration with other internal systems.\u003C\u002Fp>\u003Ch4>Other Important Columns\u003C\u002Fh4>\u003Cul>\u003Cli>\u003Cp>\u003Cb>device\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Information about device type, browser, operating system, etc.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cb>geo\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Geographic information such as country, region, city, etc.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cb>traffic_source\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Information about the traffic source\u003C\u002Fp>\u003C\u002Fli>\u003C\u002Ful>\u003Cp>There are other columns that could be used, but they are not well-documented, so you need to discover them empirically by examining the data.\u003C\u002Fp>\u003Cp>\n\u003Cdiv class=\"LinkPreview_Wrapper\">\n  \u003Ca class=\"LinkPreview\" href=\"https:\u002F\u002Fsupport.google.com\u002Fanalytics\u002Fanswer\u002F7029846\" target=\"_blank\" rel=\"noopener noreferrer\">\n    \u003Cstrong class=\"LinkPreview_Title\">BigQuery Export schema - Analytics Help\u003C\u002Fstrong>\n    \u003Cem class=\"LinkPreview_Description\">This article explains the format and schema of the Google Analytics property data and the Google Analytics for Firebase data that is exported to BigQuery. Datasets For each Google Analytics propert\u003C\u002Fem>\n    \u003Cdiv class=\"LinkPreview_HostnameWrapper\">\n      \u003Cimg class=\"LinkPreview_Favicon\" src=\"https:\u002F\u002Fwww.google.com\u002Fs2\u002Ffavicons?domain=support.google.com&amp;sz=12\" alt=\"support.google.com\">\n      \u003Cem class=\"LinkPreview_Hostname\">support.google.com\u003C\u002Fem>\n    \u003C\u002Fdiv>\n  \u003C\u002Fa>\n  \n\u003C\u002Fdiv>\n\u003C\u002Fp>\u003Cp>This site is partially paid, but it provides a somewhat comprehensive explanation of the schema.\u003C\u002Fp>\u003Cp>\n\u003Cdiv class=\"LinkPreview_Wrapper\">\n  \u003Ca class=\"LinkPreview\" href=\"https:\u002F\u002Fwww.ga4bigquery.com\u002Fgeo-location-dimensions-metrics-ga4\u002F\" target=\"_blank\" rel=\"noopener noreferrer\">\n    \u003Cstrong class=\"LinkPreview_Title\">Geo location dimensions &amp; metrics (GA4)\u003C\u002Fstrong>\n    \u003Cem class=\"LinkPreview_Description\">How to query the most important geo location dimensions and metrics from the GA4 BigQuery export, like continent, country, region and city.\u003C\u002Fem>\n    \u003Cdiv class=\"LinkPreview_HostnameWrapper\">\n      \u003Cimg class=\"LinkPreview_Favicon\" src=\"https:\u002F\u002Fwww.google.com\u002Fs2\u002Ffavicons?domain=www.ga4bigquery.com&amp;sz=12\" alt=\"www.ga4bigquery.com\">\n      \u003Cem class=\"LinkPreview_Hostname\">www.ga4bigquery.com\u003C\u002Fem>\n    \u003C\u002Fdiv>\n  \u003C\u002Fa>\n  \u003Ca class=\"LinkPreview_Image\" href=\"https:\u002F\u002Fwww.ga4bigquery.com\u002Fgeo-location-dimensions-metrics-ga4\u002F\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"background-image: url('https:\u002F\u002Fstorage.ghost.io\u002Fc\u002F0b\u002Ff4\u002F0bf41b02-4af7-474c-b847-e8f424aa733d\u002Fcontent\u002Fimages\u002F2022\u002F11\u002Fga4bigquery-logo.png')\">\u003C\u002Fa>\n\u003C\u002Fdiv>\n\u003C\u002Fp>\u003Ch2>Data Handling Techniques\u003C\u002Fh2>\u003Cp>GA4's BigQuery export data has a unique structure, so here are techniques for efficient analysis.\u003C\u002Fp>\u003Ch3>Using TABLE_SUFFIX\u003C\u002Fh3>\u003Cp>GA4 data is stored in separate tables for each date (with naming conventions like events_20250401). Using TABLE_SUFFIX to specify a specific period narrows the scan range and improves query performance. It's recommended to always include this:\u003C\u002Fp>\u003Cpre>\u003Ccode class=\"hljs language-sql\">\u003Cspan class=\"hljs-keyword\">SELECT\u003C\u002Fspan>\n  \u003Cspan class=\"hljs-operator\">*\u003C\u002Fspan>\n\u003Cspan class=\"hljs-keyword\">FROM\u003C\u002Fspan> `bigquery\u003Cspan class=\"hljs-operator\">-\u003C\u002Fspan>public\u003Cspan class=\"hljs-operator\">-\u003C\u002Fspan>data.ga4_obfuscated_sample_ecommerce.events_\u003Cspan class=\"hljs-operator\">*\u003C\u002Fspan>`\n\u003Cspan class=\"hljs-keyword\">WHERE\u003C\u002Fspan> _TABLE_SUFFIX \u003Cspan class=\"hljs-keyword\">BETWEEN\u003C\u002Fspan> \u003Cspan class=\"hljs-string\">'20201101'\u003C\u002Fspan> \u003Cspan class=\"hljs-keyword\">AND\u003C\u002Fspan> \u003Cspan class=\"hljs-string\">'20201201'\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch3>Parsing event_params\u003C\u002Fh3>\u003Cp>The event_params field has a complex structure. For frequently used parameters, it's convenient to extract them using subqueries that filter by key.\u003C\u002Fp>\u003Cp>Here's an example of extracting the \u003Ccode class=\"hljs\">page_location\u003C\u002Fcode> (URL at the time of event sending) from a commonly used \u003Ccode class=\"hljs\">page_view\u003C\u002Fcode> event:\u003C\u002Fp>\u003Cpre>\u003Ccode class=\"hljs language-sql\">\u003Cspan class=\"hljs-keyword\">SELECT\u003C\u002Fspan>\n  (\n    \u003Cspan class=\"hljs-keyword\">SELECT\u003C\u002Fspan>\n      param.value.string_value,\n    \u003Cspan class=\"hljs-keyword\">FROM\u003C\u002Fspan>\n      \u003Cspan class=\"hljs-built_in\">UNNEST\u003C\u002Fspan>(event_params) \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> param\n    \u003Cspan class=\"hljs-keyword\">WHERE\u003C\u002Fspan>\n      param.key \u003Cspan class=\"hljs-operator\">=\u003C\u002Fspan> \u003Cspan class=\"hljs-string\">'page_location'\u003C\u002Fspan>\n  )\n  \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> page_location,\n  \u003Cspan class=\"hljs-operator\">*\u003C\u002Fspan>\n\u003Cspan class=\"hljs-keyword\">FROM\u003C\u002Fspan>\n\u003Cspan class=\"hljs-keyword\">WHERE\u003C\u002Fspan>\n  event_name \u003Cspan class=\"hljs-operator\">=\u003C\u002Fspan> \u003Cspan class=\"hljs-string\">'page_view'\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch3>Parsing domain and path\u003C\u002Fh3>\u003Cp>To analyze URL information, you can extract various parts (domain, path, query parameters, etc.) from the page_location parameter using regular expressions. This enables detailed analysis based on specific URL patterns.\u003C\u002Fp>\u003Cp>The following extracts domain, path, and query parameters from page_location. Additionally, the path is divided into an array in path_segments since path may have a tree structure where the top directory may hold important meaning:\u003C\u002Fp>\u003Cpre>\u003Ccode class=\"hljs language-sql\">\u003Cspan class=\"hljs-keyword\">SELECT\u003C\u002Fspan>\n  \u003Cspan class=\"hljs-comment\">-- page info\u003C\u002Fspan>\n  REGEXP_EXTRACT(page_location, r\u003Cspan class=\"hljs-string\">'^https?:\u002F\u002F([^\u002F]+)'\u003C\u002Fspan>) \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> domain,\n  REGEXP_EXTRACT(page_location, r\u003Cspan class=\"hljs-string\">'^https?:\u002F\u002F[^\u002F]+(\u002F[^?]*)'\u003C\u002Fspan>) \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> path,\n  REGEXP_EXTRACT(page_location, r\u003Cspan class=\"hljs-string\">'\\?(.*)$'\u003C\u002Fspan>) \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> query_params,\n  SPLIT(SUBSTR(REGEXP_EXTRACT(page_location, r\u003Cspan class=\"hljs-string\">'^https?:\u002F\u002F[^\u002F]+(\u002F[^?]*)'\u003C\u002Fspan>), \u003Cspan class=\"hljs-number\">2\u003C\u002Fspan>), \u003Cspan class=\"hljs-string\">'\u002F'\u003C\u002Fspan>) \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> path_segments,\n  \u003Cspan class=\"hljs-comment\">-- device info\u003C\u002Fspan>\n  device.category \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> device_category,\n  device.operating_system \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> device_os,\n  device.language \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> device_language,\n  device.web_info.browser \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> device_browser,\n  \u003Cspan class=\"hljs-comment\">-- geo info\u003C\u002Fspan>\n  geo.continent \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> geo_continent,\n  geo.country \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> geo_country,\n  geo.region \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> geo_region,\n  geo.city \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> geo_city,\n  \u003Cspan class=\"hljs-comment\">-- source info\u003C\u002Fspan>\n  traffic_source.medium \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> source_medium,\n  traffic_source.source \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> source_name,\n  \u003Cspan class=\"hljs-operator\">*\u003C\u002Fspan>,\n\u003Cspan class=\"hljs-keyword\">FROM\u003C\u002Fspan>\n...\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>Official Sample Code (Query Cookbook)\u003C\u002Fh2>\u003Cp>Google's official documentation provides examples of basic queries. Here's a brief introduction to what's available:\u003C\u002Fp>\u003Cp>\n\u003Cdiv class=\"LinkPreview_Wrapper\">\n  \u003Ca class=\"LinkPreview\" href=\"https:\u002F\u002Fdevelopers.google.com\u002Fanalytics\u002Fbigquery\u002Fbasic-queries\" target=\"_blank\" rel=\"noopener noreferrer\">\n    \u003Cstrong class=\"LinkPreview_Title\">Basic queries for Google Analytics event data export &nbsp;|&nbsp; Google for Developers\u003C\u002Fstrong>\n    \u003Cem class=\"LinkPreview_Description\">\u003C\u002Fem>\n    \u003Cdiv class=\"LinkPreview_HostnameWrapper\">\n      \u003Cimg class=\"LinkPreview_Favicon\" src=\"https:\u002F\u002Fwww.google.com\u002Fs2\u002Ffavicons?domain=developers.google.com&amp;sz=12\" alt=\"developers.google.com\">\n      \u003Cem class=\"LinkPreview_Hostname\">developers.google.com\u003C\u002Fem>\n    \u003C\u002Fdiv>\n  \u003C\u002Fa>\n  \u003Ca class=\"LinkPreview_Image\" href=\"https:\u002F\u002Fdevelopers.google.com\u002Fanalytics\u002Fbigquery\u002Fbasic-queries\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"background-image: url('https:\u002F\u002Fwww.gstatic.com\u002Fdevrel-devsite\u002Fprod\u002Fv24818332c90d61e5d34a589b2829727722a413c578565f115ef1e5a51367c594\u002Fdevelopers\u002Fimages\u002Fopengraph\u002Fwhite.png')\">\u003C\u002Fa>\n\u003C\u002Fdiv>\n\u003C\u002Fp>\u003Ch3>Basic Queries\u003C\u002Fh3>\u003Cul>\u003Cli>\u003Cp>\u003Cb>Specific Period Queries\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Queries to extract data for a specific date range\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cb>User Count and New User Count\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Queries to aggregate total users and new users\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cb>Average Transactions per Purchasing User\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Queries to calculate the average number of purchases per user\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cb>Values for Specific Event Names\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Queries to aggregate the frequency of event types\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cb>Top 10 Items Added to Cart\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Queries to analyze popular products by cart additions\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cb>Average Page Views by Purchaser Type\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Queries to compare page-viewing behavior of purchasers and non-purchasers\u003C\u002Fp>\u003C\u002Fli>\u003C\u002Ful>\u003Ch3>Advanced Event Queries\u003C\u002Fh3>\u003Cul>\u003Cli>\u003Cp>\u003Cb>Products Purchased by Users Who Purchased a Specific Product\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Queries for cross-sell analysis\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cb>Average Purchase Amount per Session for Each User\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Queries for session-based purchase analysis\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cb>Latest Session ID and Session Number for Users\u003C\u002Fb>\u003C\u002Fp>\u003Cp>: Queries to track the latest user behavior\u003C\u002Fp>\u003C\u002Fli>\u003C\u002Ful>\u003Cp>I won't go into detail on individual queries here, but they mainly cover basics and e-commerce cases, so check them out if you're interested.\u003C\u002Fp>\u003Cp>I think seeing queries along with their execution results helps create a better image, so for example, if you run the 'Specific Period Query' mentioned above in Codatum, it would look like this:\u003C\u002Fp>\n              \u003Ciframe src=\"https:\u002F\u002Fapp.codatum.com\u002Fpublic\u002Fworkspace\u002F6683260fe9a1b289052c4dec\u002Flink\u002F67fdc8b290813f2ecdfc7886\u002Fnotebook\u002F67fdc72829fcffc3699ffd80\u002F67fdc72829fcffc3699ffd81\u002F?h=none&amp;thm=DARK&amp;ts=1744695406133\" title=\"Google アナリティクスを使った分析例\" width=\"100%\" height=\"880px\" class=\"EmbeddedContent_Iframe\" frameborder=\"0\" sandbox=\"allow-scripts allow-same-origin allow-popups allow-modals allow-orientation-lock allow-presentation\" loading=\"lazy\" referrerpolicy=\"no-referrer\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"\">\u003C\u002Fiframe>\n            \u003Ch2>Basic Analysis Example\u003C\u002Fh2>\u003Ch3>Basic View-related Dashboard\u003C\u002Fh3>\u003Cp>Using the techniques and sample code explained so far, you can create a simple dashboard like the one shown. \u003C\u002Fp>\n              \u003Ciframe src=\"https:\u002F\u002Fapp.codatum.com\u002Fpublic\u002Fworkspace\u002F6683260fe9a1b289052c4dec\u002Flink\u002F67fe0aba65b7bd03bd4ba79a\u002Fnotebook\u002F67fdc72829fcffc3699ffd80\u002F67fdf61651fa3e2ca7d8f2a2\u002F?h=none&amp;thm=DARK&amp;ts=1744702138211\" title=\"GA4 dashboard\" width=\"100%\" height=\"1200\" class=\"EmbeddedContent_Iframe\" frameborder=\"0\" sandbox=\"allow-scripts allow-same-origin allow-popups allow-modals allow-orientation-lock allow-presentation\" loading=\"lazy\" referrerpolicy=\"no-referrer\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"\">\u003C\u002Fiframe>\n            \u003Ch3>E-commerce Analysis Reports &amp; Dashboards\u003C\u002Fh3>\u003Cp>Additionally, we have templated an e-commerce analysis dashboard using BigQuery's official sample dataset, complete with SQL code and conceptual approach. Please check this out as well.\u003C\u002Fp>\u003Cp>\n\u003Cdiv class=\"LinkPreview_Wrapper\">\n  \u003Ca class=\"LinkPreview\" href=\"https:\u002F\u002Fcodatum.com\u002Ftemplates\u002Fux-in-e-commerce\" target=\"_blank\" rel=\"noopener noreferrer\">\n    \u003Cstrong class=\"LinkPreview_Title\">UX in E-Commerce - Codatum\u003C\u002Fstrong>\n    \u003Cem class=\"LinkPreview_Description\">A case study of analyzing UX based on publicly available data from Google Analytics and considering how to use it for e-commerce\u003C\u002Fem>\n    \u003Cdiv class=\"LinkPreview_HostnameWrapper\">\n      \u003Cimg class=\"LinkPreview_Favicon\" src=\"https:\u002F\u002Fwww.google.com\u002Fs2\u002Ffavicons?domain=codatum.com&amp;sz=12\" alt=\"codatum.com\">\n      \u003Cem class=\"LinkPreview_Hostname\">codatum.com\u003C\u002Fem>\n    \u003C\u002Fdiv>\n  \u003C\u002Fa>\n  \u003Ca class=\"LinkPreview_Image\" href=\"https:\u002F\u002Fcodatum.com\u002Ftemplates\u002Fux-in-e-commerce\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"background-image: url('https:\u002F\u002Fimages.ctfassets.net\u002Fggtw2zqmifs5\u002F4SAbY9IAoThQJ63KcOitln\u002F12eb0149dbdae55fe5eec67135305c8a\u002Fog.png')\">\u003C\u002Fa>\n\u003C\u002Fdiv>\n\u003C\u002Fp>\u003Ch2>Advanced Analysis Example\u003C\u002Fh2>\u003Cp>Now let's look at advanced analysis methods using GA4 data with specific examples.\u003C\u002Fp>\u003Ch3>Integration with Company Data (CRM, etc.)\u003C\u002Fh3>\u003Cp>By connecting online user behavior data obtained from GA4 with internal CRM data or sales management system data, a more comprehensive understanding of customers becomes possible.\u003C\u002Fp>\u003Ch4>Basic Concept of Data Integration\u003C\u002Fh4>\u003Cp>To link GA4 data with internal data, a common key is needed. In many cases, integration is done through the following methods:\u003C\u002Fp>\u003Cul>\u003Cli>\u003Cp>\u003Cb>Link GA4&#39;s user_id with the company system&#39;s customer_id\u003C\u002Fb>\u003C\u002Fp>\u003Cp>Set the user ID in the internal system as the user_id field in GA4 for logged-in users.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cb>Join in the Data Warehouse\u003C\u002Fb>\u003C\u002Fp>\u003Cp>Join GA4 data exported to BigQuery with internal data.\u003C\u002Fp>\u003C\u002Fli>\u003C\u002Ful>\u003Cp>Here's an example of hypothetical SQL (for illustration purposes only):\u003C\u002Fp>\u003Cpre>\u003Ccode class=\"hljs language-sql\">\u003Cspan class=\"hljs-keyword\">SELECT\u003C\u002Fspan>\n  ga.user_id,\n  crm.customer_id,\n  crm.customer_segment,\n  crm.membership_level,\n  ga.event_name,\n  ga.event_timestamp\n\u003Cspan class=\"hljs-keyword\">FROM\u003C\u002Fspan>\n  `project_id.ga4_dataset.events_\u003Cspan class=\"hljs-operator\">*\u003C\u002Fspan>` \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> ga\n\u003Cspan class=\"hljs-keyword\">JOIN\u003C\u002Fspan>\n  `project_id.crm_dataset.customer_master` \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> crm\n\u003Cspan class=\"hljs-keyword\">ON\u003C\u002Fspan>\n  ga.user_id \u003Cspan class=\"hljs-operator\">=\u003C\u002Fspan> crm.web_user_id\n\u003Cspan class=\"hljs-keyword\">WHERE\u003C\u002Fspan>\n  _TABLE_SUFFIX \u003Cspan class=\"hljs-keyword\">BETWEEN\u003C\u002Fspan> \u003Cspan class=\"hljs-string\">'20250301'\u003C\u002Fspan> \u003Cspan class=\"hljs-keyword\">AND\u003C\u002Fspan> \u003Cspan class=\"hljs-string\">'20250331'\u003C\u002Fspan>\n  \u003Cspan class=\"hljs-keyword\">AND\u003C\u002Fspan> ga.user_id \u003Cspan class=\"hljs-keyword\">IS\u003C\u002Fspan> \u003Cspan class=\"hljs-keyword\">NOT\u003C\u002Fspan> \u003Cspan class=\"hljs-keyword\">NULL\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch3>Detailed Analysis through Customer Attribute Data Integration\u003C\u002Fh3>\u003Cp>By connecting customer attribute data stored in your CRM with GA4 data, it becomes possible to analyze user behavior by different user attributes.\u003C\u002Fp>\u003Cpre>\u003Ccode class=\"hljs language-sql\">\u003Cspan class=\"hljs-keyword\">SELECT\u003C\u002Fspan>\n  crm.customer_segment,\n  \u003Cspan class=\"hljs-built_in\">COUNT\u003C\u002Fspan>(\u003Cspan class=\"hljs-keyword\">DISTINCT\u003C\u002Fspan> ga.user_id) \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> unique_users,\n  \u003Cspan class=\"hljs-built_in\">COUNT\u003C\u002Fspan>(\u003Cspan class=\"hljs-operator\">*\u003C\u002Fspan>) \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> total_events,\n  \u003Cspan class=\"hljs-built_in\">COUNT\u003C\u002Fspan>(\u003Cspan class=\"hljs-keyword\">CASE\u003C\u002Fspan> \u003Cspan class=\"hljs-keyword\">WHEN\u003C\u002Fspan> ga.event_name \u003Cspan class=\"hljs-operator\">=\u003C\u002Fspan> \u003Cspan class=\"hljs-string\">'page_view'\u003C\u002Fspan> \u003Cspan class=\"hljs-keyword\">THEN\u003C\u002Fspan> \u003Cspan class=\"hljs-number\">1\u003C\u002Fspan> \u003Cspan class=\"hljs-keyword\">END\u003C\u002Fspan>) \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> pageviews,\n  \u003Cspan class=\"hljs-built_in\">COUNT\u003C\u002Fspan>(\u003Cspan class=\"hljs-keyword\">CASE\u003C\u002Fspan> \u003Cspan class=\"hljs-keyword\">WHEN\u003C\u002Fspan> ga.event_name \u003Cspan class=\"hljs-operator\">=\u003C\u002Fspan> \u003Cspan class=\"hljs-string\">'purchase'\u003C\u002Fspan> \u003Cspan class=\"hljs-keyword\">THEN\u003C\u002Fspan> \u003Cspan class=\"hljs-number\">1\u003C\u002Fspan> \u003Cspan class=\"hljs-keyword\">END\u003C\u002Fspan>) \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> purchases,\n  \u003Cspan class=\"hljs-built_in\">SUM\u003C\u002Fspan>(\u003Cspan class=\"hljs-keyword\">CASE\u003C\u002Fspan> \n      \u003Cspan class=\"hljs-keyword\">WHEN\u003C\u002Fspan> ga.event_name \u003Cspan class=\"hljs-operator\">=\u003C\u002Fspan> \u003Cspan class=\"hljs-string\">'purchase'\u003C\u002Fspan> \u003Cspan class=\"hljs-keyword\">THEN\u003C\u002Fspan> (\n        \u003Cspan class=\"hljs-keyword\">SELECT\u003C\u002Fspan> param.value.double_value\n        \u003Cspan class=\"hljs-keyword\">FROM\u003C\u002Fspan> \u003Cspan class=\"hljs-built_in\">UNNEST\u003C\u002Fspan>(ga.event_params) \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> param\n        \u003Cspan class=\"hljs-keyword\">WHERE\u003C\u002Fspan> param.key \u003Cspan class=\"hljs-operator\">=\u003C\u002Fspan> \u003Cspan class=\"hljs-string\">'value'\u003C\u002Fspan>\n      )\n      \u003Cspan class=\"hljs-keyword\">ELSE\u003C\u002Fspan> \u003Cspan class=\"hljs-number\">0\u003C\u002Fspan>\n    \u003Cspan class=\"hljs-keyword\">END\u003C\u002Fspan>) \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> total_revenue\n\u003Cspan class=\"hljs-keyword\">FROM\u003C\u002Fspan>\n  `project_id.ga4_dataset.events_\u003Cspan class=\"hljs-operator\">*\u003C\u002Fspan>` \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> ga\n\u003Cspan class=\"hljs-keyword\">JOIN\u003C\u002Fspan>\n  `project_id.crm_dataset.customer_master` \u003Cspan class=\"hljs-keyword\">AS\u003C\u002Fspan> crm\n\u003Cspan class=\"hljs-keyword\">ON\u003C\u002Fspan>\n  ga.user_id \u003Cspan class=\"hljs-operator\">=\u003C\u002Fspan> crm.web_user_id\n\u003Cspan class=\"hljs-keyword\">WHERE\u003C\u002Fspan>\n  _TABLE_SUFFIX \u003Cspan class=\"hljs-keyword\">BETWEEN\u003C\u002Fspan> \u003Cspan class=\"hljs-string\">'20250301'\u003C\u002Fspan> \u003Cspan class=\"hljs-keyword\">AND\u003C\u002Fspan> \u003Cspan class=\"hljs-string\">'20250331'\u003C\u002Fspan>\n\u003Cspan class=\"hljs-keyword\">GROUP\u003C\u002Fspan> \u003Cspan class=\"hljs-keyword\">BY\u003C\u002Fspan>\n  crm.customer_segment\n\u003Cspan class=\"hljs-keyword\">ORDER\u003C\u002Fspan> \u003Cspan class=\"hljs-keyword\">BY\u003C\u002Fspan>\n  total_revenue \u003Cspan class=\"hljs-keyword\">DESC\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>This integration allows you to analyze online behavior data measured in GA4 together with customer attribute information stored in CRM (member rank, purchase history, customer segments, etc.).\u003C\u002Fp>\u003Cp>This enables more detailed and valuable analysis, such as \"pages most viewed by gold members\" or \"recent site behavior patterns of users who purchased in the last 3 months.\"\u003C\u002Fp>\u003Ch2>Notes on Numerical Consistency with Google Analytics UI\u003C\u002Fh2>\u003Cp>There are often discrepancies between the figures displayed in the GA4 UI and those calculated from BigQuery export data. These differences can arise from sampling, approximations, and other factors that should be kept in mind.\u003C\u002Fp>\u003Cp>\n\u003Cdiv class=\"LinkPreview_Wrapper\">\n  \u003Ca class=\"LinkPreview\" href=\"https:\u002F\u002Fdevelopers.google.com\u002Fanalytics\u002Fblog\u002F2023\u002Fbigquery-vs-ui?hl=ja\" target=\"_blank\" rel=\"noopener noreferrer\">\n    \u003Cstrong class=\"LinkPreview_Title\">Google アナリティクスの UI と BigQuery エクスポートのギャップを埋める &nbsp;|&nbsp; Google Analytics &nbsp;|&nbsp; Google for Developers\u003C\u002Fstrong>\n    \u003Cem class=\"LinkPreview_Description\">\u003C\u002Fem>\n    \u003Cdiv class=\"LinkPreview_HostnameWrapper\">\n      \u003Cimg class=\"LinkPreview_Favicon\" src=\"https:\u002F\u002Fwww.google.com\u002Fs2\u002Ffavicons?domain=developers.google.com&amp;sz=12\" alt=\"developers.google.com\">\n      \u003Cem class=\"LinkPreview_Hostname\">developers.google.com\u003C\u002Fem>\n    \u003C\u002Fdiv>\n  \u003C\u002Fa>\n  \u003Ca class=\"LinkPreview_Image\" href=\"https:\u002F\u002Fdevelopers.google.com\u002Fanalytics\u002Fblog\u002F2023\u002Fbigquery-vs-ui?hl=ja\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"background-image: url('https:\u002F\u002Fwww.gstatic.com\u002Fdevrel-devsite\u002Fprod\u002Fv20cdb2337f656fc22df509b6d5402b3836a1b55334a8eea3301423a87970c4d5\u002Fdevelopers\u002Fimages\u002Fopengraph\u002Fwhite.png')\">\u003C\u002Fa>\n\u003C\u002Fdiv>\n\u003C\u002Fp>\u003Cp>When there are differences between the data your company is viewing in the Google Analytics UI and your own data, comparing with the detailed data from BigQuery export can be helpful.\u003C\u002Fp>\u003Ch2>Conclusion\u003C\u002Fh2>\u003Cp>We've explained how exporting Google Analytics data to BigQuery enables data analysis and utilization that isn't possible with Google Analytics alone.\u003C\u002Fp>\u003Cp>While there are initial setup and learning costs, the potential value outweighs these costs. In many cases, the data obtainable through GA4 is only a superficial part of your company's site, and without matching it with your company's data outside GA4, you might not even be measuring conversions in a meaningful sense.\u003C\u002Fp>\u003Cp>Relying on superficial analysis can lead to continued wrong decisions based on incorrect data.\u003C\u002Fp>\u003Cp>Codatum provides comprehensive support from building an analytics foundation using GA4 and BigQuery to connecting with your company's data and developing BI dashboards. Please feel free to contact us as a partner to maximize the power of your data and support your business growth.\u003C\u002Fp>","Naoki Shibayama",{"title":10,"slug":11,"description":12},"Product Guide","product-guide","外部プロダクト・データツールの解説ガイド","product","https:\u002F\u002Fimages.ctfassets.net\u002Fggtw2zqmifs5\u002F7Dp6JBw8WXVbL1snBH4l5Y\u002Fdfa6dd59953827f3b5772cc46ec30d92\u002Fga.jpg","2025-04-15T22:00:02.665Z","2026-05-07T15:37:04.746Z","2025-04-16T08:00+09:00","en"]