Google Analytics 4 Web Destination

Destination Info

Additional versions of this destination are available

This page is about the Google Analytics 4 Web 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. When you use the Google Analytics 4 Web destination, Segment loads the gtag.js library for you.

The Google Analytics 4 Web destination is in beta and is in active development. Some functionality may change before it becomes generally available.

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 connect the Google Analytics 4 Web destination:

  1. From the Segment web app, click Catalog, then click Destinations.
  2. Search for “Google Analytics 4 Web” in the Destinations Catalog, and select the destination.
  3. Click Configure Google Analytics 4 Web.
  4. Select the web source that will send data to Google Analytics 4 and follow the steps to name your destination. The web source chosen must use Analytics.js 2.0.
  5. On the Settings tab, under Basic Settings, enter in the Measurement ID associated with your GA4 web stream.
  6. Follow the steps in the Destinations Actions documentation on Customizing mappings.

Destination Settings

Setting Description
Allow Ad Personalization Signals

Set to false to disable all advertising features. Set to true by default.

Allow Google Signals

Set to false to disable all advertising features. Set to true by default.

Cookie Domain

Specifies the domain used to store the analytics cookie. Set to “auto” by default.

Cookie Expiration In Seconds

Every time a hit is sent to GA4, the analytics cookie expiration time is updated to be the current time plus the value of this field. The default value is two years (63072000 seconds). Please input the expiration value in seconds. More information in Google Documentation

Cookie Flag

Appends additional flags to the analytics cookie. See write a new cookie for some examples of flags to set.

Cookie Path

Specifies the subpath used to store the analytics cookie.

Cookie Prefix

Specifies a prefix to prepend to the analytics cookie name.

Cookie Update

Set to false to not update cookies on each page load. This has the effect of cookie expiration being relative to the first time a user visited. Set to true by default so update cookies on each page load.

Default Ads Storage Consent State

The default value for ad cookies consent state. This is only used if Enable Consent Mode is on. Set to “granted” if it is not explicitly set. Consent state can be updated for each user in the Set Configuration Fields action.

Default Analytics Storage Consent State

The default value for analytics cookies consent state. This is only used if Enable Consent Mode is on. Set to “granted” if it is not explicitly set. Consent state can be updated for each user in the Set Configuration Fields action.

Enable Consent Mode

Set to true to enable Google’s Consent Mode. Set to false by default.

Measurement ID Required.

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

Page Views

Set to false to prevent the default snippet from sending page views. Enabled by default.

Wait Time to Update Consent State

If your CMP loads asynchronously, it might not always run before the Google tag. To handle such situations, specify a millisecond value to control how long to wait before the consent state update is sent. Please input the wait_for_update in milliseconds.

Available Presets

Google Analytics 4 Web has the following presets:

Preset Name Trigger Default Action
Set Configuration Fields Event type = "page"
Event type = "identify"
Set Configuration Fields

Available Actions

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

Mapping limits per destination

Individual destination instances have support a maximum of 50 mappings.

Add to Cart

This event signifies that an item was added to a cart for purchase.

Add to Cart is a Web action. The default Trigger is: type = "track" and event = "Product Added"

Click to show / hide fields

Field Description
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.

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.

Event Parameters Type: OBJECT

The event parameters to send to Google Analytics 4.

The term that was searched for.

Search is a Web action. The default Trigger is: type = "track" and event = "Products Searched"

Click to show / hide fields

Select Item

This event signifies an item was selected from a list.

Select Item is a Web action. The default Trigger is: type = "track" and event = "Product Clicked"

Click to show / hide fields

Field Description
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.

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.

Event Parameters Type: OBJECT

The event parameters to send to Google Analytics 4.

View Item List

Log this event when the user has been presented with a list of items of a certain category.

View Item List is a Web action. The default Trigger is: type = "track" and event = "Promotion Viewed"

Click to show / hide fields

Field Description
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.

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.

Event Parameters Type: OBJECT

The event parameters to send to Google Analytics 4.

Sign Up

The method used for sign up.

Sign Up is a Web action. The default Trigger is: type = "track" and event = "Signed Up"

Click to show / hide fields

Custom Event

Send any custom event

Custom Event is a Web action. The default Trigger is: type = "track"

Click to show / hide fields

Field Description
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 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.

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.

Event Parameters Type: OBJECT

The event parameters to send to Google Analytics 4.

Refund

This event signifies when one or more items is refunded to a user.

Refund is a Web action. The default Trigger is: type = "track" and event = "Order Refunded"

Click to show / hide fields

Field Description
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.

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

Total tax associated with the 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.

Event Parameters Type: OBJECT

The event parameters to send to Google Analytics 4.

Add Payment Info

Send event when a user submits their payment information

Add Payment Info is a Web action. The default Trigger is: type = "track" and event = "Payment Info Entered"

Click to show / hide fields

Field Description
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.

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.

Event Parameters Type: OBJECT

The event parameters to send to Google Analytics 4.

View Cart

This event signifies that a user viewed their cart.

View Cart is a Web action. The default Trigger is: type = "track" and event = "Cart Viewed"

Click to show / hide fields

Field Description
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.

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.

Event Parameters Type: OBJECT

The event parameters to send to Google Analytics 4.

Set Configuration Fields

Set custom values for the GA4 configuration fields.

Set Configuration Fields is a Web action. The default Trigger is: type = "identify" or type = "page"

Click to show / hide fields

Field Description
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.

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.

