Enhanced Ecommerce Web Tracking
I am trying to add Google enhanced eCommerce web tracking to my checkout_success.php page. Here is the js/php code I have used:
ga('ec:addProduct', {
'id': '<?php echo $eCart1->DisplayInfo("SKU"); ?>',
'name': '<?php echo $eCart1->DisplayInfo("Name"); ?>',
'price': '<?php echo $eCart1->DisplayInfo("Price"); ?>',
'quantity': '<?php echo $eCart1->DisplayInfo("Quantity"); ?>'
});
The problem I am having is that after a successful transaction and you are redirected to the success page, if I look at the source code I can see that all the $eCart1->DisplayInfo values are blank in the java-script code used for enhanced eCommerce, even though this same page uses the same eCart code to add the order details
$ReplaceQuery->bindColumn("DetailOrderID", "d", "".$_SESSION['orderID'] ."", "WA_DEFAULT");
$ReplaceQuery->bindColumn("DetailProductID", "d", "".$eCart1->DisplayInfo("ID") ."", "WA_DEFAULT");
$ReplaceQuery->bindColumn("DetailName", "s", "".$eCart1->DisplayInfo("Name") ."", "WA_DEFAULT");
$ReplaceQuery->bindColumn("DetailPrice", "d", "".$eCart1->DisplayInfo("Price") ."", "WA_DEFAULT");
$ReplaceQuery->bindColumn("DetailSKU", "s", "".$eCart1->DisplayInfo("SKU") ."", "WA_DEFAULT");
$ReplaceQuery->bindColumn("DetailQTY", "d", "".$eCart1->DisplayInfo("Quantity") ."", "WA_DEFAULT");
which work fine.