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 - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 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 - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 reputation)Supreme Being - (29,755 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>
thopcroft
 Posted Fri 31 Oct 2014
Supreme Being

Supreme Being - (10,918 reputation)Supreme Being - (10,918 reputation)Supreme Being - (10,918 reputation)Supreme Being - (10,918 reputation)Supreme Being - (10,918 reputation)Supreme Being - (10,918 reputation)Supreme Being - (10,918 reputation)Supreme Being - (10,918 reputation)Supreme Being - (10,918 reputation)

Group: Forum Members
Last Active: Fri 31 Oct 2014
Posts: 18, Visits: 96
I have been working on getting e-commerce in Google analytics to work with PayPal. I have updated the EcommerceTracking.ascx code with the universal analytics code you recommended. I have successfully got e-commerce in analytics to work with orders that use the offline cheque payment method which displays the details of the order on the Checkout.aspx page. The PayPal automatic return page checkoutcomplete.aspx does not display any order details and therefore does not update e-commence in Google analytics.

Is this because the PayPal callback to callback.aspx wipes the basket before the checkoutcomplet.aspx page is loaded?
Paul
 Posted Sat 1 Nov 2014
große Käse

große Käse - (450,068 reputation)große Käse - (450,068 reputation)große Käse - (450,068 reputation)große Käse - (450,068 reputation)große Käse - (450,068 reputation)große Käse - (450,068 reputation)große Käse - (450,068 reputation)große Käse - (450,068 reputation)große Käse - (450,068 reputation)

Group: Administrators
Last Active: Fri 15 Sep 2023
Posts: 806, Visits: 2,737
The callback.aspx when called from Paypal cannot wipe a user's basket. The basket is linked to the user based on session ID, it relies on cookies. If paypal's servers connect to the site, they don't hold the user's cookies (only the user's browser does) so there is no way to link them to the basket. Some payment systems like Sagepay do redirect users themselves to the callback.aspx, which is why the wipebasket command may be in there. But since most payment systems call this page themselves, there is nothing really to wipe (the gateway would effectively just wipe whatever was in its own basket, which will be empty).

--
If my post solves your issue, can you 'Mark as Answer' so it's easier for other users to find in future.

If you would like to be informed of new features, new releases, developments and occasional special bonuses, please sign up to our mailing list: http://bit.ly/19sKMZb

Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top