Google Analytics 4 cloud mode
Send events to Google Analytics 4 using RudderStack cloud mode.
RudderStack lets you send your event data to Google Analytics 4 via cloud mode by leveraging the Google Analytics 4 Measurement Protocol.

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.
Refer to the Google Analytics 4 Measurement Protocol guide for more information.
The mappings for the above-mentioned mandatory parameters are listed in the following table:
Parameters | Mapping value |
---|
client_id | Refer to the Mapping client_id section. |
app_instance_id | from externalID ga4AppInstanceId |
Refer to the FAQ section for more information on how to obtain the app_instance_id
.
Mapping client_id
RudderStack maps client_id
from the following fields in the same priority order as listed below:
- From
externalID
: ga4ClientId
- From
anonymousId
- From
rudderId
Supported mappings
The following table lists the mappings for the gtag
and firebase
parameters:
Parameters | Mapping | Description |
---|
user_id | userId traits.userId traits.id context.traits.userId context.traits.id | 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.
Track
The track
call lets you capture user events along with the properties associated with them.
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:
RudderStack property | Google Analytics 4 property | Default value |
---|
traits.method properties.method | method | - |
traits.engagementTimeMsec properties.engagementTimeMsec context.traits.engagementTimeMsec traits.engagement_time_msec properties.engagement_time_msec context.traits.engagement_time_msec | engagement_time_msec | 1 |
The following table lists the property mappings between RudderStack and Google Analytics 4 for generate_lead
event:
RudderStack property | Google Analytics 4 property | Default value |
---|
properties.currency | currency | USD |
properties.total properties.price properties.value properties.revenue Required | value | - |
traits.engagementTimeMsec properties.engagementTimeMsec context.traits.engagementTimeMsec traits.engagement_time_msec properties.engagement_time_msec context.traits.engagement_time_msec | engagement_time_msec | 1 |
Page
The page
call lets you record your website’s page views with any additional relevant information about the viewed page.
RudderStack maps the page
call to a page_view
event by default, and passes it to Google Analytics 4 as a custom event.
As mentioned in the track
section, the RudderStack cloud mode supports both the gtag
and firebase
methods for tagging in websites.
A sample page
call using gtag
is shown below:
A sample page
call using firebase
is shown below:
rudderanalytics.page({}, {
externalId: [{
type: "ga4AppInstanceId",
id: "f0dd99b6f979fb551ce583373900f937"
}],
});
Supported mappings
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.
A sample group
call using gtag
is shown below:
rudderanalytics.group("1hKOmRA4", {
"custom1": 1234,
"custom2": "custom2"
});
A sample group
call using firebase
is shown below:
rudderanalytics.group("1hKOmRA4", {
"custom1": 1234,
"custom2": "custom2"
}, {
externalId: [{
type: "ga4AppInstanceId",
id: "f0dd99b6f979fb551ce583373900f937"
}],
});
Ecommerce event tracking
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.
The following table lists the mappings between the RudderStack and Google Analytics 4 events:
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 |
The following table lists the RudderStack and Google Analytics 4 properties mappings based on the 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) | value |
Order Completed Order Refunded | properties.currency
properties.order_id Required
properties.coupon
properties.shipping
properties.tax | currency
transaction_id
coupon
shipping
tax |
properties.total
properties.value
properties.revenue Required (one of the above) | value |
Product Shared | properties.share_via
properties.content_type | method
content_type |
properties.item_id
properties.product_id
properties.sku | item_id |
Cart Shared | properties.share_via
properties.content_type | method
content_type |
properties.item_id
properties.cart_id | item_id |
Group | groupId | group_id |
Payment Info Entered | properties.currency
properties.coupon
properties.payment_method | currency
coupon
payment_type |
properties.total
properties.value
properties.revenue Required (one of the above) | value |
Checkout Step Completed | properties.currency | currency |
properties.total
properties.value
properties.revenue Required (one of the above) | value |
properties.coupon | coupon |
properties.shipping_method | shipping_tier |

