Links

Google Analytics 4

Google Analytics 4 (GA4) is the latest iteration of Google's analytics tool that helps you measure the traffic and engagement across your websites and apps. Using this destination, you can enhance your existing tracking implementation to match your data collection needs with GA4. Your data will be sent server-side taking advantage of the Google Measurement Protocol API and in form of events.
Google designed the Measurement Protocol with some limitations, especially it does not allow to manage session. For session handling, you should currently setup a gtag config tag that will fire on the first page (only) of the user's session. For this purpose you can use on your website the tag template "gtag - Config with options" as it comes with the additional configuration option to send the Google reserved eventsession_startwhile avoid firing the eventpage_view:
gtag('config', 'G-XXXXXXXXXX', {
...
send_page_view: false
...
});

Key features

The Google Analytics 4 destination provides the following key features:
  • Events structure: our Events reference model fits Google's one, meaning that your data is properly bridged to the expected fields in an optimized way.
  • Prebuilt mappings: data mapping for event-based destinations happens automatically, which simplifies user inputs.
  • Refined data: you can freely push additional information based on your specific needs (E.g. adding custom events, custom event and user properties).
  • Support for multi-item data: information included in the item array is dispatched to GA4.
  • Send all properties option: send all your event properties to GA4 with a single click.

Destination setup

Before you get started with this destination, make sure you have a GA4 property in your Google Analytics account. You can find more information on this topic following these detailed articles:

Configuration

App related fields are enabled by flaggingEnable App Tracking.
The user identifier should be passed in both the client-side gtag and server-side. For more information, you can follow these links: [GA4] Measure activity across platforms with User-ID and [GA4] Reporting: deduplicate user counts.
When Google Signals is enabled, same device remarketing is supported. For cross-device remarketing, the user identifier is additionally required.
Settings
Description
Web API Secret
Required for Web Data Streams
An API Secret that is generated through the Google Analytics UI for a "Web Data Stream". To create this value, navigate in the Google Analytics interface following: AdminData Streams ➜ Choose your stream ➜ Measurement Protocol API secretCreate.
Measurement Id
Required for Web Data Streams
The Measurement Id for a "Web Data Stream". Found in the Google Analytics interface following: AdminData Streams ➜ Choose your stream ➜ Measurement Id. E.g. "G-XXXXXXXXXX".
Android API Secret
Required for App Android Data Streams
An API Secret that is generated through the Google Analytics UI for an "App Android Data Stream". To create this value, navigate in the Google Analytics interface following: AdminData Streams ➜ Choose your stream ➜ Measurement Protocol API secretsCreate. [1]
Android Firebase App ID
Required for App Android Data Streams
The Android Firebase App ID for a "App Android Data Stream". Found in the Google Analytics interface following: AdminData Streams ➜ Choose your stream ➜ FIREBASE APP ID, or in Firebase console following: Project SettingsGeneralYour AppsApp ID. [1]
iOS API Secret
Required for App iOS Data Streams
An API Secret that is generated through the Google Analytics UI for an "App Android Data Stream". To create this value, navigate in the Google Analytics interface following: AdminData Streams ➜ Choose your stream ➜ Measurement Protocol API secretsCreate. [1]
iOS Firebase App ID
Required for App iOS Data Streams
The iOS Firebase App ID for an "App iOS Data Stream". Found in the Google Analytics interface following: AdminData Streams ➜ Choose your stream ➜ FIREBASE APP ID, or in Firebase console following: Project SettingsGeneralYour AppsApp ID. [1]
App Instance ID Field
Your property field holding the App Instance Id for your "App Data Streams". If this is not provided, the first 32 characters of the following SHA256 hashed standard properties are used: device.sdk_id or user.tcId, in this order. [1]
Send All Properties
When activating this option all your custom properties are also sent to GA4 in the params object. Properties with child/sub properties are converted into a single one using the underscore character "_" as separator (E.g. device_lifecycle_last_session_start). More details are available following this LINK.
Custom Event Properties
Map your custom event properties by setting their field names in GA4 property name and adding the field name holding the value in Your event property. E.g. if you inputsizein the GA4 property name anditems.0.product.size [2] in Your event property, you will have a custom event property in GA4 calledsizewith a value based on the content of the fielditems.0.product.size. In the column Your event property path you should keep the default value Default (root) as it better fits most scenarios. In case you select either In "items" {items.X} or In "product" {items.X.product} this destination will look for the input event property starting from the items or product level respectively and add its values as a custom item property. To ensure that custom event properties are picked up by GA4, you must create event-scoped dimensions first. You can find more details by following this link: [GA4] Custom dimensions and metrics.
Custom User Properties
Map your custom user properties by setting their field names in User property name and adding the field name holding the value in Commanders Act event property or static value. E.g. if you inputcustomer_zipcodein User property name anduser.zipcode [2] in Commanders Act event property or static value, you will have a custom user property in GA4 calledcustomer_zipcodewith a value based on the content of the fielduser.zipcode. You also have the option to set a static string/numeric value in Commanders Act event property or static value.
To ensure that custom user properties are picked up by GA4, you must create user-scoped dimensions first. You can find more details by following this link: [GA4] Custom dimensions and metrics.
Client Id Cookie Name
Cookie name holding the Google Analytics Client Id that uniquely identifies a user instance of a web client. You can change its default value: "_ga". If this cookie is not found, user.consistent_anonymous_id is used.
The "Client Id" is the right most string in the cookie, including a single dot. E.g. see the following blue highlighted string "GA1.1.XXXXXXXXXX.XXXXXXXXXX".
Engagement Time in Milliseconds
GA4 reports only show active users who engage with your site for a non-zero amount of time. To ensure users are included in reports, you can keep the default value to 1. If you track the actual engagement time with your events, you can set the Engagement Time in Milliseconds with a proper value.
Enable debug mode
Under Debug View, you can flag this option to enable Debug Mode, sending the field "debug_mode" set to "true" on each event. It enables GA4 DebugView monitoring feature.
Send events for validation only
Send your events to the Measurement Protocol Validation Server to inspect properties through our Event Inspector. When this is flagged, events are not tracked by GA4.
[1] Field available after flagging theEnable App Trackingcheckbox. [2] Using "dots" (".") you can navigate deeper to the specific field you want to get the value of. See Events reference for more details on the standard field names by event. You can also freely set custom fields: there are no boundaries.

