We are trying to track page views and ecommerce transactions across 3 different GA properties (tracking id's). After following the integration and developers guide exactly as defined and using properly name spaced trackers we are getting inconsistent data. Some transactions are tracked, others not. Seems like some sort of conflict within the methodology but after trying various iterations we have not found resolution.
Code is as follows:
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create','UA-XXXX-1','auto',{'name': 'location1'});
ga('location1.send','pageview',{'dimension1': 'location-1-name'});
ga('location1.require','ecommerce','ecommerce.js');
ga('create','UA-XXXX-2','auto',{'name': 'location2'});
ga('location2.send','pageview',{'dimension1': 'location-2-name'});
ga('location2.require','ecommerce','ecommerce.js');
ga('create', 'UA-XXXX-3','auto',{'name': 'location3'});
ga('location3.send','pageview');
ga('location3.require','ecommerce','ecommerce.js');
var transaction = {
'id': '1234',
'affiliation': 'store',
'revenue': '10.50',
'shipping': '5.00',
'tax': '0.00'
};
ga('location1.ecommerce:addTransaction', transaction);
ga('location1.ecommerce:addItem', {
'id': '<?php echo $order->order_no; ?>',
'name': '<?php echo $item->name; ?>',
'sku': '<?php echo $item->item_no; ?>',
'category': '<?php echo $item->item_type; ?>',
'price': '<?php echo number_format($item->item_sale_price,2); ?>',
'quantity': '<?php echo $item->qty; ?>'
});
<?php } ?>
ga('location2.ecommerce:addTransaction', transaction);
<?php foreach ($items as &$item) { ?>
ga('location2.ecommerce:addItem', {
'id': '<?php echo $order->order_no; ?>',
'name': '<?php echo $item->name; ?>',
'sku': '<?php echo $item->item_no; ?>',
'category': '<?php echo $item->item_type; ?>',
'price': '<?php echo number_format($item->item_sale_price,2); ?>',
'quantity': '<?php echo $item->qty; ?>'
});
<?php } ?>
ga('location3.ecommerce:addTransaction', transaction);
<?php foreach ($items as &$item) { ?>
ga('location3.ecommerce:addItem', {
'id': '<?php echo $order->order_no; ?>',
'name': '<?php echo $item->name; ?>',
'sku': '<?php echo $item->item_no; ?>',
'category': '<?php echo $item->item_type; ?>',
'price': '<?php echo number_format($item->item_sale_price,2); ?>',
'quantity': '<?php echo $item->qty; ?>'
});
<?php } ?>
ga('location1.ecommerce:send');
ga('location2.ecommerce:send');
ga('location3.ecommerce:send');