Google Analytics 4 Destination

Google Analytics 4 is Google’s new Analytics property, which you can use for both websites and applications. Google Analytics 4 has machine learning at its core to help surface insights and give you a more complete understanding of your customers across devices and platforms.

When you have Segment installed, you can use your existing tracking implementation to fulfill your data collection needs with Google Analytics 4. Segment will send your data server-side to Google’s Measurement Protocol API.

This document is about a feature which is in beta. This means that the Destination Actions are in active development, and some functionality may change before it becomes generally available

Good to know: This page is about the Actions-framework Google Analytics 4 destination. There’s also a page about the non-Actions Google Universal Analytics destination. Both of these destinations receive data from Segment.

Benefits of Google Analytics 4

The Google Analytics 4 destination provides the following benefits:

  • Fewer settings. Data mapping for actions-based destinations happens during configuration, which eliminates the need for most settings.
  • Clearer mapping of data. Actions-based destinations enable you to define the mapping between the data Segment receives from your source and the data Segment sends to Google Analytics 4.
  • Prebuilt mappings. Mappings for recommended Google Analytics 4 events, like Purchase, are prebuilt with the prescribed parameters and available for customization.
  • Support for multi-product arrays. Products nested within arrays, like the products array in the Order Completed event, can be sent to Google Analytics 4.

Getting started

Before you connect Segment to Google Analytics 4, configure a Google Analytics 4 property in your Analytics account. For more information, see Google’s article: Set up Analytics for a website and/or app.

To add the Google Analytics 4 destination:

  1. From the Segment web app, click Catalog, then click Destinations.
  2. Search for “Google Analytics 4” in the Destinations Catalog, and select the destination.
  3. Click Configure Google Analytics 4 in the top-right corner of the screen.
  4. Select the source that will send data to Google Analytics 4 and follow the steps to name your destination.
  5. On the Settings tab, enter in the Measurement ID and API Secret associated with your GA4 stream and click Save. Note: To create a new API Secret, navigate in the Google Analytics UI to Admin > Data Streams > choose your stream > Measurement Protocol > Create.
  6. Follow the steps in the Destinations Actions documentation on Customizing mappings.

Destination Settings

Setting Description
API Secret Required.

An API SECRET generated in the Google Analytics UI, navigate to: Admin > Data Streams > choose your stream > Measurement Protocol > Create

Measurement ID Required.

The measurement ID associated with a stream. Found in the Google Analytics UI under: Admin > Data Streams > choose your stream > Measurement ID

Available Actions

Build your own subscriptions! Combine supported triggers with the following Google Analytics 4-supported actions:

Page View

Send page view when a user views a page

Page View is a Cloud action.

Click to show / hide fields

Field Description
Client ID Type: STRING

Uniquely identifies a user instance of a web client.

Page Location Type: STRING

The current page URL

Page Referrer Type: STRING

Previous page URL

Select Promotion

Send event when a user selects a promotion

Select Promotion is a Cloud action.

Click to show / hide fields

Field Description
Client ID Type: STRING

Uniquely identifies a user instance of a web client.

Creative Name Type: STRING

The name of the promotional creative.

Creative Slot Type: STRING

The name of the promotional creative slot associated with the event.

Location ID Type: STRING

The ID of the location.

Promotion ID Type: STRING

The ID of the promotion associated with the event.

Promotion Name Type: STRING

The name of the promotion associated with the event.

Products Type: OBJECT

The list of products purchased.

View Item List

Send event when a user views a list of items or offerings

View Item List is a Cloud action.

Click to show / hide fields

Field Description
Client ID Type: STRING

Uniquely identifies a user instance of a web client.

Item List ID Type: STRING

The ID of the list in which the item was presented to the user.

Item List Name Type: STRING

The name of the list in which the item was presented to the user.

Products Type: OBJECT

The list of products purchased.

Begin Checkout

Send event when a user begins checkout

Begin Checkout is a Cloud action.

Click to show / hide fields

