FIX: AC 7.0.5 Google Analytics not accurate

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

FIX: AC 7.0.5 Google Analytics not accurate

Post by AbleMods » Tue Sep 07, 2010 10:04 am

The Google Analytics widget was rewritten in 7.0.5 and now it's bugged. If you are using this and report eCommerce statistics to Google, you might have noticed that sales are being lumped into Taxes instead of Order Totals.

In the code, you'll see that the taxTotal variable is updated and the orderTotal variable never gets touched.

The fix is simple, just edit the /ConLib/GoogleAnalyticsWidget.ascx.cs file and find this code:

Code: Select all

            switch (item.OrderItemType)
            {
                case OrderItemType.Shipping:
                case OrderItemType.Handling:
                    shippingTotal += extendedPrice;
                    break;
                case OrderItemType.Tax:
                    taxTotal += extendedPrice;
                    break;
                default:
                    break;
            }
            taxTotal += extendedPrice;
And change the last line:

Code: Select all

taxTotal += extendedPrice;
to

Code: Select all

orderTotal += extendedPrice;
To my knowledge, there is no way to correct the existing data in Google Analytics eCommerce. I'm not all that familiar with GA though, so don't that as gospel :D
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

Post Reply