Page 1 of 1

FIX: AC 7.0.5 Google Analytics not accurate

Posted: Tue Sep 07, 2010 10:04 am
by AbleMods
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