Google Analytics 4 Cloud Destination
Additional versions of this destination are available
This page is about the Google Analytics 4 Cloud Destination. See below for information about other versions of the Google 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.
Google Analytics 4 doesn’t officially support a pure server-to-server integration. However, Segment monitors the capabilities of the Measurement Protocol API and updates the cloud integration accordingly to achieve a reasonable level of reporting for mutual customers. For full functionality, please see the Google Analytics 4 Web destination.
Consent mode
Google enforced consent on March 6, 2024 for European Economic Area (EEA) users. Learn more about consent mode and how to set it up.
Benefits of Google Analytics 4 Cloud
The Google Analytics 4 Cloud 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 Cloud destination:
- From the Segment web app, click Catalog, then click Destinations.
- Search for “Google Analytics 4 Cloud” in the Destinations Catalog, and select the destination.
- Click Configure Google Analytics 4 Cloud in the top-right corner of the screen.
- Select the source that will send data to Google Analytics 4 and follow the steps to name your destination.
- On the Settings tab, enter in the Measurement ID for web streams or the Firebase App ID for mobile streams. Next, enter in the API Secret associated with your GA4 stream and click Save. To create a new API Secret, navigate in the Google Analytics UI to Admin > Data Streams > choose your stream > Measurement Protocol > Create.
- 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 |
Firebase App ID | The Firebase App ID associated with the Firebase app. Found in the Firebase console under: Project Settings > General > Your Apps > App ID. Required for mobile app streams. |
Measurement ID | The Measurement ID associated with a stream. Found in the Google Analytics UI under: Admin > Data Streams > choose your stream > Measurement ID. Required for web streams. |
Available Actions
Build your own Mappings. Combine supported triggers with the following Google Analytics 4 Cloud-supported actions:
Mapping limits per destination
Individual destination instances have support a maximum of 50 mappings.
Add to Cart
Send event when a user adds items to a cart
Add to Cart is a Cloud action. The default Trigger is: type = "track" and event = "Product Added"
Field | Description |
---|---|
Data Stream Type | Type: STRING The type of data stream this data belongs in. This can either be a web stream or a mobile app stream (iOS or Android). Possible values: “Web” (default) and “Mobile App”. |
Firebase App Instance ID | Type: STRING Uniquely identifies a specific installation of a Firebase app. This value needs to be retrieved through the Firebase SDK. Required for mobile app streams. |
Client ID | Type: STRING Uniquely identifies a user instance of a web client. Required for web streams. |
User ID | Type: STRING A unique identifier for a user. See Google’s User-ID for cross-platform analysis and Reporting: deduplicate user counts documentation for more information on this identifier. |
Event Timestamp | Type: STRING A Unix timestamp (in microseconds) for the time to associate with the event. Segment will convert to Unix if not already converted. Events can be backdated up to 3 calendar days based on the property’s timezone. |
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. |
User Properties | Type: OBJECT The user properties to send to Google Analytics 4. You must create user-scoped dimensions to ensure custom properties are picked up by Google. See Google’s Custom user properties to learn how to set and register user properties. |
Engagement Time in Milliseconds | Type: NUMBER The amount of time a user interacted with your site, in milliseconds. Google only counts users who interact with your site for a non-zero amount of time. By default, Segment sets engagement time to 1 so users are counted. |
Event Parameters | Type: OBJECT The event parameters to send to Google Analytics 4. |
Ad User Data Consent State | Type: STRING Sets consent for sending user data to Google for advertising purposes. Must be either GRANTED or DENIED. |
Ad Personalization Consent State | Type: STRING Sets consent for personalized advertising. Must be either GRANTED or DENIED. |
Purchase
Send event when a user completes a purchase
Purchase is a Cloud action. The default Trigger is: type = "track" and event = "Order Completed"
Field | Description |
---|---|
Data Stream Type | Type: STRING The type of data stream this data belongs in. This can either be a web stream or a mobile app stream (iOS or Android). Possible values: “Web” (default) and “Mobile App”. |
Firebase App Instance ID | Type: STRING Uniquely identifies a specific installation of a Firebase app. This value needs to be retrieved through the Firebase SDK. Required for mobile app streams. |
Client ID | Type: STRING Uniquely identifies a user instance of a web client. Required for web streams. |
User ID | Type: STRING A unique identifier for a user. See Google’s User-ID for cross-platform analysis and Reporting: deduplicate user counts documentation for more information on this identifier. |
Event Timestamp | Type: STRING A Unix timestamp (in microseconds) for the time to associate with the event. Segment will convert to Unix if not already converted. Events can be backdated up to 3 calendar days based on the property’s timezone. |
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. |
User Properties | Type: OBJECT The user properties to send to Google Analytics 4. You must create user-scoped dimensions to ensure custom properties are picked up by Google. See Google’s Custom user properties to learn how to set and register user properties. |
Engagement Time in Milliseconds | Type: NUMBER The amount of time a user interacted with your site, in milliseconds. Google only counts users who interact with your site for a non-zero amount of time. By default, Segment sets engagement time to 1 so users are counted. |
Event Parameters | Type: OBJECT The event parameters to send to Google Analytics 4. |
Ad User Data Consent State | Type: STRING Sets consent for sending user data to Google for advertising purposes. Must be either GRANTED or DENIED. |
Ad Personalization Consent State | Type: STRING Sets consent for personalized advertising. Must be either GRANTED or DENIED. |
Page View
Send page view when a user views a page
Page View is a Cloud action. The default Trigger is: type = "page"
Field | Description |
---|---|
Data Stream Type | Type: STRING The type of data stream this data belongs in. This can either be a web stream or a mobile app stream (iOS or Android). Possible values: “Web” (default) and “Mobile App”. |
Firebase App Instance ID | Type: STRING Uniquely identifies a specific installation of a Firebase app. This value needs to be retrieved through the Firebase SDK. Required for mobile app streams. |
Client ID | Type: STRING Uniquely identifies a user instance of a web client. Required for web streams. |
User ID | Type: STRING A unique identifier for a user. See Google’s User-ID for cross-platform analysis and Reporting: deduplicate user counts documentation for more information on this identifier. |
Event Timestamp | Type: STRING A Unix timestamp (in microseconds) for the time to associate with the event. Segment will convert to Unix if not already converted. Events can be backdated up to 3 calendar days based on the property’s timezone. |
Page Location | Type: STRING The current page URL |
Page Referrer | Type: STRING Previous page URL |
User Properties | Type: OBJECT The user properties to send to Google Analytics 4. You must create user-scoped dimensions to ensure custom properties are picked up by Google. See Google’s Custom user properties to learn how to set and register user properties. |
Page Title | Type: STRING The current page title |
Engagement Time in Milliseconds | Type: NUMBER The amount of time a user interacted with your site, in milliseconds. Google only counts users who interact with your site for a non-zero amount of time. By default, Segment sets engagement time to 1 so users are counted. |
Event Parameters | Type: OBJECT The event parameters to send to Google Analytics 4. |
Ad User Data Consent State | Type: STRING Sets consent for sending user data to Google for advertising purposes. Must be either GRANTED or DENIED. |
Ad Personalization Consent State | Type: STRING Sets consent for personalized advertising. Must be either GRANTED or DENIED. |
Select Promotion
Send event when a user selects a promotion
Select Promotion is a Cloud action. The default Trigger is: type = "track" and event = "Promotion Clicked"
Field | Description |
---|---|
Data Stream Type | Type: STRING The type of data stream this data belongs in. This can either be a web stream or a mobile app stream (iOS or Android). Possible values: “Web” (default) and “Mobile App”. |
Firebase App Instance ID | Type: STRING Uniquely identifies a specific installation of a Firebase app. This value needs to be retrieved through the Firebase SDK. Required for mobile app streams. |
Client ID | Type: STRING Uniquely identifies a user instance of a web client. Required for web streams. |
User ID | Type: STRING A unique identifier for a user. See Google’s User-ID for cross-platform analysis and Reporting: deduplicate user counts documentation for more information on this identifier. |
Event Timestamp | Type: STRING A Unix timestamp (in microseconds) for the time to associate with the event. Segment will convert to Unix if not already converted. Events can be backdated up to 3 calendar days based on the property’s timezone. |
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. |
User Properties | Type: OBJECT The user properties to send to Google Analytics 4. You must create user-scoped dimensions to ensure custom properties are picked up by Google. See Google’s Custom user properties to learn how to set and register user properties. |
Engagement Time in Milliseconds | Type: NUMBER The amount of time a user interacted with your site, in milliseconds. Google only counts users who interact with your site for a non-zero amount of time. By default, Segment sets engagement time to 1 so users are counted. |
Event Parameters | Type: OBJECT The event parameters to send to Google Analytics 4. |
Ad User Data Consent State | Type: STRING Sets consent for sending user data to Google for advertising purposes. Must be either GRANTED or DENIED. |
Ad Personalization Consent State | Type: STRING Sets consent for personalized advertising. Must be either GRANTED or DENIED. |
Begin Checkout
Send event when a user begins checkout
Begin Checkout is a Cloud action. The default Trigger is: type = "track" and event = "Checkout Started"
Field | Description |
---|---|
Data Stream Type | Type: STRING The type of data stream this data belongs in. This can either be a web stream or a mobile app stream (iOS or Android). Possible values: “Web” (default) and “Mobile App”. |
Firebase App Instance ID | Type: STRING Uniquely identifies a specific installation of a Firebase app. This value needs to be retrieved through the Firebase SDK. Required for mobile app streams. |
Client ID | Type: STRING Uniquely identifies a user instance of a web client. Required for web streams. |
User ID | Type: STRING A unique identifier for a user. See Google’s User-ID for cross-platform analysis and Reporting: deduplicate user counts documentation for more information on this identifier. |
Event Timestamp | Type: STRING A Unix timestamp (in microseconds) for the time to associate with the event. Segment will convert to Unix if not already converted. Events can be backdated up to 3 calendar days based on the property’s timezone. |
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. |
User Properties | Type: OBJECT The user properties to send to Google Analytics 4. You must create user-scoped dimensions to ensure custom properties are picked up by Google. See Google’s Custom user properties to learn how to set and register user properties. |
Engagement Time in Milliseconds | Type: NUMBER The amount of time a user interacted with your site, in milliseconds. Google only counts users who interact with your site for a non-zero amount of time. By default, Segment sets engagement time to 1 so users are counted. |
Event Parameters | Type: OBJECT The event parameters to send to Google Analytics 4. |
Ad User Data Consent State | Type: STRING Sets consent for sending user data to Google for advertising purposes. Must be either GRANTED or DENIED. |
Ad Personalization Consent State | Type: STRING Sets consent for personalized advertising. Must be either GRANTED or DENIED. |
View Item
Send event when a user views an item
View Item is a Cloud action. The default Trigger is: type = "track" and event = "Product Viewed"
Field | Description |
---|---|
Data Stream Type | Type: STRING The type of data stream this data belongs in. This can either be a web stream or a mobile app stream (iOS or Android). Possible values: “Web” (default) and “Mobile App”. |
Firebase App Instance ID | Type: STRING Uniquely identifies a specific installation of a Firebase app. This value needs to be retrieved through the Firebase SDK. Required for mobile app streams. |
Client ID | Type: STRING Uniquely identifies a user instance of a web client. Required for web streams. |
User ID | Type: STRING A unique identifier for a user. See Google’s User-ID for cross-platform analysis and Reporting: deduplicate user counts documentation for more information on this identifier. |
Event Timestamp | Type: STRING A Unix timestamp (in microseconds) for the time to associate with the event. Segment will convert to Unix if not already converted. Events can be backdated up to 3 calendar days based on the property’s timezone. |
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. |
User Properties | Type: OBJECT The user properties to send to Google Analytics 4. You must create user-scoped dimensions to ensure custom properties are picked up by Google. See Google’s Custom user properties to learn how to set and register user properties. |
Engagement Time in Milliseconds | Type: NUMBER The amount of time a user interacted with your site, in milliseconds. Google only counts users who interact with your site for a non-zero amount of time. By default, Segment sets engagement time to 1 so users are counted. |
Event Parameters | Type: OBJECT The event parameters to send to Google Analytics 4. |
Ad User Data Consent State | Type: STRING Sets consent for sending user data to Google for advertising purposes. Must be either GRANTED or DENIED. |
Ad Personalization Consent State | Type: STRING Sets consent for personalized advertising. Must be either GRANTED or DENIED. |
Custom Event
Send any custom event
Custom Event is a Cloud action. The default Trigger is: type = "track"
Field | Description |
---|---|
Data Stream Type | Type: STRING The type of data stream this data belongs in. This can either be a web stream or a mobile app stream (iOS or Android). Possible values: “Web” (default) and “Mobile App”. |
Firebase App Instance ID | Type: STRING Uniquely identifies a specific installation of a Firebase app. This value needs to be retrieved through the Firebase SDK. Required for mobile app streams. |
Client ID | Type: STRING Uniquely identifies a user instance of a web client. Required for web streams. |
User ID | Type: STRING A unique identifier for a user. See Google’s User-ID for cross-platform analysis and Reporting: deduplicate user counts documentation for more information on this identifier. |
Event Timestamp | Type: STRING A Unix timestamp (in microseconds) for the time to associate with the event. Segment will convert to Unix if not already converted. Events can be backdated up to 3 calendar days based on the property’s timezone. |
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. |
User Properties | Type: OBJECT The user properties to send to Google Analytics 4. You must create user-scoped dimensions to ensure custom properties are picked up by Google. See Google’s Custom user properties to learn how to set and register user properties. |
Engagement Time in Milliseconds | Type: NUMBER The amount of time a user interacted with your site, in milliseconds. Google only counts users who interact with your site for a non-zero amount of time. By default, Segment sets engagement time to 1 so users are counted. |
Event Parameters | Type: OBJECT The event parameters to send to Google Analytics 4. |
Ad User Data Consent State | Type: STRING Sets consent for sending user data to Google for advertising purposes. Must be either GRANTED or DENIED. |
Ad Personalization Consent State | Type: STRING Sets consent for personalized advertising. Must be either GRANTED or DENIED. |
Select Item
Send event when a user selects an item from a list
Select Item is a Cloud action. The default Trigger is: type = "track" and event = "Product Clicked"
Field | Description |
---|---|
Data Stream Type | Type: STRING The type of data stream this data belongs in. This can either be a web stream or a mobile app stream (iOS or Android). Possible values: “Web” (default) and “Mobile App”. |
Firebase App Instance ID | Type: STRING Uniquely identifies a specific installation of a Firebase app. This value needs to be retrieved through the Firebase SDK. Required for mobile app streams. |
Client ID | Type: STRING Uniquely identifies a user instance of a web client. Required for web streams. |
User ID | Type: STRING A unique identifier for a user. See Google’s User-ID for cross-platform analysis and Reporting: deduplicate user counts documentation for more information on this identifier. |
Event Timestamp | Type: STRING A Unix timestamp (in microseconds) for the time to associate with the event. Segment will convert to Unix if not already converted. Events can be backdated up to 3 calendar days based on the property’s timezone. |
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. |
User Properties | Type: OBJECT The user properties to send to Google Analytics 4. You must create user-scoped dimensions to ensure custom properties are picked up by Google. See Google’s Custom user properties to learn how to set and register user properties. |
Engagement Time in Milliseconds | Type: NUMBER The amount of time a user interacted with your site, in milliseconds. Google only counts users who interact with your site for a non-zero amount of time. By default, Segment sets engagement time to 1 so users are counted. |
Event Parameters | Type: OBJECT The event parameters to send to Google Analytics 4. |
Ad User Data Consent State | Type: STRING Sets consent for sending user data to Google for advertising purposes. Must be either GRANTED or DENIED. |
Ad Personalization Consent State | Type: STRING Sets consent for personalized advertising. Must be either GRANTED or DENIED. |
View Item List
Send event when a user views a list of items or offerings
View Item List is a Cloud action. The default Trigger is: type = "track" and event = "Product List Viewed"
Field | Description |
---|---|
Data Stream Type | Type: STRING The type of data stream this data belongs in. This can either be a web stream or a mobile app stream (iOS or Android). Possible values: “Web” (default) and “Mobile App”. |
Firebase App Instance ID | Type: STRING Uniquely identifies a specific installation of a Firebase app. This value needs to be retrieved through the Firebase SDK. Required for mobile app streams. |
Client ID | Type: STRING Uniquely identifies a user instance of a web client. Required for web streams. |
User ID | Type: STRING A unique identifier for a user. See Google’s User-ID for cross-platform analysis and Reporting: deduplicate user counts documentation for more information on this identifier. |
Event Timestamp | Type: STRING A Unix timestamp (in microseconds) for the time to associate with the event. Segment will convert to Unix if not already converted. Events can be backdated up to 3 calendar days based on the property’s timezone. |
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. |
User Properties | Type: OBJECT The user properties to send to Google Analytics 4. You must create user-scoped dimensions to ensure custom properties are picked up by Google. See Google’s Custom user properties to learn how to set and register user properties. |
Engagement Time in Milliseconds | Type: NUMBER The amount of time a user interacted with your site, in milliseconds. Google only counts users who interact with your site for a non-zero amount of time. By default, Segment sets engagement time to 1 so users are counted. |
Event Parameters | Type: OBJECT The event parameters to send to Google Analytics 4. |
Ad User Data Consent State | Type: STRING Sets consent for sending user data to Google for advertising purposes. Must be either GRANTED or DENIED. |
Ad Personalization Consent State | Type: STRING Sets consent for personalized advertising. Must be either GRANTED or DENIED. |
Refund
Send event when a refund is issued
Refund is a Cloud action. The default Trigger is: type = "track" and event = "Order Refunded"
Field | Description |
---|---|
Data Stream Type | Type: STRING The type of data stream this data belongs in. This can either be a web stream or a mobile app stream (iOS or Android). Possible values: “Web” (default) and “Mobile App”. |
Firebase App Instance ID | Type: STRING Uniquely identifies a specific installation of a Firebase app. This value needs to be retrieved through the Firebase SDK. Required for mobile app streams. |
Client ID | Type: STRING Uniquely identifies a user instance of a web client. Required for web streams. |
User ID | Type: STRING A unique identifier for a user. See Google’s User-ID for cross-platform analysis and Reporting: deduplicate user counts documentation for more information on this identifier. |
Event Timestamp | Type: STRING A Unix timestamp (in microseconds) for the time to associate with the event. Segment will convert to Unix if not already converted. Events can be backdated up to 3 calendar days based on the property’s timezone. |
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. |
User Properties | Type: OBJECT The user properties to send to Google Analytics 4. You must create user-scoped dimensions to ensure custom properties are picked up by Google. See Google’s Custom user properties to learn how to set and register user properties. |
Engagement Time in Milliseconds | Type: NUMBER The amount of time a user interacted with your site, in milliseconds. Google only counts users who interact with your site for a non-zero amount of time. By default, Segment sets engagement time to 1 so users are counted. |
Event Parameters | Type: OBJECT The event parameters to send to Google Analytics 4. |
Ad User Data Consent State | Type: STRING Sets consent for sending user data to Google for advertising purposes. Must be either GRANTED or DENIED. |
Ad Personalization Consent State | Type: STRING Sets consent for personalized advertising. Must be either GRANTED or DENIED. |
Add Payment Info
Send event when a user submits their payment information
Add Payment Info is a Cloud action. The default Trigger is: type = "track" and event = "Payment Info Entered"
Field | Description |
---|---|
Data Stream Type | Type: STRING The type of data stream this data belongs in. This can either be a web stream or a mobile app stream (iOS or Android). Possible values: “Web” (default) and “Mobile App”. |
Firebase App Instance ID | Type: STRING Uniquely identifies a specific installation of a Firebase app. This value needs to be retrieved through the Firebase SDK. Required for mobile app streams. |
Client ID | Type: STRING Uniquely identifies a user instance of a web client. Required for web streams. |
User ID | Type: STRING A unique identifier for a user. See Google’s User-ID for cross-platform analysis and Reporting: deduplicate user counts documentation for more information on this identifier. |
Event Timestamp | Type: STRING A Unix timestamp (in microseconds) for the time to associate with the event. Segment will convert to Unix if not already converted. Events can be backdated up to 3 calendar days based on the property’s timezone. |
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. |
User Properties | Type: OBJECT The user properties to send to Google Analytics 4. You must create user-scoped dimensions to ensure custom properties are picked up by Google. See Google’s Custom user properties to learn how to set and register user properties. |
Engagement Time in Milliseconds | Type: NUMBER The amount of time a user interacted with your site, in milliseconds. Google only counts users who interact with your site for a non-zero amount of time. By default, Segment sets engagement time to 1 so users are counted. |
Event Parameters | Type: OBJECT The event parameters to send to Google Analytics 4. |
Ad User Data Consent State | Type: STRING Sets consent for sending user data to Google for advertising purposes. Must be either GRANTED or DENIED. |
Ad Personalization Consent State | Type: STRING Sets consent for personalized advertising. Must be either GRANTED or DENIED. |
Add to Wishlist
Send event when a user adds items to a wishlist
Add to Wishlist is a Cloud action. The default Trigger is: type = "track" and event = "Product Added to Wishlist"
Field | Description |
---|---|
Data Stream Type | Type: STRING The type of data stream this data belongs in. This can either be a web stream or a mobile app stream (iOS or Android). Possible values: “Web” (default) and “Mobile App”. |
Firebase App Instance ID | Type: STRING Uniquely identifies a specific installation of a Firebase app. This value needs to be retrieved through the Firebase SDK. Required for mobile app streams. |
Client ID | Type: STRING Uniquely identifies a user instance of a web client. Required for web streams. |
User ID | Type: STRING A unique identifier for a user. See Google’s User-ID for cross-platform analysis and Reporting: deduplicate user counts documentation for more information on this identifier. |
Event Timestamp | Type: STRING A Unix timestamp (in microseconds) for the time to associate with the event. Segment will convert to Unix if not already converted. Events can be backdated up to 3 calendar days based on the property’s timezone. |
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. |
User Properties | Type: OBJECT The user properties to send to Google Analytics 4. You must create user-scoped dimensions to ensure custom properties are picked up by Google. See Google’s Custom user properties to learn how to set and register user properties. |
Engagement Time in Milliseconds | Type: NUMBER The amount of time a user interacted with your site, in milliseconds. Google only counts users who interact with your site for a non-zero amount of time. By default, Segment sets engagement time to 1 so users are counted. |
Event Parameters | Type: OBJECT The event parameters to send to Google Analytics 4. |
Ad User Data Consent State | Type: STRING Sets consent for sending user data to Google for advertising purposes. Must be either GRANTED or DENIED. |
Ad Personalization Consent State | Type: STRING Sets consent for personalized advertising. Must be either GRANTED or DENIED. |
Sign Up
Send event when a user signs up to measure the popularity of each sign-up method
Sign Up is a Cloud action. The default Trigger is: type = "track" and event = "Signed Up"
Field | Description |
---|---|
Data Stream Type | Type: STRING The type of data stream this data belongs in. This can either be a web stream or a mobile app stream (iOS or Android). Possible values: “Web” (default) and “Mobile App”. |
Firebase App Instance ID | Type: STRING Uniquely identifies a specific installation of a Firebase app. This value needs to be retrieved through the Firebase SDK. Required for mobile app streams. |
Client ID | Type: STRING Uniquely identifies a user instance of a web client. Required for web streams. |
User ID | Type: STRING A unique identifier for a user. See Google’s User-ID for cross-platform analysis and Reporting: deduplicate user counts documentation for more information on this identifier. |
Event Timestamp | Type: STRING A Unix timestamp (in microseconds) for the time to associate with the event. Segment will convert to Unix if not already converted. Events can be backdated up to 3 calendar days based on the property’s timezone. |
Method | Type: STRING The method used for sign up. |
User Properties | Type: OBJECT The user properties to send to Google Analytics 4. You must create user-scoped dimensions to ensure custom properties are picked up by Google. See Google’s Custom user properties to learn how to set and register user properties. |
Engagement Time in Milliseconds | Type: NUMBER The amount of time a user interacted with your site, in milliseconds. Google only counts users who interact with your site for a non-zero amount of time. By default, Segment sets engagement time to 1 so users are counted. |
Event Parameters | Type: OBJECT The event parameters to send to Google Analytics 4. |
Ad User Data Consent State | Type: STRING Sets consent for sending user data to Google for advertising purposes. Must be either GRANTED or DENIED. |
Ad Personalization Consent State | Type: STRING Sets consent for personalized advertising. Must be either GRANTED or DENIED. |
View Promotion
Send event when a promotion is shown to a user
View Promotion is a Cloud action. The default Trigger is: type = "track" and event = "Promotion Viewed"
Field | Description |
---|---|
Data Stream Type | Type: STRING The type of data stream this data belongs in. This can either be a web stream or a mobile app stream (iOS or Android). Possible values: “Web” (default) and “Mobile App”. |
Firebase App Instance ID | Type: STRING Uniquely identifies a specific installation of a Firebase app. This value needs to be retrieved through the Firebase SDK. Required for mobile app streams. |
Client ID | Type: STRING Uniquely identifies a user instance of a web client. Required for web streams. |
User ID | Type: STRING A unique identifier for a user. See Google’s User-ID for cross-platform analysis and Reporting: deduplicate user counts documentation for more information on this identifier. |
Event Timestamp | Type: STRING A Unix timestamp (in microseconds) for the time to associate with the event. Segment will convert to Unix if not already converted. Events can be backdated up to 3 calendar days based on the property’s timezone. |
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. |
User Properties | Type: OBJECT The user properties to send to Google Analytics 4. You must create user-scoped dimensions to ensure custom properties are picked up by Google. See Google’s Custom user properties to learn how to set and register user properties. |
Engagement Time in Milliseconds | Type: NUMBER The amount of time a user interacted with your site, in milliseconds. Google only counts users who interact with your site for a non-zero amount of time. By default, Segment sets engagement time to 1 so users are counted. |
Event Parameters | Type: OBJECT The event parameters to send to Google Analytics 4. |
Ad User Data Consent State | Type: STRING Sets consent for sending user data to Google for advertising purposes. Must be either GRANTED or DENIED. |
Ad Personalization Consent State | Type: STRING Sets consent for personalized advertising. Must be either GRANTED or DENIED. |
View Cart
Send event when a user views their cart
View Cart is a Cloud action. The default Trigger is: type = "track" and event = "Cart Viewed"
Field | Description |
---|---|
Data Stream Type | Type: STRING The type of data stream this data belongs in. This can either be a web stream or a mobile app stream (iOS or Android). Possible values: “Web” (default) and “Mobile App”. |
Firebase App Instance ID | Type: STRING Uniquely identifies a specific installation of a Firebase app. This value needs to be retrieved through the Firebase SDK. Required for mobile app streams. |
Client ID | Type: STRING Uniquely identifies a user instance of a web client. Required for web streams. |
User ID | Type: STRING A unique identifier for a user. See Google’s User-ID for cross-platform analysis and Reporting: deduplicate user counts documentation for more information on this identifier. |
Event Timestamp | Type: STRING A Unix timestamp (in microseconds) for the time to associate with the event. Segment will convert to Unix if not already converted. Events can be backdated up to 3 calendar days based on the property’s timezone. |
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. |
User Properties | Type: OBJECT The user properties to send to Google Analytics 4. You must create user-scoped dimensions to ensure custom properties are picked up by Google. See Google’s Custom user properties to learn how to set and register user properties. |
Engagement Time in Milliseconds | Type: NUMBER The amount of time a user interacted with your site, in milliseconds. Google only counts users who interact with your site for a non-zero amount of time. By default, Segment sets engagement time to 1 so users are counted. |
Event Parameters | Type: OBJECT The event parameters to send to Google Analytics 4. |
Ad User Data Consent State | Type: STRING Sets consent for sending user data to Google for advertising purposes. Must be either GRANTED or DENIED. |
Ad Personalization Consent State | Type: STRING Sets consent for personalized advertising. Must be either GRANTED or DENIED. |
Login
Send event when a user logs in
Login is a Cloud action. The default Trigger is: type = "track" and event = "Signed In"
Field | Description |
---|---|
Data Stream Type | Type: STRING The type of data stream this data belongs in. This can either be a web stream or a mobile app stream (iOS or Android). Possible values: “Web” (default) and “Mobile App”. |
Firebase App Instance ID | Type: STRING Uniquely identifies a specific installation of a Firebase app. This value needs to be retrieved through the Firebase SDK. Required for mobile app streams. |
Client ID | Type: STRING Uniquely identifies a user instance of a web client. Required for web streams. |
User ID | Type: STRING A unique identifier for a user. See Google’s User-ID for cross-platform analysis and Reporting: deduplicate user counts documentation for more information on this identifier. |
Event Timestamp | Type: STRING A Unix timestamp (in microseconds) for the time to associate with the event. Segment will convert to Unix if not already converted. Events can be backdated up to 3 calendar days based on the property’s timezone. |
Method | Type: STRING The method used to login. |
User Properties | Type: OBJECT The user properties to send to Google Analytics 4. You must create user-scoped dimensions to ensure custom properties are picked up by Google. See Google’s Custom user properties to learn how to set and register user properties. |
Engagement Time in Milliseconds | Type: NUMBER The amount of time a user interacted with your site, in milliseconds. Google only counts users who interact with your site for a non-zero amount of time. By default, Segment sets engagement time to 1 so users are counted. |
Event Parameters | Type: OBJECT The event parameters to send to Google Analytics 4. |
Ad User Data Consent State | Type: STRING Sets consent for sending user data to Google for advertising purposes. Must be either GRANTED or DENIED. |
Ad Personalization Consent State | Type: STRING Sets consent for personalized advertising. Must be either GRANTED or DENIED. |
Remove from Cart
Send event when a user removes items from a cart
Remove from Cart is a Cloud action. The default Trigger is: type = "track" and event = "Product Removed"
Field | Description |
---|---|
Data Stream Type | Type: STRING The type of data stream this data belongs in. This can either be a web stream or a mobile app stream (iOS or Android). Possible values: “Web” (default) and “Mobile App”. |
Firebase App Instance ID | Type: STRING Uniquely identifies a specific installation of a Firebase app. This value needs to be retrieved through the Firebase SDK. Required for mobile app streams. |
Client ID | Type: STRING Uniquely identifies a user instance of a web client. Required for web streams. |
User ID | Type: STRING A unique identifier for a user. See Google’s User-ID for cross-platform analysis and Reporting: deduplicate user counts documentation for more information on this identifier. |
Event Timestamp | Type: STRING A Unix timestamp (in microseconds) for the time to associate with the event. Segment will convert to Unix if not already converted. Events can be backdated up to 3 calendar days based on the property’s timezone. |
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. |
User Properties | Type: OBJECT The user properties to send to Google Analytics 4. You must create user-scoped dimensions to ensure custom properties are picked up by Google. See Google’s Custom user properties to learn how to set and register user properties. |
Engagement Time in Milliseconds | Type: NUMBER The amount of time a user interacted with your site, in milliseconds. Google only counts users who interact with your site for a non-zero amount of time. By default, Segment sets engagement time to 1 so users are counted. |
Event Parameters | Type: OBJECT The event parameters to send to Google Analytics 4. |
Ad User Data Consent State | Type: STRING Sets consent for sending user data to Google for advertising purposes. Must be either GRANTED or DENIED. |
Ad Personalization Consent State | Type: STRING Sets consent for personalized advertising. Must be either GRANTED or DENIED. |
Search
Send event when a user searches your content
Search is a Cloud action. The default Trigger is: type = "track" and event = "Products Searched"
Field | Description |
---|---|
Data Stream Type | Type: STRING The type of data stream this data belongs in. This can either be a web stream or a mobile app stream (iOS or Android). Possible values: “Web” (default) and “Mobile App”. |
Firebase App Instance ID | Type: STRING Uniquely identifies a specific installation of a Firebase app. This value needs to be retrieved through the Firebase SDK. Required for mobile app streams. |
Client ID | Type: STRING Uniquely identifies a user instance of a web client. Required for web streams. |
User ID | Type: STRING A unique identifier for a user. See Google’s User-ID for cross-platform analysis and Reporting: deduplicate user counts documentation for more information on this identifier. |
Event Timestamp | Type: STRING A Unix timestamp (in microseconds) for the time to associate with the event. Segment will convert to Unix if not already converted. Events can be backdated up to 3 calendar days based on the property’s timezone. |
Search Term* | Type: STRING The term that was searched for. |
User Properties | Type: OBJECT The user properties to send to Google Analytics 4. You must create user-scoped dimensions to ensure custom properties are picked up by Google. See Google’s Custom user properties to learn how to set and register user properties. |
Engagement Time in Milliseconds | Type: NUMBER The amount of time a user interacted with your site, in milliseconds. Google only counts users who interact with your site for a non-zero amount of time. By default, Segment sets engagement time to 1 so users are counted. |
Event Parameters | Type: OBJECT The event parameters to send to Google Analytics 4. |
Ad User Data Consent State | Type: STRING Sets consent for sending user data to Google for advertising purposes. Must be either GRANTED or DENIED. |
Ad Personalization Consent State | Type: STRING Sets consent for personalized advertising. Must be either GRANTED or DENIED. |
Generate Lead
Send event when a user submits a form or request for information
Generate Lead is a Cloud action. The default Trigger is: type = "track"
Field | Description |
---|---|
Data Stream Type | Type: STRING The type of data stream this data belongs in. This can either be a web stream or a mobile app stream (iOS or Android). Possible values: “Web” (default) and “Mobile App”. |
Firebase App Instance ID | Type: STRING Uniquely identifies a specific installation of a Firebase app. This value needs to be retrieved through the Firebase SDK. Required for mobile app streams. |
Client ID | Type: STRING Uniquely identifies a user instance of a web client. Required for web streams. |
User ID | Type: STRING A unique identifier for a user. See Google’s User-ID for cross-platform analysis and Reporting: deduplicate user counts documentation for more information on this identifier. |
Event Timestamp | Type: STRING A Unix timestamp (in microseconds) for the time to associate with the event. Segment will convert to Unix if not already converted. Events can be backdated up to 3 calendar days based on the property’s timezone. |
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. |
User Properties | Type: OBJECT The user properties to send to Google Analytics 4. You must create user-scoped dimensions to ensure custom properties are picked up by Google. See Google’s Custom user properties to learn how to set and register user properties. |
Engagement Time in Milliseconds | Type: NUMBER The amount of time a user interacted with your site, in milliseconds. Google only counts users who interact with your site for a non-zero amount of time. By default, Segment sets engagement time to 1 so users are counted. |
Event Parameters | Type: OBJECT The event parameters to send to Google Analytics 4. |
Ad User Data Consent State | Type: STRING Sets consent for sending user data to Google for advertising purposes. Must be either GRANTED or DENIED. |
Ad Personalization Consent State | Type: STRING Sets consent for personalized advertising. Must be either GRANTED or DENIED. |
Consent mode
Consent mode is a feature provided by Google in the context of its products, particularly the Gtag library and Google Analytics. As of March 6, 2024, Google announced that consent mode must function for European Economic Area (EEA) users, otherwise data from EEA users won’t process.
Consent mode in the Gtag library and Google Analytics is designed to help website owners comply with privacy regulations, such as the General Data Protection Regulation (GDPR) in the European Union. It allows website owners to adjust how these tools use and collect data based on user consent.
With consent mode, you can configure your website to dynamically adjust the tracking behavior of the Gtag library and Google Analytics based on the user’s consent status. If a user provides consent to data processing, both the Gtag library and Google Analytics can collect and use that data for analysis. If a user doesn’t provide consent, both tools limit data collection to essential functions, helping businesses respect user privacy preferences.
Consent mode may involve updates to your sources outside of Segment, such as incorporating a consent management system for consent functionality.
Set up consent mode
To enable consent mode for your Google Analytics 4 Cloud destination, you must update the Ad User Data Consent State and Ad Personalization Consent State for all mappings you want to send with consent. Consent mode supports all actions with Google Analytics 4 Cloud. You can choose from 2 options to enable consent mode for your Google Analytics 4 Cloud destination.
-
Option 1
To enable consent mode for Google Analytics 4 Cloud destination:
- Navigate to Connections > Destinations and select your Google Analytics 4 Cloud destination.
- Go to the Mappings tab of the destination.
- Select the mapping you want to edit.
- Under the Select mappings section, find Ad User Data Consent State.
- Select
GRANTED
in the dropdown that corresponds to Ad User Data Consent State. - Select
GRANTED
in the dropdown that corresponds to Ad Personalization Consent State.
-
Option 2
Create an event variable to directly grab the value from the payload. To do this:
- Navigate to Connections > Destinations and select your Google Analytics 4 Cloud destination.
- Go to the Mappings tab of the destination.
- Select the mapping you want to edit.
- Under the Select mappings section, find Ad User Data Consent State.
- Select the Event Variables tab and create an event variable to directly grab the value from the payload. Ensure it translates to
GRANTED
orDENIED
. You can use an insert or replace function to translate other values toGRANTED
orDENIED
. - Repeat step 5 for Ad Personalization Consent State.
If you have any questions setting up consent mode, reach out to friends@segment.com.
Universal Analytics and Google Analytics 4
Differences between Universal Analytics and Google Analytics 4
Google Analytics 4 uses an event-based data model similar to Segment, with the principle that any interaction can be captured as an event. Universal Analytics, on the other hand, is based on hits and is primarily pageview-based. Because the data collection models are different, data cannot be migrated from Universal Analytics to Google Analytics 4 and Google recommends recreating your existing Universal Analytics tracking in Google Analytics 4. For more information on the different data models, see Google’s Events in Google Analytics 4 vs Universal Analytics and Universal Analytics versus Google Analytics 4 data.
Google Analytics 4 has different out-of-the-box reports. Google Analytics 4’s reporting is much more configurable and supports new reporting metrics like churn probability and predictive revenue estimates. In addition, goals defined in Universal Analytics have been replaced with the concept of conversions in Google Analytics 4. Reports and conversions will need to be rebuilt in Google Analytics 4.
To determine whether you have a Universal Analytics property or a Google Analytics 4 property, look at your property ID. Universal Analytics property IDs start with UA and end with a number (UA-XXXXXXXXX-1). Google Analytics 4 property IDs have only numbers (XXXXXXXXX).
Migrating from Universal Analytics to Google Analytics 4
Google announced that all standard Universal Analytics properties will stop processing new data on July 1, 2023. 360 Universal Analytics properties with a current order will receive a one-time processing extension ending on July 1, 2024. Learn more about when Google Analytics 4 will replace Universal Analytics.
Segment’s Google Analytics 4 Cloud integration is a server-side integration with the GA4 Measurement Protocol API. This is similar to Segment’s Google Universal Analytics cloud-mode integration in that all data is sent directly to Google’s servers. Please note that this means client-side functionality, such as Enhanced Measurement, may not be available through Segment. In addition, as Google continues to develop the GA4 Measurement Protocol API ahead of general availability of the API, there may be limitations that impact what can be seen in the Google Analytics 4 reports.
Recommended events
Google Analytics 4 requires the use of recommended events and properties to power certain built-in reports. Segment’s Google Analytics 4 Cloud destination provides prebuilt mappings to automatically map your Segment specevents to the corresponding Google Analytics 4 events and properties. If your Segment events don’t follow the Segment spec exactly, you can modify the mappings. For example, Segment maps “Order Completed” events to the Google Analytics 4 “Purchase” event by default. If your company uses “Products Purchase” to indicate a purchase, this can be mapped in the Purchase action’s Event Trigger instead.
Segment recommends using the prebuilt mappings when possible, however the Segment spec doesn’t have an equivalent event for every Google Analytics 4 recommended event. If there are other recommended events you would like to send, please use the Custom Event action. For example, to send a spend_virtual_currency
event, create a mapping for Custom Event, set up your Event Trigger criteria, and input a literal string of “spend_virtual_currency” as the Event Name. You can use the Event Parameters object to add fields that are in the spend_virtual_currency
event such as value
and virtual_currency_name
.
Custom events
In addition to recommended events, you can also send custom events using the Custom Event action. Custom events are events that you name. Custom events don’t appear in most standard reports; you need to set up custom reports for meaningful analysis. To create custom events in the Google Analytics 4 web interface, see Google’s Modify and create events through the user interface.
Event naming limitations
Google Analytics 4 requires that all event names contain only alpha-numeric characters and underscores, must start with an alphabetic character, and support a maximum of 40 characters. Segment replaces spaces in Event Names with an underscore, so that these events are accepted by GA4. For example, Segment renames an event named Home Profile
to Home_Profile
. In some cases, GA4 may reject an event outright, due to unsupported characters. For example, an event named Home | Profile
will be silently rejected due to the pipe character.
In all cases, event names in GA4 are case sensitive and require values in all properties. The Custom Event action includes a Lowercase Event Name option, to ensure consistency of all events sent to Google. For more information, see Google’s articles Google Analytics 4 event name rules and Event name limitations.
Custom dimensions and metrics
With Google Analytics 4, you must create custom dimensions and metrics within the Google Analytics 4 interface and link parameters to the corresponding dimension or metric. When you create the dimension or metric, you can either select a parameter from the list of already collected fields or enter the name of the parameter you plan to collect in the future. Custom dimensions can be either event-scoped or user-scoped, and custom metrics must be event-scoped.
To send parameters to Google Analytics 4, use the Event Parameters or User Properties object available on every action. Only pass flat key-value pairs in the Event Parameters and User Properties objects. Keep in mind that Google silently drops any events that include nested parameters.
To achieve parity with Universal Analytics, you should create the same custom dimensions that you defined in Universal Analytics. Additionally, in Google Analytics 4, you should recreate many of the values that you tracked as event dimensions in Universal Analytics, particularly event category and event label. For more information, see Google Analytics 4 Custom dimensions and metrics.
Tracking active users and sessions
Server-side Implementation using Google Analytics 4 Cloud Destination
The Google Analytics 4 reports only display active users who engage with your site for a non-zero amount of time. To ensure users are rendered in reports, Segment sets the engagement_time_msec
parameter to 1 by default. If you track engagement time on your Segment events, you can use the Engagement Time in Milliseconds field mapping to set engagement_time_msec
to a different value.
Besides Engagement Time in Milliseconds, you can also generate your own session_id
and session_number
and pass them as event properties to Segment. These properties can then be mapped to their corresponding parameters in Segment’s Google Analytics 4 Cloud destination.
Session tracking limitations
Session tracking server-side only supports a subset of user dimensions. Certain reserved fields such as location, demographics, other predefined user dimensions and device-specific information are not supported by Google’s Measurement Protocol API.
Using Gtag.js and Google Analytics 4 Cloud Destination
If you choose to integrate with Google Analytics 4 client-side (either with Segment’s Google Analytics 4 Web destination or outside of Segment) and also use Segment’s Google Analytics 4 Cloud destination to send events through the API, you will have all the reserved parameters and sessions tracking information available in Google Analytics 4 reports.
When using Gtag, Google generates a session_id
and session_number
when a session begins. The session_id
and session_number
generated on the client can be passed as Event Parameters to stitch events sent through the API with the same session that was collected client-side. Additionally, client_id
must be the same for both client-side and server-side events in order to deduplicate user counts in GA4 (unless User-ID is used as the basis for user identification). For events to stitch properly, server-side events must arrive within a 48 hour window of when the client-side events arrive.
You can check your client_id
, session_id
and session_number
with the Google Site Tag function or by running this script in your JavaScript console and replacing G-xxxxxxxxxx
with your Google Analytics 4 Measurement ID:
const sessionIdPromise = new Promise(resolve => {
gtag('get', 'G-xxxxxxxxxx', 'session_id', resolve)
});
const sessionNumPromise = new Promise(resolve => {
gtag('get', 'G-xxxxxxxxxx', 'session_number', resolve)
});
const clientIdPromise = new Promise(resolve => {
gtag('get', 'G-xxxxxxxxxx', 'client_id', resolve)
});
Promise.all([sessionIdPromise, sessionNumPromise, clientIdPromise]).then(function(session_data) {
console.log("session ID: "+session_data[0]);
console.log("session Number: "+session_data[1]);
console.log("client ID: "+session_data[2]);
});
User identification
Segment requires a Client ID or Firebase App Instance ID to send data to Google Analytics 4. The Client ID is the web equivalent of a device identifier and uniquely identifies a given user instance of a web client. By default, Segment sets Client ID to the Segment userId
, falling back on anonymousId
. This mapping can be changed within each action if you prefer to map a different field to Client ID.
The Firebase App Instance ID is the mobile equivalent of a device identifier and uniquely identifiers a given Firebase app instance. No default is set for Firebase App Instance ID, as this value needs to be retrieved through the Firebase SDK.
Segment also allows you to send a User-ID with your events. The User-ID feature lets you associate your own identifiers with individual users so you can connect their behavior across different sessions and on various devices and platforms. For more information on User-ID, see Google’s Measure activity across platforms and Reporting: deduplicate user counts.
There are certain scenarios where sending a User-ID can be helpful. For example, if you choose to integrate with Google Analytics 4 client-side (either with Segment’s Google Analytics 4 Web destination or outside of Segment) and also use Segment’s Google Analytics 4 Cloud destination to send events through the API, you may consider taking the following approach:
- Use the Gtag-generated Client ID. Gtag will set a Client ID automatically. The Client ID is stored in a cookie and can be fetched on the web client. To tie data between client-side and server-side, pass the Gtag-generated Client ID to Segment as a property and use that value as the Client ID in the Google Analytics 4 Cloud destination mappings.
- Use the Segment
userId
for User-ID. The SegmentuserId
should be your company’s canonical user identifier. By setting Google’s User-ID to the same value asuserId
on client-side and server-side, you can benefit from cross-platform analytics. In addition, if you use Firebase to send mobile data to Google Analytics 4, using the same User-ID across web and mobile will ensure users are stitched together across devices.
Validating and comparing data
Google recommends a period of dual-collection with both Universal Analytics and Google Analytics 4. This dual-collection approach lets you build a historical record in Google Analytics 4 while continuing to depend on Universal Analytics until you’re ready to fully switch over.
During this period, you may find it hard to perfectly compare between the two properties because reports and configuration settings vary between Universal Analytics and Google Analytics 4 properties. Google provides guidance on the conditions that must be met in order to compare data in the Realtime reports, as well as which metrics are comparable versus not.
For a complete map of Universal Analytics functionality to corresponding Google Analytics 4 functionality, please see Google’s Migration Reference.
FAQ and Troubleshooting
Data not sending to Google
Ensure that at least one mapping has been configured and enabled in the destination mappings for an event that you would like to reach Google. Without any mappings enabled to trigger on an event that has been ingested by the connected source, the destination will not send events downstream.
Attribution reporting
Google doesn’t currently support passing certain reserved fields to the Google Analytics 4 Measurement Protocol API. This includes attribution data, like UTM parameters. If you rely on attribution reporting, you can either send this data as custom dimensions or implement a parallel client-side integration to collect this data with gtag.js (web) or Firebase (mobile).
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 Cloud integration is server-side and uses the Measurement Protocol API, debug mode is not supported.
However, you can use Google’s /debug
endpoint to test your events against Google’s Measurement Protocol Validation Server. For more information, see Google’s Validate events documentation.
To validate your events:
- Run a test through Segment’s Event Tester with the event you’re concerned about.
- Copy the
Request from Segment
value you see. This is the payload that Segment attempts to send to Google. - Use an API testing tool, like Postman, to send that payload to Google’s
/debug
endpoint. - Google’s
/debug
endpoint returns a validation code and a description of the error.
Mobile data
To achieve complete reporting, Google recommends use of their Firebase SDKs to send mobile data to Google Analytics 4. To assist in your implementation, Segment has a Firebase destination available for mobile analytics. For more information on linking Google Analytics 4 properties to Firebase, see Google Analytics 4 Firebase integration.
The Segment Google Analytics 4 Cloud destination supports sending mobile app events server-side to supplement your Firebase implementation. To send mobile events server-side, configure the Firebase App ID in the Destination settings. In each mapping, change the Data Stream Type to Mobile App
and set a Firebase App Instance ID so that data routes to a mobile stream.
Reserved names
Google reserves certain event names, parameters, and user properties. Google silently drops any events that include these reserved names. Google doesn’t accept events in the following conditions:
- event or user property names have spaces in them
- fields with
null
values - fields or events with reserved names
- fields with a number as the key
- fields or events with a dash (-) character in the name
Verifying Event Meet GA4’s Measurement Protocol API
Why are the events returning an error Param [PARAM] has unsupported value.?
Google has some requirements/limitations imposed by their Measurement Protocol API. If an event contains null
/object
/array
parameters, GA4 silently drops the event, so Segment does not attempt to send the event but instead returns an error of Invalid Type
that can be found in the destination’s Event Delivery tab. To verify whether an event will return this error, you can send an event to GA4’s debug endpoint with an API tool like Postman.
Data takes a long time to appear in Google’s reports
Google may take 24-48 hours to process data sent to Google Analytics. As a result, the Google Analytics user interface may not reflect the most current data. The Google Analytics Realtime report displays activity on your site as it happens.
Events with timestamps older than 72 hours are not showing on Google’s end
Because Google’s Measurement Protocol API only accepts events that are backdated by up to 72 hours, GA4 can’t accept events older than 72 hours.
Google Optimize Support
The Google Analytics 4 Cloud destination does not support Google Optimize. This destination operates in cloud-mode (sending events from Segment servers to Google Analytics using the Measurement Protocol API), which prevents the required Optimize SDK snippet from loading on the page.
Client/server-side event deduplication
Google doesn’t offer guidance around how to deduplicate the same event coming in server and client side. As a result, Segment recommends that you don’t send the same event into Google Analytics 4 from two different locations such that you would expect Google to deduplicate one of the events out of their pipeline. You can deduplicate user counts using the User ID
field, but you cannot deduplicate whole events in the Google platform as far as Segment is aware.
This page was last modified: 14 Aug 2024
Need support?
Questions? Problems? Need more info? Contact Segment Support for assistance!