E-commerce google analytic missed some order

39 views
Skip to first unread message

Bunty Singh

unread,
Dec 16, 2013, 3:51:52 AM12/16/13
to xamp...@googlegroups.com
hi my project is in opencart and i applied google analytic. some time it miss order in Google transaction.

Any idea

my code is below

////////////////////
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'XXXXXXX']);
_gaq.push(['_trackPageview']);
_gaq.push(['_addTrans',
   "<?php echo $order_id;?>",           // transaction ID - required
   "<?php echo $store_name;?>", // affiliation or store name
   "<?php echo $order_total;?>",          // total - required
   '0.00',           // tax
   "<?php echo $shipping_price;?>",          // shipping
   "<?php echo $payment_city;?>",       // city
   "<?php echo $payment_zone;?>",     // state or province
   "<?php echo $payment_country;?>"             // country
]);
<?php foreach ($product_data as $product) { ?>
_gaq.push(['_addItem',
   "<?php echo $order_id;?>",           // transaction ID - necessary to associate item with transaction
   '<?php echo $product["model"]; ?>',           // SKU/code - required
   '<?php echo $product["name"]; ?>',        // product name
   '<?php echo $product["category_name"]; ?>',   // category or variation
   '<?php echo $product["price"]; ?>',          // unit price - required
   '<?php echo $product["quantity"]; ?>'               // quantity - required
]);
<?php } ?>
_gaq.push(['_trackTrans']);

 (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);
  })();


</script>

//////////////////

Thanks
Reply all
Reply to author
Forward
0 new messages