Session handling

When providing aMeasurement Id, the session identifier is retrieved from the cookie named _ga_<Measurement Id> (E.g. "_ga_SE92QCQ4Q1", without quotes and the initial string "G-"). If the cookie is not provided or with App "Data streams", the default property context.device.lifecycle.session_id is used. More details on how sessions work in Google Analytics 4 are available following this LINK.

Mappings for GA4 events

This destination provides automatic mapping between our Events reference model and GA4 events. In this section, you will learn what properties are set so you can expect to see those details in GA4 reporting.
More details on GA4 standard events are available following this LINK. To ensure that custom event properties are picked up by GA4, you must create event-scoped dimensions. You can find more details by following this link: [GA4] Custom dimensions and metrics.

add_payment_info

Property
Description
Field
Mapped with
Currency
Required Type: String Currency, in 3-letter ISO 4217 format.
currency
currency
Value
Required Type: Number The value of the event.
value
value
Coupon
Type: String Coupon code applied.
coupon
coupon
Payment Method
Type: String The payment method.
payment_type
payment_method
Revenue
Type: Number The revenue of the event.
revenue
revenue
Items
Required Type: Array The list of products of the event.
items
items

Items

Property
Description
Field
Mapped with
Item Id
Required Type: String The ID of the item.
item_id
items.X.id
Item Name
Required Type: String The name of the item.
item_name
items.X.product.name
Affiliation
Type: String A product affiliation to designate a supplying company or brick and mortar store location.
affiliation
items.X.product.affiliation
Coupon
Type: String The coupon name/code associated with the item.
coupon
items.X.coupon
Currency
Type: String Currency, in 3-letter ISO 4217 format.
currency
items.X.product.currency
Discount
Type: Number The monetary discount value associated with the item.
discount
items.X.discount
Index
Type: Number The index/position of the item in a list.
index
items.X.list_position
Item Brand
Type: String The brand of the item.
item_brand
items.X.product.brand
Item Category
Type: String The category of the item.
item_category
items.X.product.category_1
Item Category 2
Type: String The second category hierarchy or additional taxonomy for the item.
item_category2
items.X.product.category_2
Item Category 3
Type: String The third category hierarchy or additional taxonomy for the item.
item_category3
items.X.product.category_3
Item Category 4
Type: String The fourth category hierarchy or additional taxonomy for the item.
item_category4
items.X.product.category_4
Item Category 5
Type: String The fifth category hierarchy or additional taxonomy for the item.
item_category5
items.X.product.category_5
Item List Id
Type: String The ID of the list in which the item was presented to the user.
item_list_id
items.X.product.list_id
Item List Name
Type: String The name of the list in which the item was presented to the user.
item_list_name
items.X.product.list_name
Item Variant
Type: String The item variant or unique code or description for additional item details/options.
item_variant
items.X.variant
Location Id
Type: String The location associated with the item.
location_id
items.X.product.location_id
Price
Type: Number The monetary price of the item, in units of the specified currency parameter.
price
items.X.product.price
Quantity
Type: Number Item quantity.
quantity
items.X.quantity

