rudder-sdk-js
rudder-sdk-js copied to clipboard
GA4 Ecommerce: allow custom dimension passthrough
GA4 allows passing arbitrary custom dimensions to events, including ecommerce events. Currently, the Rudder JS SDK enforces the Rudder ecommerce spec, and removes any custom property passed in a track()
call for ecommerce events. So the GA4 destination will never receive your custom properties.
Enforcing strictly the Rudder spec is probably not necessary for destinations such as GA4 that allow the user to pass arbitrary properties.
In the call below, myCustomProp
gets deleted. Rather, it should be kept as the others properties and forwarded to GA4.
rudderanalytics.track("Order Completed", {
checkout_id: "12345",
order_id: "1234",
myCustomProp: 'My arbitray value', // Nevers gets forwarded to GA4
affiliation: "Apple Store",
total: 20,
revenue: 15.0,
shipping: 22,
tax: 1,
discount: 1.5,
coupon: "ImagePro",
currency: "USD",
products: [
{
product_id: "123",
sku: "G-32",
name: "Monopoly",
price: 14,
quantity: 1,
category: "Games",
item_category2: 'Board games', // Not forwarded either
url: "https://www.website.com/product/path",
image_url: "https://www.website.com/product/path.jpg",
},
],
})
This could also apply to product-related properties, so that we can populate GA4-specific ecommerce fields, such as item_category2
, item_category3
etc, that are not (yet?) defined in the Rudder Ecommerce specification.
Hi, thank you for bringing this to our notice. We will work on this and will try our best to unblock you.