Ooops, it is hard to tell my wife who just walks through in the background that I am just working while browsing your site 😀
Could you give me a coupon code so that I only need to pay $1 or some cents on the site to test the order received page?
Yes I know 🙂
It would be possible to send the final urls privately by mail or somthing, so as not to publish so much data?
Thank you
Hi,
WP.org forum rules does not allow me to ask or accept and private information, I would risk to being closed 🙁
Okay, let’s find another way then.
I’m looking at it with my programmer and it may be due to the return of the payment gateway.
So, if apart from the plugin (which already measures everything else except the transaction), we put gtm4wp.orderCompletedEEC into the datalayer of the order-received page, and this:
gtm4wp.productClickEEC|gtm4wp.addProductToCartEEC|gtm4wp.removeFromCartEEC|gtm4wp.checkoutOptionEEC|gtm4wp.checkoutStepEEC|gtm4wp.changeDetailViewEEC|gtm4wp.orderCompletedEEC
Into the Tag Manager custom event trigger. Do you think it can work?
Thank you very much for your help
It is worth noting you may not see all transactions within analytics due to cookie blocking etc.
@jordi-mont it could work but you need to include the data layer content for the whole purchase action as well:
https://developers.google.com/tag-manager/enhanced-ecommerce#purchases
FYI
It worked for me @jordi-mont. Analytics shows the transaction correctly.
I put in the woocommerce thankyou.php page this code:
<script>
dataLayer.push({
‘event’: ‘gtm4wp.orderCompletedEEC’,
‘ecommerce’: {
‘purchase’: {
‘actionField’: {
‘id’: ‘<?php echo $order->get_order_number(); ?>’, // Transaction ID. Required
‘revenue’: ‘<?php echo number_format($order->get_subtotal(), 2, “.”, “”); ?>’, // Total transaction value (incl. tax and shipping)
},
‘products’: [
<?php foreach($order->get_items() as $key=>$item):
$product = $order->get_product_from_item($item);?>{
‘name’: ‘<?php echo $item[‘name’]; ?>’,
‘id’: ‘<?php echo $item[‘product_id’]; ?>’,
‘brand’: ‘your-brand’,
‘category’: ‘your-category’,
‘price’: ‘<?php echo number_format($order->get_line_subtotal($item), 2, “.”, “”);?>’,
‘quantity’: ‘<?php echo $item[‘qty’];?>’
},
<?php endforeach; ?>
]
}
}
});
</script>