Google Analytics 4 does not officially support a complete server-to-server integration. RudderStack utilizes the GA4 Measurement Protocol API for cloud mode integration, which does not currently allow ingestion of UTM parameters for attribution reporting. This may significantly limit your ability to use certain GA4 reporting features. Refer to the Google’s documentation for more information on these limitations.
For capturing a fuller, more robust set of attribution data while using Measurement Protocol, RudderStack suggests referencing and setting up a hybrid mode connection.
Find the open source transformer code for this destination in the GitHub repository.
Tagging methods
RudderStack supports both the gtag and firebase ways for tagging in websites in cloud mode. However, note that:
If you use gtag, passing the client_id parameter is mandatory.
If you use firebase, passing the app_instance_id parameter is mandatory.
RudderStack maps client_id from the following fields in the same priority order as listed below:
From externalID: ga4ClientId
From anonymousId
From rudderId
externalId
You can use externalID to send a custom client_id that is external to RudderStack.
There are certain scenarios where you may want to send a custom client_id. For example, if you maintain a user with a certain identifier, then you may prefer to pass it as the custom client_id as a part of externalId:
Unique identifier for a user which helps Google Analytics 4 know if two devices/browsers belong to the same user.
timestamp_micros
originalTimestamp timestamp
Timestamp in ISO 8601 format.
non_personalized_ads
context.device.adTrackingEnabled
Indicates whether the events should be used for personalized ads. If context.device.adTrackingEnabled is set as true, non_personalised_ads will be set to false.
Google Analytics 4 Measurement Protocol only supports timestamps 72 hours into the past and 15 minutes into the future. RudderStack discards any event with a timestamp out of this range.
The track call lets you capture user events along with the properties associated with them.
You can use a track call to send any event to Google Analytics 4. However, RudderStack recommends using the page call to record page-related information for your website specifically.
You can send all the events mentioned in GA4 documentation as track events.
A sample track call using gtag is shown below:
rudderanalytics.track('Product List Viewed',{list_id:"related_products",category:"Related_products",products:[{product_id:"507f1f77bcf86cd799439011",name:"Monopoly: 3rd Edition",coupon:"SUMMER_FUN",category:"Apparel",brand:"Google",variant:"green",price:"19",quantity:"2",position:"1",affiliation:"Google Merchandise Store",currency:"USD",discount:2.22,item_category2:"Adult",item_category3:"Shirts",item_category4:"Crew",item_category5:"Short sleeve",item_list_id:"related_products",item_list_name:"Related Products",location_id:"L_12345"}]},{externalId:[{type:"ga4ClientId",id:"client_id"}],});
A sample track call using firebase is shown below:
rudderanalytics.track('Product List Viewed',{list_id:"related_products",category:"Related_products",products:[{product_id:"507f1f77bcf86cd799439011",name:"Monopoly: 3rd Edition",coupon:"SUMMER_FUN",category:"Apparel",brand:"Google",variant:"green",price:"19",quantity:"2",position:"1",affiliation:"Google Merchandise Store",currency:"USD",discount:2.22,item_category2:"Adult",item_category3:"Shirts",item_category4:"Crew",item_category5:"Short sleeve",item_list_id:"related_products",item_list_name:"Related Products",location_id:"L_12345"}]},{externalId:[{type:"ga4AppInstanceId",id:"f0dd99b6f979fb551ce583373900f937"}],});
Supported mappings
The following table lists the property mappings between RudderStack and Google Analytics 4 for login and sign_up events:
The following table lists the property mappings between RudderStack and Google Analytics 4:
RudderStack property
Google Analytics 4 property
context.page.referrer
page_referrer
context.page.title
page_title
context.page.url
page_location
Group
The group call lets you link an identified user with a group such as a company, organization, or an account, and record any traits associated with that group, for example, company name, number of employees, etc.
RudderStack maps the group call to the join_group event by default.
RudderStack supports ecommerce tracking for Google Analytics 4. You can refer to the Ecommerce Events Specification for sending events while instrumenting your site with the RudderStack SDK.
Supported mappings
Event mappings
RudderStack event
Google Analytics 4 event
Products Searched
search
Product List Viewed
view_item_list
Product Clicked
select_item
Promotion Viewed
view_promotion
Promotion Clicked
select_promotion
Product Viewed
view_item
Product Added
add_to_cart
Product Removed
remove_from_cart
Cart Viewed
view_cart
Product Added to Wishlist
add_to_wishlist
Checkout Started
begin_checkout
Order Completed
purchase
Order Refunded
refund
Product Shared
share
Cart Shared
share
Payment Info Entered
add_payment_info
Checkout Step Completed
add_shipping_info
Property mappings based on specific RudderStack events
RudderStack event
RudderStack property
Google Analytics 4 property
Products Searched
properties.query Required
search_term
Product List Viewed Product Clicked
properties.list_id properties.category
item_list_id item_list_name
Promotion Viewed Promotion Clicked
properties.creative_name properties.creative
creative_name
properties.creative_slot properties.position
creative_slot
properties.promotion_name properties.name
promotion_name
properties.promotion_id
promotion_id
Product Viewed Product Added to Wishlist
properties.currency
currency
properties.total properties.price properties.value properties.revenue Required (one of the above)
value
Product Added Product Removed
properties.currency
currency
properties.total properties.value properties.revenue (properties.price) X (properties.quantity) Required (one of the above)
value
Cart Viewed
properties.currency
currency
properties.total properties.value properties.revenue Required (one of the above)
value
Checkout Started
properties.currency properties.coupon
currency coupon
properties.total properties.value properties.revenue Required (one of the above)
You can pass the custom user properties to any of the events by passing them as properties.user_properties or context.traits. Refer to the Google Analytics 4 documentation for more information.
Custom events
You can use custom events to collect additional information that Google Analytics 4 does not collect automatically.
Follow the below rules while choosing a name for the custom events and parameters:
Event names are case-sensitive. For example, my_event and My_Event are two distinct events.
Event names must start with a letter. Only letters, numbers, and underscores are permitted. Do not use spaces.
Before sending events to Google Analytics 4, you must create custom dimensions and metrics in your GA4 dashboard and link them to the event properties/parameters.
You can select a parameter from the list of already collected properties or specify the parameter you plan to collect in the future. RudderStack supports sending user properties via properties.user_properties and context.traits.
Note that:
Custom dimensions can be either event-scoped or user-scoped. However, custom metrics must be event-scoped.
Each user property should either be of a number, string, or Boolean data type. This is because GA4 accepts only flat key-value pairs as user properties.
RudderStack drops any user property that is either an object or an array.
Tracking active users and sessions
As Google Analytics 4 only reports the users who engage with your website for a non-zero time, RudderStack sets the engagement_time_msec parameter to 1, by default. To track engagement time in your events, you can set the engagement_time_msec field to a different value.
RudderStack maps the following properties to GA4’s engagement_time_msec property:
You can use the Google Analytics 4 session_id parameter to identify the session associated with a particular event.
To know more about sessions in Google Analytics 4, see Google Analytics 4 help article.
RudderStack maps the following session properties for the group call:
RudderStack automatically collects engagement_time_msec and session_id when sending events via device mode. However, they must be manually passed while sending events via cloud mode.
Server-side session tracking supports only a subset of user dimensions. Google’s Measurement Protocol API does not support the reserved fields like location, demographics, predefined user dimensions, and device-specific information.
To verify if your events are sent to GA4 successfully, go to Reports > Realtime in your Google Analytics dashboard or check Debug View (only available in device mode). For more information, see GA4 documentation for more information.
It can take up to 24 hours for the data to be processed in GA4 and appear in the other reports.
Events not showing in GA4
If your events do not show up in GA4’s Realtime view, there could be issues with your implementation. See GA4 documentation for more information on verifying your implementation or checking the realtime view.
You can also see the GA4 Troubleshooting guide for steps on identifying and fixing any possible implementation issues.
Also, make sure you are not using a reserved name for your events. This is a common reason for events not showing up in GA4. See FAQ for more information on reserved event names.
Not all types of data flow through to GA4’s Realtime dashboard. For example, the Measurement Protocol does not support geolocation data and it does not show up in the Realtime dashboard (except for page calls sent via hybrid mode).
FAQ
What does the (not set) value mean in reports?
If you see (not set) value in your reports, see GA4 documentation to diagnose the cause first.
RudderStack utilizes the GA4 Measurement Protocol API for cloud mode integration. It does not support ingestion of UTM parameters for attribution reporting currently.
Some other probable reasons could be:
Reserved event, parameter, and user property names in Google Analytics 4 Google Analytics 4 has some reserved event, parameter, and user property names that cannot be used. If passed, they are dropped silently. See Measurement Protocol (Google Analytics 4) for a complete list of reserved names. Also, note that Google does not accept any event/user property names that include spaces or fields that include null values.
DebugView DebugView is only supported in the device mode and is enabled automatically when you set up a device mode GA4 connection. For cloud mode connections, RudderStack sends the events to the validation server and they do not show up in reports.
Validating events The Google Analytics Measurement Protocol for Google Analytics 4 does not return HTTP error codes, even if an event is malformed or missing required parameters. To ensure your events are valid, you should test them against the Measurement Protocol Validation Server before deploying them to production. See Validating events for more information.
Why am I seeing inaccurate transaction_id values in my Google Analytics reports?
Make sure to pass transaction_id as an alphanumeric value. Otherwise, it may not reflect accurately in your reports.
This site uses cookies to improve your experience while you navigate through the website. Out of
these
cookies, the cookies that are categorized as necessary are stored on your browser as they are as
essential
for the working of basic functionalities of the website. We also use third-party cookies that
help
us
analyze and understand how you use this website. These cookies will be stored in your browser
only
with
your
consent. You also have the option to opt-out of these cookies. But opting out of some of these
cookies
may
have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This
category only includes cookies that ensures basic functionalities and security
features of the website. These cookies do not store any personal information.
This site uses cookies to improve your experience. If you want to
learn more about cookies and why we use them, visit our cookie
policy. We'll assume you're ok with this, but you can opt-out if you wish Cookie Settings.