add_shipping_info

Property
Description
Field
Mapped with
Currency
Required Type: String Currency, in 3-letter ISO 4217 format.
currency
currency
Value
Required Type: Number The value of the event.
value
value
Coupon
Type: String Coupon code applied.
coupon
coupon
Shipping Tier
Type: String The shipping tier (E.g. Next-day) selected for delivery of the item.
shipping_tier
shipping_tier
Items
Required Type: Array The list of products of the event.
items
items

Items

Property
Description
Field
Mapped with
Item Id
Required
Type: String The ID of the item.
item_id
items.X.id
Item Name
Required
Type: String The name of the item.
item_name
items.X.product.name
Affiliation
Type: String A product affiliation to designate a supplying company or brick and mortar store location.
affiliation
items.X.product.affiliation
Coupon
Type: String The coupon name/code associated with the item.
coupon
items.X.coupon
Currency
Type: String Currency, in 3-letter ISO 4217 format.
currency
items.X.product.currency
Discount
Type: Number The monetary discount value associated with the item.
discount
items.X.discount
Index
Type: Number The index/position of the item in a list.
index
items.X.list_position
Item Brand
Type: String The brand of the item.
item_brand
items.X.product.brand
Item Category
Type: String The category of the item.
item_category
items.X.product.category_1
Item Category 2
Type: String The second category hierarchy or additional taxonomy for the item.
item_category2
items.X.product.category_2
Item Category 3
Type: String The third category hierarchy or additional taxonomy for the item.
item_category3
items.X.product.category_3
Item Category 4
Type: String The fourth category hierarchy or additional taxonomy for the item.
item_category4
items.X.product.category_4
Item Category 5
Type: String The fifth category hierarchy or additional taxonomy for the item.
item_category5
items.X.product.category_5
Item List Id
Type: String The ID of the list in which the item was presented to the user.
item_list_id
items.X.product.list_id
Item List Name
Type: String The name of the list in which the item was presented to the user.
item_list_name
items.X.product.list_name
Item Variant
Type: String The item variant or unique code or description for additional item details/options.
item_variant
items.X.variant
Location Id
Type: String The location associated with the item.
location_id
items.X.product.location_id
Price
Type: Number The monetary price of the item, in units of the specified currency parameter.
price
items.X.product.price
Quantity
Type: Number Item quantity.
quantity
items.X.quantity

add_to_cart

Property
Description
Field
Mapped with
Currency
Required Type: String Currency, in 3-letter ISO 4217 format.
currency
currency
Value
Required Type: Number The value of the event.
value
value
Items
Required Type: Array The list of products of the event.
items
items

Items

Property
Description
Field
Mapped with
Item Id
Required Type: String The ID of the item.
item_id
items.X.id
Item Name
Required Type: String The name of the item.
item_name
items.X.product.name
Affiliation
Type: String A product affiliation to designate a supplying company or brick and mortar store location.
affiliation
items.X.product.affiliation
Coupon
Type: String The coupon name/code associated with the item.
coupon
items.X.coupon
Currency
Type: String Currency, in 3-letter ISO 4217 format.
currency
items.X.product.currency
Discount
Type: Number The monetary discount value associated with the item.
discount
items.X.discount
Index
Type: Number The index/position of the item in a list.
index
items.X.list_position
Item Brand
Type: String The brand of the item.
item_brand
items.X.product.brand
Item Category
Type: String The category of the item.
item_category
items.X.product.category_1
Item Category 2
Type: String The second category hierarchy or additional taxonomy for the item.
item_category2
items.X.product.category_2
Item Category 3
Type: String The third category hierarchy or additional taxonomy for the item.
item_category3
items.X.product.category_3
Item Category 4
Type: String The fourth category hierarchy or additional taxonomy for the item.
item_category4
items.X.product.category_4
Item Category 5
Type: String The fifth category hierarchy or additional taxonomy for the item.
item_category5
items.X.product.category_5
Item List Id
Type: String The ID of the list in which the item was presented to the user.
item_list_id
items.X.product.list_id
Item List Name
Type: String The name of the list in which the item was presented to the user.
item_list_name
items.X.product.list_name
Item Variant
Type: String The item variant or unique code or description for additional item details/options.
item_variant
items.X.variant
Location Id
Type: String The location associated with the item.
location_id
items.X.product.location_id
Price
Type: Number The monetary price of the item, in units of the specified currency parameter.
price
items.X.product.price
Quantity
Type: Number Item quantity.
quantity
items.X.quantity

