Skip to main content
Feedback

Google Analytics 4 walkthrough

Google Analytics 4 (GA4) on Data Integration provides seamless integration of GA4 data into data warehouses. This integration automates data extraction, enabling efficient analysis.

Connection

To connect Google Analytics 4 (GA4) with your destination, follow the step-by-step tutorial. Choose a Source connection after creating a connection.

Predefined reports

Data Integration provides a convenient entry point and recommended approach for accessing a range of predefined reports. Each report includes a concise data description, a list of customizable fields (if applicable), and the schema mapping.

These reports follow a standardized format so you can access specific fields only through Custom Reports.

Custom reports

Google Analytics 4 (GA4) provides advanced tracking and analysis capabilities to help businesses gain valuable insights into user behavior and website performance.

In GA4, there are two main report types:

  • Cohort Report
  • Standard Report

To learn more about the Google Analytics Data API, refer to the Google documentation.

Prerequisites

GA4 cohort report

The Cohort Report helps you analyze user behavior within specific user groups during a designated time frame. A cohort is a group of users who share a characteristic or experience within a defined period. The Cohort Report provides valuable insights into the long-term behavior of these user groups, letting you monitor user acquisition daily, weekly, or monthly.

GA4 standard report

The Standard Report in GA4 provides pre-configured insights into various aspects of your website or app performance. This report covers audience, acquisition, behavior, and conversions, letting you understand user behavior, traffic sources, popular content, and conversion rates.

Time period

This report lets you extract the data by selecting a time period.

note
  • Start Date is mandatory.
  • You can retrieve data for the date range between the Start and End dates.
  • If you leave the End Date blank, the data is pulled at the current time of the River's run.
  • Dates timezone: UTC time.
  • The Start Date does not advance if a River run is unsuccessful. If you do not want this default setting, click More Options and turn on the Update incremental date range also on failures checkbox to advance the start date even if the River run is unsuccessful (not recommended).
  • Use the Last Days Back For Each Run option to gather data from a specified number of days before the selected start date.

Time chunk size

This feature lets you partition your data into intervals, which is beneficial when working with large data volumes. The data is divided based on the specified size of the interval, letting you make manageable data calls.

Dimension and metrics

GA4 provides businesses with insights into user behavior and website performance. Dimensions represent user attributes, while metrics offer quantitative measurements. Together, they help analyze data, gain audience insights, and optimize marketing strategies. By segmenting data and tracking performance, businesses can make informed decisions to achieve their goals.

Dimensions

Dimensions in GA4 represent characteristics or scopes of events, users, or items. They provide descriptive information that helps segment and categorize data. GA4 includes predefined dimensions such as user ID, device type, country, and traffic source, which offer valuable insights into user behavior and demographics.

Metrics

Metrics in GA4 represent measurable data points that quantify user interactions, conversions, and key performance indicators. GA4 provides a wide range of predefined metrics such as pageviews, sessions, bounce rate, and average session duration, giving a comprehensive view of website or app performance.

note

Advanced options

The Custom Dimensions and Metrics feature is available in the Advanced Options section. Custom dimensions and metrics are elements you create to examine data tailored to your business needs. You can use them when establishing custom event parameters or user properties.

Prerequisite

To create custom dimensions and metrics, you must have Editor or Administrator role.

Creating custom dimensions

Procedure

  1. Click the Admin within Google Analytics.
  2. Access the Custom Definitions section within the Property column.
  3. In the Custom dimensions tab, click Create custom dimensions.
  4. Provide the following details:

a. Name of the dimension: Enter a distinct name for the dimension. Hyphens are not permitted; use underscores and spaces instead. b. Scope: Select a scope for the dimension. c. Description: Provide a description for the dimension. d. Event parameter/User property: Choose the data source.

  1. Click Save.
note

During the initial 48 hours, your custom dimension will have a value of (not set) assigned to it.

Creating custom metrics

Procedure

  1. Click the Admin within Google Analytics.

  2. Access the Custom Definitions section within the Property column.

  3. In the Custom metrics tab, click Create custom metrics.

  4. Provide the following details:

a. Name of the metric: Enter a distinct name for the metric. Hyphens are not permitted; use underscores and spaces instead. b. Scope: Ensure you create a metric scoped to an event. c. Description: Enter a memorable description for the custom metric. d. Event parameter: Select the data source for the metric. e. Unit of measurement: Choose the appropriate unit of measurement.

  1. Click Save.
note

During the initial 48 hours, your custom dimension will have a value of (not set) assigned to it.

For additional details about Scopes, Units of measurement, and the Source of data, refer to the Google Analytics documentation.

Sub Rivers in GA4

Google Analytics 4 introduces a set of Sub Rivers fields. These fields let you delve deeper into the analytics data and gain specific insights from your website or app performance:

  • Account IDs
  • Source Connection
  • Account Properties
  • Time Period
  • Target Connection
  • Database Name
  • Schema

Optimizing loading errors through expression casting

If you use Snowflake or BigQuery as your target, you might encounter the following error if the expressions are not correct:

Loading failed: Merge into DB.SCHEMA.GA_sessions failed. Error - ('22007', "[22007] Can't parse '0' as date with format 'YYYYMMDD' (100097) (SQLExecDirectW)")

To prevent this error, apply the recommended expression as indicated below:

image.png

When using Snowflake as the Target, use the following expression:

CASE WHEN date = 0 THEN '1900-01-01'::DATE ELSE TO_DATE(CAST(date AS VARCHAR), 'YYYYMMDD')::DATE END

When using BigQuery as your Target, use the following expression:

SAFE.PARSE_DATETIME("%Y%m%d", CAST(date AS STRING))

Google Analytics 4 API filtering limitations

Google Analytics prioritizes user privacy. If your query involves restricted data (such as demographics), recent time frames, or intricate filters, you might see a decrease in results.

In the event of a noticeable decline, consider extending your time frame, streamlining filters, or promoting the opt-in for Google Signals to access more comprehensive data.

Prevent data loss in Google Analytics and its API:

  1. Reduce number of filters:

    • Minimize the number of filters for essential analysis.
    • Avoid non-crucial filters.
  2. Merge filters:

Combine multiple filters for efficiency.

  1. Widen filter criteria:

To capture a broader data range, make filter conditions less specific. For instance, filter for a category rather than a specific page.

  1. Remove unnecessary dimensions:

Remove dimensions that are not directly relevant to your analysis.

  1. Explore alternative dimensions:

Consider using alternative dimensions for similar insights with less complexity. For example, filter by region instead of city.

  1. Consistency in dimension and metric usage: Ensure that you employ identical Dimensions and Metrics in both Data Integration and Google Analytics.

  2. Adjust time frames:

Expand the query time frame to access more data, particularly with less common dimensions or filters.

By applying these strategies, you can simplify filters, ensuring smoother data retrieval and avoiding unexpected drops in result counts.

On this Page