The dataLayer i’m seeing on the thank you page after purchase is as follow:
var queryString = window.location.search;
var urlParams = new URLSearchParams(queryString);
var orderId= urlParams.get(‘orderId’);
window.dataLayer = window.dataLayer || ;
dataLayer.push({
‘transactionId’: orderId,
‘transactionTotal’: 275.00,
‘transactionProducts’: [{
‘sku’: ‘26457’,
‘name’: ‘PBR For LIFE Original’,
‘price’: 275.00,
‘quantity’: 1
}],
‘event’: ‘purchase’
});
I’m sending this dataLayer to my google analytics 4 it shows the purchase but not showing prices, values and other parameters in monetization e-commerce purchase so I think the dataLayer is not correct which is I’m receiving on the frontend of the thank you page. Please provide me with the solution.