Hi all,
I would like to set up Amplitude and migrate from GA4 to Amplitude. One of our prerequisites would be that Amplitude supports the GA4 datalayer for e-commerce events. As far as I have seen the datalayer is not supported, is this correct?
Our shop automatically pushes a datalayer object once an action has been triggered by the user. For example, a view_item event when a product detail page is viewed.
dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object.
dataLayer.push({
event: "view_item",
ecommerce: {
currency: "USD",
value: 7.77,
items: [
{
item_id: "SKU_12345",
item_name: "Stan and Friends Tee",
affiliation: "Google Merchandise Store",
coupon: "SUMMER_FUN",
discount: 2.22,
index: 0,
item_brand: "Google",
item_category: "Apparel",
item_category2: "Adult",
item_category3: "Shirts",
item_category4: "Crew",
item_category5: "Short sleeve",
item_list_id: "related_products",
item_list_name: "Related Products",
item_variant: "green",
location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
price: 9.99,
quantity: 1
}
]
}
});
In other GTM templates, the datalayer is supported so we can use a datalayer variable to retreive data like this “ecommerce.currency (for the currency), ecommerce.value (to get the price) and ecommerce.items (to get the item scoped dimensions).
How can I pass that information to Amplitude? If it is only one product I can easily use a datalayer variable to pass information like that ecommerce.items.0.item_id but we also have events like view_cart where we have multiple items to capture.