I'm implementing datalayer event pushes to the ecommerce I work, but I don't understand why or from where it is firing extra events.
Example:
I'm firing 'checkout' events on every step of the checkout with the following code:
export const pushCheckout = (devices: [any], step: any) => {
console.log('got in');
window.dataLayer.push({
event: 'checkout',
ecommerce: {
currencyCode: 'USD',
checkout: {
actionField: {
step: step.number,
option: step.name,
}
},
products: devices.map((device) => transformDetailedProductToFitDataLayerRequirements(device))
}
});
}
It works as expected, printing "got in" only once per step, but when I access the dataLayer object on console, I can see more 'checkout' events then the expected, but without my products and without the ecommerce.checkout.option field, even though that's not possible to happen in my code.
Is there something I'm missing in terms of how the data layer works? Is gtm adding this info by their side?