Field Description
Client ID Type: STRING

Uniquely identifies a user instance of a web client.

Coupon Type: STRING

Coupon code used for a purchase.

Currency Type: STRING

Currency of the items associated with the event, in 3-letter ISO 4217 format.

Products Type: OBJECT

The list of products purchased.

Value Type: NUMBER

The monetary value of the event.

Refund

Send event when a refund is issued

Refund is a Cloud action.

Click to show / hide fields

Field Description
Client ID Type: STRING

Uniquely identifies a user instance of a web client.

Currency Type: STRING

Currency of the items associated with the event, in 3-letter ISO 4217 format.

Order Id Type: STRING

The unique identifier of a transaction.

Value Type: NUMBER

The monetary value of the event.

Affiliation Type: STRING

Store or affiliation from which this transaction occurred (e.g. Google Store).

Coupon Type: STRING

Coupon code used for a purchase.

Shipping Type: NUMBER

Shipping cost associated with the transaction.

Tax Type: NUMBER

Tax cost associated with a transaction.

Products Type: OBJECT

The list of products purchased.

Add to Cart

Send event when a user adds items to a cart

Add to Cart is a Cloud action.

Click to show / hide fields

Field Description
Client ID Type: STRING

Uniquely identifies a user instance of a web client.

Currency Type: STRING

Currency of the items associated with the event, in 3-letter ISO 4217 format.

Products Type: OBJECT

The list of products purchased.

Value Type: NUMBER

The monetary value of the event.

Add Payment Info

Send event when a user submits their payment information

Add Payment Info is a Cloud action.

Click to show / hide fields

Field Description
Client ID Type: STRING

Uniquely identifies a user instance of a web client.

Currency Type: STRING

Currency of the items associated with the event, in 3-letter ISO 4217 format.

Value Type: NUMBER

The monetary value of the event.

Coupon Type: STRING

Coupon code used for a purchase.

Payment Type Type: STRING

The chosen method of payment.

Products Type: OBJECT

The list of products purchased.

Add to Wishlist

Send event when a user adds items to a wishlist

Add to Wishlist is a Cloud action.

Click to show / hide fields

Field Description
Client ID Type: STRING

Uniquely identifies a user instance of a web client.

Currency Type: STRING

Currency of the items associated with the event, in 3-letter ISO 4217 format.

Value Type: NUMBER

The monetary value of the event.

Products Type: OBJECT

The list of products purchased.

View Item

Send event when a user views an item

View Item is a Cloud action.

Click to show / hide fields

Field Description
Client ID Type: STRING

Uniquely identifies a user instance of a web client.

Currency Type: STRING

Currency of the items associated with the event, in 3-letter ISO 4217 format.

Value Type: NUMBER

The monetary value of the event.

Products Type: OBJECT

The list of products purchased.

Sign Up

Send event when a user signs up to measure the popularity of each sign-up method

Sign Up is a Cloud action.

Click to show / hide fields

Purchase

Send event when a user completes a purchase

Purchase is a Cloud action.

Click to show / hide fields

Field Description
Client ID Type: STRING

Uniquely identifies a user instance of a web client.

Affiliation Type: STRING

Store or affiliation from which this transaction occurred (e.g. Google Store).

Coupon Type: STRING

Coupon code used for a purchase.

Currency Type: STRING

Currency of the items associated with the event, in 3-letter ISO 4217 format.

Products Type: OBJECT

The list of products purchased.

Order Id Type: STRING

The unique identifier of a transaction.

Shipping Type: NUMBER

Shipping cost associated with the transaction.

Tax Type: NUMBER

Total tax associated with the transaction.

Value Type: NUMBER

The monetary value of the event.

View Promotion

Send event when a promotion is shown to a user

View Promotion is a Cloud action.

Click to show / hide fields

Field Description
Client ID Type: STRING

Uniquely identifies a user instance of a web client.

Creative Name Type: STRING

The name of the promotional creative.

