Google Universal Analytics

Posted By BORNXenon Mon 29 Sep 2014
Add to Favorites0
Author Message
BORNXenon
 Posted Mon 29 Sep 2014
Supreme Being

Supreme Being - (30,085 reputation)Supreme Being - (30,085 reputation)Supreme Being - (30,085 reputation)Supreme Being - (30,085 reputation)Supreme Being - (30,085 reputation)Supreme Being - (30,085 reputation)Supreme Being - (30,085 reputation)Supreme Being - (30,085 reputation)Supreme Being - (30,085 reputation)

Group: Forum Members
Last Active: Mon 23 Apr 2018
Posts: 59, Visits: 291
Our Kartris store has been live for just under a week now and today we got our first order, however, we have not received any data in Google Analytics for this order.

I've done some digging and it appears that although the main Google Analytics code in Kartris has been updated to use the Universal Analytics code, the code that tracks the Ecommerce events hasn't been updated in UserControls/Front/EcommerceTracking.ascx and is still using the old _gaq.push method and ga.js file.

I have updated the code in this file on my implementation (although I now need an order to ensure that it works!), if anyone else is using Universal Analytics and needs the updated code, here it is.

EDIT:

Code removed as it broke my callback page, not sure why at the minute but for now I can live without the eCommerce tracking, rather have a working site!!

Would be nice if a member of the dev team could perhaps look into it?
Wed 1 Oct 2014 by BORNXenon
BORNXenon Marked As Answer
 Posted Fri 10 Oct 2014
Supreme Being

Supreme Being - (30,085 reputation)Supreme Being - (30,085 reputation)Supreme Being - (30,085 reputation)Supreme Being - (30,085 reputation)Supreme Being - (30,085 reputation)Supreme Being - (30,085 reputation)Supreme Being - (30,085 reputation)Supreme Being - (30,085 reputation)Supreme Being - (30,085 reputation)

Group: Forum Members
Last Active: Mon 23 Apr 2018
Posts: 59, Visits: 291
As it turns out, it wasn't the analytics code that broke my Callback page, it was a permissions issue while running in Integrated mode.

I have since fixed that issue and confirmed that the new ecommerce code works, so here it is again.

Replace the existing script tags and everything inbetween with the following:

<script type="text/javascript">

(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', '<asp:Literal ID="litGoogleWebPropertyID" runat="server" />', 'auto');
ga('send', 'pageview');
ga('require', 'ecommerce'); // Load the ecommerce plug-in.

ga('ecommerce:addTransaction', {
'id': '<asp:Literal ID="litOrderID" runat="server" />', // Transaction ID. Required
'affiliation': '<asp:Literal ID="litWebShopName" runat="server" />', // Affiliation or store name
'revenue': '<asp:Literal ID="litTotal" runat="server" />', // Grand Total
'shipping': '<asp:Literal ID="litShipping" runat="server" />', // Shipping
'tax': '<asp:Literal ID="litTax" runat="server" />' // Tax
});

<asp:Repeater ID="rptOrderItems" runat="server">
<ItemTemplate>

// addItem should be called for every item in the shopping cart.
ga('ecommerce:addItem', {
'id': '<asp:Literal ID="litOrderID" runat="server" />', // Transaction ID. Required
'name': '<asp:Literal ID="litItemName" runat="server" />', // Product name. Required
'sku': '<asp:Literal ID="litVersionCode" runat="server" />', // SKU/code
'category': '<asp:Literal ID="litItemOptions" runat="server" />', // Category or variation
'price': '<asp:Literal ID="litItemPrice" runat="server" />', // Unit price
'quantity': '<asp:Literal ID="litItemQuantity" runat="server" />' // Quantity
});

</ItemTemplate>
</asp:Repeater>

ga('ecommerce:send'); // Send transaction and item data to Google Analytics.

</script>

Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top