rudder-sdk-js icon indicating copy to clipboard operation
rudder-sdk-js copied to clipboard

GA4 Ecommerce: allow custom dimension passthrough

Open pierreavizou opened this issue 2 years ago • 1 comments

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.

pierreavizou avatar May 04 '22 11:05 pierreavizou

Hi, thank you for bringing this to our notice. We will work on this and will try our best to unblock you.

shrouti1507 avatar May 04 '22 11:05 shrouti1507