GA4Dataform Documentation

website·Indexed 32 days ago

https://docs.ga4dataform.com

A data transformation framework for GA4 raw exports in BigQuery. It provides modules for GA4 event and session table design, attribution reporting, anomaly detection, GCP cost monitoring, and Google Ads data transformation. Features include user stitching, PII detection, custom lineage, and automated workflow execution via Dataform.

Tokens
77.5K
Snippets
203
Records
480
Agent score
56%

What's inside GA4Dataform

  1. Overview of GA4 Reporting pre-aggregated tables

    The GA4 Reporting module builds seven pre-aggregated, dashboard-ready report tables on top of core GA4Dataform outputs to improve dashboard performance and reduce BigQuery costs. These tables provide documented grains for common BI questions.
    TableOne row perAnswers
    ga4_reporting_acquisition_reportdate x session dimensionsWhere do sessions and revenue come from? (Three attribution views)
    ga4_reporting_conversion_rates_reportdate x event (+ drilldowns)What is the session conversion rate after any event?
    ga4_reporting_ecommerce_reportdate x currencyDaily shop totals: transactions, revenue, purchasers, refunds
    ga4_reporting_pages_reportdate x page (+ dimensions)Which pages get views, entrances, exits and engagement?
    ga4_reporting_consent_reportdate (+ dimensions)Consent rates, cookieless traffic and estimated hidden sessions
    ga4_reporting_currency_ratesdate x currencyThe daily USD conversion rate Google applied to your events
    ga4_reporting_item_sales_reportdate x item attributesItem-level sales and refunds from deduplicated transactions
  2. Overview of Anomaly Detection helper functions

    The helper layer located at includes/core/modules/anomaly_detection/helpers.js centralizes SQL generation, naming conventions, and configuration validation. It is used by the intermediate time series, model training, and anomalies files, as well as the output report file. Its primary responsibilities include building reusable SQL fragments, normalizing identifiers, merging core and custom case configurations, and standardizing BQML model and table naming.
  3. Overview of GA4 Attribution Modeling module

    The GA4 Attribution Modeling module transforms raw GA4 events into multi-touch attribution data within BigQuery. Unlike standard GA4 reporting which relies on last-click or last-non-direct-click, this module reconstructs the full user path to conversion and distributes credit across contributing channels using various models (first-touch, last-touch, linear, position-based, time-decay, and participation).
  4. Overview of the Anomaly Detection module

    The Anomaly Detection module is a Premium feature that monitors time series of metrics and dimensions to flag changes that deviate from historical norms. It is designed to help analysts identify technical issues (e.g., tracking failures, app updates) or business trends (e.g., viral content, campaign misconfigurations) before they are manually discovered in reports.
  5. Overview of the ga4_item_funnel module

    The ga4_item_funnel module (Premium feature) transforms nested GA4 e-commerce event and item data into structured funnels and attribution reports. It tracks user interaction with individual products across key steps: view_item_list, select_item, view_item, add_to_cart, begin_checkout, and purchase. It is primarily used for product performance optimization, detecting funnel bottlenecks, and measuring item-list attribution.
  6. Overview of GA4 Custom Lineage

    Custom Lineage is a Premium feature that allows you to inject custom SQL transformations between core GA4 pipeline tables. It acts as middleware: the core model produces a table, your custom layer transforms it, and all downstream tables automatically read from your custom version. This eliminates the need to fork or patch core models when adding columns, fixing data, or applying business logic.
  7. Overview of the Google Ads transformation module

    The Google Ads module transforms raw Google Ads Data Transfer tables (such as BasicStats, ConversionStats, and Lookup tables) into an efficient format for reporting. Key capabilities include:

    • Multi-Account Support: Consolidate data from multiple Google Ads accounts, regardless of whether they share an MCC account.
    • Dimension Lookups: Maintains the latest metadata for campaigns, ads, ad groups, keywords, and GCLIDs.
    • GCLID Tracking: Provides a deduplicated, incremental GCLID table for joining with other sources like GA4.
    • Incremental Processing: Reduces costs by processing only new data from high-volume raw tables.
    • Conversion Handling: Flexible configuration for tracking multiple conversion actions.
  8. Overview of GA4 User Stitching

    User stitching is a Premium feature that fills gaps in identity columns (most notably user_id) at the session level by analyzing the user_pseudo_id (cookie).

    If a session lacks a user_id:

    1. Look-back: The system searches past sessions for the same user_pseudo_id and assigns the last seen user_id to the current session.
    2. Look-ahead: If no past ID is found, the system searches future sessions. If a login occurs later, it 'rewrites history' by assigning that future user_id to the previous anonymous sessions.

    Stitching is not limited to user_id; it can be applied to custom parameters, user properties, or URL parameters (e.g., url_params_custom.lead_id). Stitched results are stored as a struct in the stitched_ids column of the ga4_sessions table.

  9. Overview of GA4 Parameter Detection module

    The GA4 Parameter Detection module is a premium auditing tool that automatically discovers and tracks user properties, custom event parameters, and item parameters in GA4 raw exports. It is used to identify configuration gaps, data quality issues, and optimization opportunities. Key capabilities include:

    • Automatic Discovery: Finds parameters in data that are not yet configured.
    • Configuration Validation: Detects mismatches between expected and actual data types.
    • Sample Value Analysis: Provides actual values collected for each parameter.
    • Trend Monitoring: Tracks parameter usage daily.
    • Config Generation: Suggests configuration code for discovered parameters.
    • PII Detection: Scans names and values for personally identifiable information.
    • Multi-Property Support: Tracks parameters per GA4 property using property_id and property_name columns.
  10. Overview of GA4Dataform AI context files

    GA4Dataform Premium (v2.2.9+) includes a set of context files at the repository root designed to make the workspace self-describing for AI agents (e.g., Gemini in BigQuery, Claude, Cursor). These files, combined with BigQuery table/column descriptions and commented SQL CTEs, allow agents to answer data questions, write queries, and extend the project safely.
  11. Overview of GA4Dataform for Google Analytics BigQuery data

    GA4Dataform provides a set of models designed to integrate with Google Analytics data exported to BigQuery. It automates the aggregation and transformation of raw GA4 data into ready-to-use events and sessions tables, which are optimized for use in dashboards and reporting. Because the models are built using Dataform and SQL, they can be customized to include business-specific metrics or dimensions.
  12. Overview of GA4 Attribution custom lineage interception points

    The GA4 Attribution module provides two interception points that allow developers to insert a custom view between core tables and their consumers. This enables modifications to data without altering the core module logic.

    • touchpoints_custom: Sits between the active touchpoints table and ga4_attribution_journeys. Use this for touch-level edits, such as adding offline/CRM touches via UNION ALL or dropping specific touches (e.g., 'Direct') before journeys are constructed.
    • journeys_custom: Sits between ga4_attribution_journeys and the attribution models/reports. Use this for journey-level edits, such as filtering out internal users or overriding journey columns (e.g., adjusting closing revenue).

    Critical Note: Touch-level edits must happen at the first interception point because journey boundaries and chains are derived before the second interception point runs. Filtering a journey at the second point also removes its attribution credit in ga4_attribution_models.