[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[[["\u003cp\u003eCortex Framework integrates with Google Analytics 4 (GA4) to extract data for analysis and reporting in BigQuery, providing a comprehensive view of user behavior.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003econfig.json\u003c/code\u003e file allows configuration of the connection to GA4 data sources, including settings for deploying GA4 and specifying BigQuery Export datasets.\u003c/p\u003e\n"],["\u003cp\u003eCortex Framework uses GA4's BigQuery Export feature to load data into BigQuery, requiring setup of the export for each GA4 property, and data is available through reporting views.\u003c/p\u003e\n"],["\u003cp\u003eThere are limitations and considerations to be aware of when using GA4 BigQuery Export, such as no data backfilling, potential discrepancies between the GA4 UI and Cortex Framework reported numbers, event export volume restrictions, and time zone differences.\u003c/p\u003e\n"],["\u003cp\u003eData freshness in Cortex Framework is limited by upstream connections and DAG execution frequency, with GA4 BigQuery export data potentially delayed up to a day, unless Fresh Daily Export is utilized.\u003c/p\u003e\n"]]],[],null,["# Integration with Google Analytics 4\n===================================\n\nThis page describes the required configurations to bring data from\nGoogle Analytics 4 (GA4) as a data source of the marketing workload of\nCortex Framework Data Foundation.\n\n**GA4** is the latest version of Google Analytics. It provides a holistic\nview of user behavior, focusing on event-based tracking and machine learning to\noffer deeper insights. Cortex Framework lets you extract data from\nGA4 and integrate it into BigQuery for further analysis and\nreporting. You can gain valuable insights and drive better business outcomes.\n\nThe following diagram describes how GA4 data is\navailable through the marketing workload of Cortex Framework Data Foundation:\n\n**Figure 1**. GA4 data source. **Note:** For accessing configuration files, analytical views and models for the GA4 data source, see the [data source directory](https://github.com/GoogleCloudPlatform/cortex-data-foundation/tree/main/src/marketing/src/GA4).\n\nConfiguration file\n------------------\n\nThe [`config.json`](https://github.com/GoogleCloudPlatform/cortex-data-foundation/blob/main/config/config.json)\nfile configures the settings required to connect to data sources for transferring\ndata from various workloads. This file contains the following parameters for GA4: \n\n \"marketing\": {\n \"deployGA4\": true,\n \"GA4\": {\n \"datasets\": {\n \"cdc\": [\n {\"property_id\": 0, \"name\": \"\"}\n ],\n \"reporting\": \"REPORTING_GA4\"\n }\n }\n }\n\nThe following table describes the value for each marketing parameter:\n\nData Model\n----------\n\nThis section describes the GA4 Data Model using the Entity\nRelationship Diagram (ERD).\n\n[](/static/cortex/docs/images/erd_ga4.png)\n**Figure 2**. GA4: Entity Relationship Diagram.\n\n### Base views\n\nThese are the blue objects in the ERD and are views on CDC tables with\nminimal transformations to unpack complex data structures. See scripts in\n[`src/marketing/src/GA4/src/reporting/ddls`](https://github.com/GoogleCloudPlatform/cortex-data-foundation/tree/main/src/marketing/src/GA4/src/reporting/ddls).\n\n### Reporting views\n\nThese are the green objects in the ERD and are reporting views that contain\naggregate metrics. See scripts in\n[`src/marketing/src/GA4/src/reporting/ddls`](https://github.com/GoogleCloudPlatform/cortex-data-foundation/tree/main/src/marketing/src/GA4/src/reporting/ddls).\n\nConfigure integration for GA4\n-----------------------------\n\nCortex Framework Data Foundation integrates with\n[GA4](https://support.google.com/analytics/answer/10089681?hl) by creating\na **Reporting layer** on top of GA4's\n[BigQuery Export](https://support.google.com/analytics/answer/9823238?hl#zippy=%2Cin-this-article) datasets (treated as [CDC datasets](/cortex/docs/cdc) in\nCortex Framework architecture). This is\naccomplished by creating runtime views on top of CDC tables or running\nCloud Composer DAGs for materialized data in BigQuery\ntables, depending on the [reporting settings configuration](/cortex/docs/deployment-step-five#customizing_reporting_settings_file).\n\n### Set up GA4 BigQuery Export\n\nCortex Framework uses GA4's BigQuery Export feature to\nload data from the source system into BigQuery. Follow the\ninstructions for setting up BigQuery Export or each GA4 property\nin this GA4 Help article: [GA4 - Set up BigQuery Export](https://support.google.com/analytics/answer/9823238?hl#zippy=%2Cin-this-article).\n| **Note:** If you are setting up export for multiple GA4 properties, ensure they all export to the same Google Cloud project. Export both **Event** and **User** data, for all properties.\n\n### Known issues, limitations, and other considerations\n\nConsider the following when setting up GA4 BigQuery Export:\n\n- **Backfilling**: GA4 BigQuery Export starts from the day it is set up and there is no backfilling.\n- **Difference between GA4 UI and Cortex Framework reported numbers** : Multiple factors, including but not limited to sampling, data collection delay, and high-cardinality reports, may cause minor discrepancy between Google Analytics UI and Cortex Framework. This is a known and innate limitation of Google Analytics. For more information, see [Bridge the gap between the Google Analytics UI and BigQuery export](https://developers.google.com/analytics/blog/2023/bigquery-vs-ui).\n- **Event export volume restrictions** : Depending on your Google Analytics edition, you may face varying degree of BigQuery export volume restriction per day. For more information, see [GA4 - Set up BigQuery Export](https://support.google.com/analytics/answer/9823238?hl#limits).\n- **Time zone** : In BigQuery Export, `event_date` is set **in the property's reporting time zone** while `event_timestamp` is the **UTC** timestamp in microseconds. As a result, if `event_timestamp` is used, make sure to adjust for the correct reporting time zone when comparing with UI numbers.\n- **Daily versus Streaming (real-time) Event exports** : For *Event* exports, Cortex Framework only supports the `events_YYYYMMDD` tables created by full daily export. For more information, see [GA4 - BigQuery Export](https://support.google.com/analytics/answer/9358801?hl#streaming).\n- **GA4 360 Service Level Agreement (SLA) for BigQuery Export** : While Cortex Framework doesn't support the `events_fresh_` tables created by [Fresh Daily exports](https://support.google.com/analytics/answer/14117050?hl) as separate source tables, you can follow the `##CORTEX-CUSTOMER` customization comments in the `Events` Reporting view to replace the source tables with these, to take advantage of the SLA provided by this feature. All Reporting views will continue to work after this substitution.\n\nData Freshness and Delay\n------------------------\n\nAs a general rule, data freshness for Cortex Framework data\nsources is limited by what upstream connection allows for, as well as the\nfrequency of your DAG execution. Adjust your DAG execution frequency to\nalign with upstream frequency, resource constraints, and your business\nneeds.\n\nWith Google Analytics 4,\n[BigQuery export](#set-up-ga4-BigQuery-export)\ndata may be delayed up to a day depending on your time zone, unless you are\nusing [Fresh Daily Export](https://support.google.com/analytics/answer/15604391?sjid=7512611260796146949-NC).\n\nConfigurations\n--------------\n\nThis section describes the configurations for the data process.\n\n### Cloud Composer connections\n\nCreate the following connections in Cloud Composer. See more details in the\n[Manage Airflow connections documentation](/composer/docs/how-to/managing/connections).\n\n### Reporting settings\n\nYou can configure and control how Cortex Framework generates\ndata for the GA4 final reporting layer using the reporting\nsettings file [src/GA4/config/reporting_settings.yaml](https://github.com/GoogleCloudPlatform/cortex-data-foundation/tree/main/src/marketing/src/GA4/config/reporting_settings.yaml). This file controls how reporting layer BigQuery objects\n(tables, views,functions or stored procedures) are generated.\n\nFor more information, see [Customizing reporting settings file](/cortex/docs/deployment-step-five#customizing_reporting_settings_file).\n\nWhat's next?\n------------\n\n- For more information about other data sources and workloads, see [Data sources and workloads](/cortex/docs/data-sources-and-workloads).\n- For more information about the steps for deployment in production environments, see [Cortex Framework Data Foundation deployment prerequisites](/cortex/docs/deployment-prerequisites)."]]