Ads Storage Consent State Type: STRING

Consent state indicated by the user for ad cookies. Value must be “granted” or “denied.” This is only used if the Enable Consent Mode setting is on.

Analytics Storage Consent State Type: STRING

Consent state indicated by the user for ad cookies. Value must be “granted” or “denied.” This is only used if the Enable Consent Mode setting is on.

Campaign Content Type: STRING

Use campaign content to differentiate ads or links that point to the same URL. Setting this value will override the utm_content query parameter.

Campaign ID Type: STRING

Use campaign ID to identify a specific campaign. Setting this value will override the utm_id query parameter.

Campaign Medium Type: STRING

Use campaign medium to identify a medium such as email or cost-per-click. Setting this value will override the utm_medium query parameter.

Campaign Name Type: STRING

Use campaign name to identify a specific product promotion or strategic campaign. Setting this value will override the utm_name query parameter.

Campaign Source Type: STRING

Use campaign source to identify a search engine, newsletter name, or other source. Setting this value will override the utm_source query parameter.

Campaign Term Type: STRING

Use campaign term to note the keywords for this ad. Setting this value will override the utm_term query parameter.

Content Group Type: STRING

Categorize pages and screens into custom buckets so you can see metrics for related groups of information. More information in Google documentation.

Language Type: STRING

The language preference of the user. If not set, defaults to the user’s navigator.language value.

Page Location Type: STRING

The full URL of the page. If not set, defaults to the user’s document.location value.

Page Referrer Type: STRING

The referral source that brought traffic to a page. This value is also used to compute the traffic source. The format of this value is a URL. If not set, defaults to the user’s document.referrer value.

Page Title Type: STRING

The title of the page or document. If not set, defaults to the user’s document.title value.

Screen Resolution Type: STRING

The resolution of the screen. Format should be two positive integers separated by an x (i.e. 800x600). If not set, calculated from the user’s window.screen value.

Purchase

This event signifies when one or more items is purchased by a user.

Purchase is a Web action. The default Trigger is: type = "track" and event = "Order Completed"

Click to show / hide fields

Field Description
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.

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.

Event Parameters Type: OBJECT

The event parameters to send to Google Analytics 4.

View Promotion

This event signifies a promotion was viewed from a list.

View Promotion is a Web action. The default Trigger is: type = "track"

Click to show / hide fields

Field Description
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.

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.

Event Parameters Type: OBJECT

The event parameters to send to Google Analytics 4.

Add to Wishlist

The event signifies that an item was added to a wishlist. Use this event to identify popular gift items in your app.

Add to Wishlist is a Web action. The default Trigger is: type = "track" and event = "Product Added to Wishlist"

Click to show / hide fields

Field Description
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.

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.

Event Parameters Type: OBJECT

The event parameters to send to Google Analytics 4.

Remove from Cart

This event signifies that an item was removed from a cart.

Remove from Cart is a Web action. The default Trigger is: type = "track" and event = "Product Removed"

Click to show / hide fields

Field Description
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.

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.

Event Parameters Type: OBJECT

The event parameters to send to Google Analytics 4.

Generate Lead

Log this event when a lead has been generated to understand the efficacy of your re-engagement campaigns.

Generate Lead is a Web action. The default Trigger is: type = "track"

Click to show / hide fields

Field Description
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.

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.

Event Parameters Type: OBJECT

The event parameters to send to Google Analytics 4.

Select Promotion

This event signifies a promotion was selected from a list.

Select Promotion is a Web action. The default Trigger is: type = "track" and event = "Promotion Clicked"

Click to show / hide fields

Field Description
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.

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.

Event Parameters Type: OBJECT

The event parameters to send to Google Analytics 4.

View Item

This event signifies that some content was shown to the user. Use this event to discover the most popular items viewed.

View Item is a Web action. The default Trigger is: type = "track" and event = "Product Viewed"

Click to show / hide fields

Field Description
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.

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.

Event Parameters Type: OBJECT

The event parameters to send to Google Analytics 4.

Begin Checkout

This event signifies that a user has begun a checkout.

Begin Checkout is a Web action. The default Trigger is: type = "track" and event = "Checkout Started"

Click to show / hide fields

Field Description
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.

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.

Event Parameters Type: OBJECT

The event parameters to send to Google Analytics 4.

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.

Login

Send event when a user logs in

Login is a Web action. The default Trigger is: type = "track" and event = "Signed In"

Click to show / hide fields

FAQ & 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 snake cased in Google Analytics 4.

Google Analytics 4 is also case sensitive. If you would like all event names to be lowercase, 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.

Custom Dimensions & Metrics

With Google Analytics 4, you must create custom dimensions and metrics within the Google Analytics 4 interface and link event parameters to the corresponding dimension or metric. When creating 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. For more information, see Google Analytics 4 Custom dimensions and metrics.

Debug Mode

The Google Analytics 4 debug mode is supported with the Google Analytics 4 Web destination. DebugView displays the events and user properties that Analytics collects from a user in real-time. This can be helpful in troubleshooting your implementation.

Additional (unmapped) events are sent to GA4

Google Analytics 4 collects events triggered by basic interactions with your site. For more information, see Google Analytics 4 Automatically collected events

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.

Data is not sent to Google

Ensure that at least one mapping has been configured and enabled in the destination mappings for an event you want to send to Google Analytics. If no mappings are enabled, the destination does not send events.

This page was last modified: 16 Mar 2023



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