Found multiple posts with no clear answers on this.. Found the code below for adding Google ecommerce tracking in an old post.
Can someone confirm this is correct or guide me to WHERE I might find the right code for Zen Cart to add ecommerce tracking..
Code:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxx-1']);
_gaq.push(['_trackPageview']);
_gaq.push(['_addTrans','<?php echo $zv_orders_id ?>','','<?php echo $zv_order_total_cd ?>','<?php echo $zv_order_tax ?>','<?php echo $order_summary['shipping'] ?>','<?php echo $zv_order_city ?>','<?php echo $zv_order_state ?>','<?php echo $zv_order_country ?>']);
_gaq.push(['_addItem','<?php // Loop through products purchased to track in Google (these come from the "cart_orders_products TABLE)
//sku = "products_model"; productname = "products_name"; category = ""; price = "final_price"; quantity = "products_quantity"
$products_displayed_google = array();
for ($i=0, $n=sizeof($products_array_google); $i<$n; $i++) {
if (!in_array($products_array_google[$i]['id'], $products_displayed_google)) {
echo $zv_orders_id . '\',
\'' . $products_array_google[$i]['model'] . '\',
\'' . $products_array_google[$i]['text'] . '\',
\'\',
\'' . $products_array_google[$i]['price'] . '\',
\'' . $products_array_google[$i]['quantity'] . '\'
' . ((($i+1)<$n) ? ',\'' : '' ) ;
}
}
?>])
_gaq.push(['_trackTrans']); //submits transaction to the Analytics servers
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
__utmSetTrans()
</script>
Bookmarks