I'm trying to add Enhance Ecommerce but something isn't okay. When I make an order through Google Tag Assistance everything is working and the transaction is showed on the Google Analytics but when I make an order normally like customer nothing is showed.
This is what I've added to thank-you page on the shop
<script type="text/javascript">
dataLayer.push({ ecommerce: null });
dataLayer.push({
'event': 'transaction',
'ecommerce': {
'purchase': {
'actionField': {
'id': '<?php echo $order->get_order_number() ?>',
'revenue': '<?php echo number_format($order->get_subtotal(), 2, ".", ""); ?>',
'number_of_products': '<?php echo $order->get_item_count(); ?>'
},
'products': [
<?php foreach ($order->get_items() as $key => $item): ?>
{
'name': '<?php echo $item['name']; ?>',
'id': '<?php echo $item['product_id']; ?>',
'price': '<?php echo number_format($item->get_total(), 2, ".", ""); ?>',
'quantity': '<?php echo $item['qty']; ?>'
},
<?php endforeach;
?>
]
}
}
});
</script>
And this is my setup in Google Tag Manager
Tried google, tried tutorials and still nothing helped.
When I run from Tag Assistant everything is go to analytic. When doesn't go through Tag Assistant nothing is showed.
Any ideas?
UPDATE: GTM Workspace preview