The default unit for currency
property is USD.
Out of the above mentioned events, the below ones include the products
parameter (mapped to the items
parameter) which accepts a products
array:
The below table details the common mappings for the products
array:
RudderStack | Google Analytics 4 |
---|
properties.products.$.product_id Required, if name is not present. | item_id |
properties.products.$.name Required, if product_id is not present. | item_name |
properties.products.$.coupon | coupon |
properties.products.$.price | price |
properties.products.$.position | index |
properties.products.$.category | item_category |
properties.products.$.brand | item_brand |
properties.products.$.variant | item_variant |
properties.products.$.quantity | quantity |
properties.products.$.affiliation | affiliation |
properties.products.$.currency | currency |
properties.products.$.discount | discount |
properties.products.$.item_category2 | item_category2 |
properties.products.$.item_category3 | item_category3 |
properties.products.$.item_category4 | item_category4 |
properties.products.$.item_category5 | item_category5 |
properties.products.$.item_list_id | item_list_id |
properties.products.$.item_list_name | item_list_name |
properties.products.$.location_id | location_id |
The following table lists the property mappings of the products
array, specifically for the Promotion Viewed and Promotion Clicked events:
RudderStack | Google Analytics 4 |
---|
properties.products.$.creative_name | creative_name |
properties.products.$.creative_slot | creative_slot |
properties.products.$.promotion_id | promotion_id |
properties.products.$.promotion_name | promotion_name |
The root-level properties of ecommerce events which do not include a products
array are mapped to the following GA4 items
array:
RudderStack | Google Analytics 4 |
---|
properties.product_id Required, if name is not present. | item_id |
properties.name Required, if product_id is not present. | item_name |
properties.coupon | coupon |
properties.category | item_category |
properties.brand | item_brand |
properties.variant | item_variant |
properties.price | price |
properties.quantity | quantity |
properties.position | index |
properties.affiliation | affiliation |
properties.currency | currency |
properties.discount | discount |
properties.item_category2 | item_category2 |
properties.item_category3 | item_category3 |
properties.item_category4 | item_category4 |
properties.item_category5 | item_category5 |
properties.item_list_id | item_list_id |
properties.item_list_name | item_list_name |
properties.location_id | location_id |
Payment Info Entered
The Payment Info Entered event must include the products
array apart from the common properties, as shown:
rudderanalytics.track(
"Payment Info Entered", {
currency: "USD",
value: "7.77",
coupon: "SUMMER_FUN",
payment_method: "Credit Card",
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",
}, ],
}
);
The Promotion Viewed event must include the products
array apart from the common properties, as shown:
rudderanalytics.track(
"Promotion Viewed", {
creative: "Summer Banner",
position: "featured_app_1",
promotion_id: "P_12345",
name: "Summer Sale",
products: [{
product_id: "507f1f77bcf86cd799439011",
name: "Monopoly: 3rd Edition",
coupon: "SUMMER_FUN",
category: "Apparel",
brand: "Google",
variant: "green",
price: "19",
quantity: "2",
position: "0",
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",
promotion_id: "P_12345",
promotion_name: "Summer Sale",
creative_name: "summer_banner2",
creative_slot: "featured_app_1",
}, ],
}, {
externalId: [{
type: "ga4ClientId",
id: "client_id",
}, ],
}
);
The Promotion Clicked event can include the products
array optionally, apart from the common properties, as shown:
rudderanalytics.track(
"Promotion Clicked", {
creative: "Summer Banner",
position: "featured_app_1",
promotion_id: "P_12345",
name: "Summer Sale",
products: [{
product_id: "507f1f77bcf86cd799439011",
name: "Monopoly: 3rd Edition",
coupon: "SUMMER_FUN",
category: "Apparel",
brand: "Google",
variant: "green",
price: "19",
quantity: "2",
position: "0",
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",
promotion_id: "P_12345",
promotion_name: "Summer Sale",
creative_name: "summer_banner2",
creative_slot: "featured_app_1",
}, ],
}, {
externalId: [{
type: "ga4ClientId",
id: "client_id",
}, ],
}
);
Checkout Step Completed
The Checkout Step Completed event must include the products
array apart from the common properties, as shown:
rudderanalytics.track(
"Checkout Step Completed", {
currency: "USD",
value: "7.77",
coupon: "SUMMER_FUN",
shipping_method: "Ground",
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",
}, ],
}
);
Non ecommerce events tracking
The below table lists the mappings of the non ecommerce track
events and properties that are passed to Google Analytics 4 events and properties:
Event Mapping | Property Mapping |
---|
RudderStack | Google Analytics 4 | RudderStack | Google Analytics 4 |
---|
generate_lead | generate_lead | properties.${currency}
properties.${value} | currency
value |
login | login | properties.${method} | method |
sign_up | sign_up | properties.${method} | method |
view_search_results | view_search_results | properties.search_term | search_term |

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.
Rules for naming custom events
You must follow the below rules while choosing a name for the custom events:
- 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.
- Do not use reserved prefixes and event names. Refer to the FAQ section to learn more about the reserved event names and prefixes.
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:
RudderStack properties | Google Analytics 4 property |
---|
traits.engagementTimeMsec
context.traits.engagementTimeMsec
traits.engagement_time_msec
context.traits.engagement_time_msec | engagement_time_msec |
You can use the Google Analytics 4 session_id
parameter to identify the session associated with a particular event.
RudderStack maps the following session properties for the group
call:
RudderStack properties | Google Analytics 4 property |
---|
traits.sessionId
context.traits.sessionId
traits.session_id
context.traits.session_id
context.sessionId | session_id |
RudderStack maps the following session properties for the track
and page
calls:
RudderStack properties | Google Analytics 4 property |
---|
properties.sessionId
properties.session_id
context.sessionId | session_id |

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.

For more information on the optional reporting parameters in Google Analytics 4, refer to their
documentation.
Hybrid mode
Hybrid mode sends your event data to Google Analytics 4 via both the native SDK (device mode) and the Google Analytics 4 Measurement Protocol (cloud mode). See Hybrid mode to learn more.
FAQ
I’ve set up GA4 as a destination in RudderStack but I’m not seeing the expected data flow through in the GA4 dashboard. What should I do?
To view the events sent to GA4, go to your Google Analytics dashboard and navigate to Reports > Realtime.
While the events typically show up within a few seconds, note that it can take GA4 up to 24 hours to process their data and appear on other reports. Also, not all types of data flow through to its realtime dashboard. It may be best to consult GA4’s FAQs for the most up-to-date information on its latest capabilities and limitations.

For more information on checking the realtime view or verifying your implementation, refer to this
GA4 documentation. You can also refer to this
Troubleshooting guide for steps on fixing any implementation errors.
What are the reserved prefixes in Google Analytics 4?
The reserved prefixes in Google Analytics 4 cannot be used for custom events. The list of such prefixes is mentioned below:
- _ (underscore)
- firebase_
- ga_
- google_
- gtag.
Refer to the GA4 documentation for more information.
What are the 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. Refer to the Measurement Protocol (Google Analytics 4) guide for a complete list of reserved names.
How do I obtain app_instance_id
?
You can retrieve app_instance_id
through the Firebase SDK depending on the platform where the SDK is installed:
Refer to the GA4 documentation for more information.
Questions? Contact us by email or on
Slack