add_to_wishlist

Property
Description
Field
Mapped with
Currency
Required Type: String Currency, in 3-letter ISO 4217 format.
currency
currency
Value
Required Type: Number The value of the event.
value
value
Items
Required Type: Array The list of products of the event.
items
items

Items

Property
Description
Field
Mapped with
Item Id
Required Type: String The ID of the item.
item_id
items.X.id
Item Name
Required Type: String The name of the item.
item_name
items.X.product.name
Affiliation
Type: String A product affiliation to designate a supplying company or brick and mortar store location.
affiliation
items.X.product.affiliation
Coupon
Type: String The coupon name/code associated with the item.
coupon
items.X.coupon
Currency
Type: String Currency, in 3-letter ISO 4217 format.
currency
items.X.product.currency
Discount
Type: Number The monetary discount value associated with the item.
discount
items.X.discount
Index
Type: Number The index/position of the item in a list.
index
items.X.list_position
Item Brand
Type: String The brand of the item.
item_brand
items.X.product.brand
Item Category
Type: String The category of the item.
item_category
items.X.product.category_1
Item Category 2
Type: String The second category hierarchy or additional taxonomy for the item.
item_category2
items.X.product.category_2
Item Category 3
Type: String The third category hierarchy or additional taxonomy for the item.
item_category3
items.X.product.category_3
Item Category 4
Type: String The fourth category hierarchy or additional taxonomy for the item.
item_category4
items.X.product.category_4
Item Category 5
Type: String The fifth category hierarchy or additional taxonomy for the item.
item_category5
items.X.product.category_5
Item List Id
Type: String The ID of the list in which the item was presented to the user.
item_list_id
items.X.product.list_id
Item List Name
Type: String The name of the list in which the item was presented to the user.
item_list_name
items.X.product.list_name
Item Variant
Type: String The item variant or unique code or description for additional item details/options.
item_variant
items.X.variant
Location Id
Type: String The location associated with the item.
location_id
items.X.product.location_id
Price
Type: Number The monetary price of the item, in units of the specified currency parameter.
price
items.X.product.price
Quantity
Type: Number Item quantity.
quantity
items.X.quantity

begin_checkout

Property
Description
Field
Mapped with
Currency
Required Type: String Currency, in 3-letter ISO 4217 format.
currency
currency
Value
Required Type: Number The value of the event.
value
value
Coupon
Type: String Coupon code applied.
coupon
coupon
Revenue
Type: Number The revenue of the event.
revenue
revenue
Items
Required Type: Array The list of products of the event.
items
items

Items

Property
Description
Field
Mapped with
Item Id
Required Type: String The ID of the item.
item_id
items.X.id
Item Name
Required Type: String The name of the item.
item_name
items.X.product.name
Affiliation
Type: String A product affiliation to designate a supplying company or brick and mortar store location.
affiliation
items.X.product.affiliation
Coupon
Type: String The coupon name/code associated with the item.
coupon
items.X.coupon
Currency
Type: String Currency, in 3-letter ISO 4217 format.
currency
items.X.product.currency
Discount
Type: Number The monetary discount value associated with the item.
discount
items.X.discount
Index
Type: Number The index/position of the item in a list.
index
items.X.list_position
Item Brand
Type: String The brand of the item.
item_brand
items.X.product.brand
Item Category
Type: String The category of the item.
item_category
items.X.product.category_1
Item Category 2
Type: String The second category hierarchy or additional taxonomy for the item.
item_category2
items.X.product.category_2
Item Category 3
Type: String The third category hierarchy or additional taxonomy for the item.
item_category3
items.X.product.category_3
Item Category 4
Type: String The fourth category hierarchy or additional taxonomy for the item.
item_category4
items.X.product.category_4
Item Category 5
Type: String The fifth category hierarchy or additional taxonomy for the item.
item_category5
items.X.product.category_5
Item List Id
Type: String The ID of the list in which the item was presented to the user.
item_list_id
items.X.product.list_id
Item List Name