Creative Slot Type: STRING

The name of the promotional creative slot associated with the event.

Location ID Type: STRING

The ID of the location.

Promotion ID Type: STRING

The ID of the promotion associated with the event.

Promotion Name Type: STRING

The name of the promotion associated with the event.

Products Type: OBJECT

The list of products purchased.

View Cart

Send event when a user views their cart

View Cart is a Cloud action.

Click to show / hide fields

Field Description
Client ID Type: STRING

Uniquely identifies a user instance of a web client.

Currency Type: STRING

Currency of the items associated with the event, in 3-letter ISO 4217 format.

Value Type: NUMBER

The monetary value of the event.

Products Type: OBJECT

The list of products purchased.

Login

Send event when a user logs in

Login is a Cloud action.

Click to show / hide fields

Custom Event

Send any custom event

Custom Event is a Cloud action.

Click to show / hide fields

Field Description
Client ID Type: STRING

Uniquely identifies a user instance of a web client.

Event Name Type: STRING

The unique name of the custom event created in GA4. GA4 does not accept spaces in event names so Segment will replace any spaces with underscores. More information about GA4 event name rules is available in their docs.

Lowercase Event Name Type: BOOLEAN

If true, the event name will be converted to lowercase before sending to Google. Event names are case sensitive in GA4 so enable this setting to avoid distinct events for casing differences. More information about GA4 event name rules is available in their docs.

Event Parameters Type: OBJECT

The event parameters to send to Google

Remove from Cart

Send event when a user removes items from a cart

Remove from Cart is a Cloud action.

Click to show / hide fields

Field Description
Client ID Type: STRING

Uniquely identifies a user instance of a web client.

Currency Type: STRING

Currency of the items associated with the event, in 3-letter ISO 4217 format.

Value Type: NUMBER

The monetary value of the event.

Products Type: OBJECT

The list of products purchased.

Send event when a user searches your content

Search is a Cloud action.

Click to show / hide fields

Select Item

Send event when a user selects an item from a list

Select Item is a Cloud action.

Click to show / hide fields

Field Description
Client ID Type: STRING

Uniquely identifies a user instance of a web client.

Item List Name Type: STRING

The name of the list in which the item was presented to the user.

Item List Id Type: STRING

The ID of the list in which the item was presented to the user.

Products Type: OBJECT

The list of products purchased.

Generate Lead

Send event when a user submits a form or request for information

Generate Lead is a Cloud action.

Click to show / hide fields

Field Description
Client ID Type: STRING

Uniquely identifies a user instance of a web client.

Currency Type: STRING

Currency of the items associated with the event, in 3-letter ISO 4217 format.

Value Type: NUMBER

The monetary value of the event.

Troubleshooting

Custom Event Naming

Google Analytics 4 does not accept custom event names that include spaces. Segment replaces spaces in the Event Name in the Custom Event action with an underscore. As a result, you will see custom events snakecased in Google Analytics 4.

Google Analytics 4 is also case sensitive. If you would like all event names lowercased, use the Lowercase Event Name setting in the Custom Event action. If this setting is disabled, Google will treat event names with different casing as distinct events. For more information, see Google Analytics 4 Event name rules.

User Metrics & Sessions

Segment sends a Google clientId in requests to the Measurement Protocol API, alongside other required API fields. However, user sessions are not currently supported by the Measurement Protocol API, so user metrics might not appear on the Google Analytics 4 Realtime report or several other reports.

To validate your implementation, check users on the Events report and User Explorer. You can also confirm events are picked up in the Realtime report.

Debug Mode

The Google Analytics 4 debug mode only works with a client-side implementation through gtag.js, Google Tag Manager, or Firebase. Because Segment’s Google Analytics 4 integration is server-side and uses the Measurement Protocol API, debug mode is not supported.

This page was last modified: 06 Jan 2022



Get started with Segment

Segment is the easiest way to integrate your websites & mobile apps data to over 300 analytics and growth tools.
or
Create free account