Help! Google Analytics Reporting Wrong after upgrade
Help! Google Analytics Reporting Wrong after upgrade
Hopefully someone can help with this...
After upgrading to 7.02 last week, our Google Analytics started giving us double numbers for our sales. Does anyone know why this would be?? We haven't changed anything with regards to GA settings at all.
Please help. I'd love to be able to solve this problem before too much time goes by, and our data becomes completely worthless.
Thanks for the help.
Scott
After upgrading to 7.02 last week, our Google Analytics started giving us double numbers for our sales. Does anyone know why this would be?? We haven't changed anything with regards to GA settings at all.
Please help. I'd love to be able to solve this problem before too much time goes by, and our data becomes completely worthless.
Thanks for the help.
Scott
Re: Help! Google Analytics Reporting Wrong after upgrade
A bit more info....
I've looked at difference in code, and it look like from one install to the next, the GoogleAnalyticsWidget.aspx lost this piece of code:
Any idea if that could be the problem??
Thanks,
Scott
I've attached two pics from my Analytics, showing a particular order. All of our orders since the upgrade, it seems, are showing up the exact same way... The order value exactly twice what it should be, and the order details showing correctly.
Order Total for order in question: OrderDetails for order in question:
I've looked at difference in code, and it look like from one install to the next, the GoogleAnalyticsWidget.aspx lost this piece of code:
Code: Select all
pageTracker._setAllowLinker(true);
pageTracker._setDomainName("none");
Thanks,
Scott
I've attached two pics from my Analytics, showing a particular order. All of our orders since the upgrade, it seems, are showing up the exact same way... The order value exactly twice what it should be, and the order details showing correctly.
Order Total for order in question: OrderDetails for order in question:
Re: Help! Google Analytics Reporting Wrong after upgrade
Okay another update to this drama...
I've looked at the source code of the rendered receipt page, and it looks as if the each item in the order is being submitted to google twice. Does this make any sense? Here is what I am seeing in the code:
Any ideas?
I've looked at the source code of the rendered receipt page, and it looks as if the each item in the order is being submitted to google twice. Does this make any sense? Here is what I am seeing in the code:
Code: Select all
pageTracker._addTrans("36885","","16.16","0.18","12.99","Saline","MI","US");
pageTracker._addItem("36885","alube","Aladdin Magic Lube","Pool Repair","2.99","1");
pageTracker._addItem("36885","alube","Aladdin Magic Lube","Pool Repair","2.99","1");
pageTracker._trackTrans();
Re: Help! Google Analytics Reporting Wrong after upgrade
Code: Select all
private void RegisterTransactionScript()
{
string scriptKey = "GoogleAnalyticsTrans:" + this.UniqueID;
if (!Page.ClientScript.IsStartupScriptRegistered(scriptKey))
{
LSDecimal shipping = 0;
LSDecimal taxes = 0;
LSDecimal total = 0;
foreach (OrderItem item in _Order.Items)
{
LSDecimal extendedPrice = item.ExtendedPrice;
switch (item.OrderItemType)
{
case OrderItemType.Shipping:
case OrderItemType.Handling:
shipping += extendedPrice;
break;
case OrderItemType.Tax:
taxes += extendedPrice;
break;
default:
break;
}
total += item.ExtendedPrice;
}
string transLine = "\"{0}\",\"{1}\",\"{2}\",\"{3}\",\"{4}\",\"{5}\",\"{6}\",\"{7}\"";
transLine = string.Format(transLine, _Order.OrderId, "", string.Format("{0:F2}", total), string.Format("{0:F2}", taxes), string.Format("{0:F2}", shipping), _Order.BillToCity, _Order.BillToProvince, _Order.BillToCountryCode);
string scriptBlock =
@"<script language=""JavaScript"">
<!--
pageTracker._addTrans(" + transLine + ");";
string itemLine = "\"{0}\",\"{1}\",\"{2}\",\"{3}\",\"{4}\",\"{5}\"";
foreach (OrderItem item in _Order.Items)
{
switch (item.OrderItemType)
{
case OrderItemType.Product:
itemLine = string.Format(itemLine, _Order.OrderId, item.Sku, item.Name, GetItemCategory(item), string.Format("{0:F2}", item.Price), item.Quantity);
scriptBlock += @"
pageTracker._addItem(" + itemLine + ");";
break;
}
}
scriptBlock +=
@"
pageTracker._trackTrans();
// -->
</script>";
Page.ClientScript.RegisterStartupScript(this.GetType(), scriptKey, scriptBlock);
}
}
I fixed on my side with:
Code: Select all
string itemLineForm = "\"{0}\",\"{1}\",\"{2}\",\"{3}\",\"{4}\",\"{5}\"";
foreach (OrderItem item in _Order.Items)
{
switch (item.OrderItemType)
{
case OrderItemType.Product:
string itemLine = string.Format(itemLineForm, _Order.OrderId, item.Sku, item.Name, GetItemCategory(item), string.Format("{0:F2}", item.Price), item.Quantity);
scriptBlock += @"
pageTracker._addItem(" + itemLine + ");";
break;
}
}
Re: Help! Google Analytics Reporting Wrong after upgrade
Hmm first make sure that you are using only single instance of Google Analytics control on your page. For example one instance could be in footer and one may be in contents or some where else.
Re: Help! Google Analytics Reporting Wrong after upgrade
No, I've checked for that... There is only one control on the page. The values are just being figured wrong. When I look at the source, the total ammount line being send to google is double. I have a feeling it has something to do with how kit pricing is figured. Most of the items in our store are in the form of kits.... Has anything with kitting changed since the upgrade? Like perhaps the "Price" for orderItems? I'm still at a loss here.
Re: Help! Google Analytics Reporting Wrong after upgrade
Okay...
It appears that the problem is occuring because around line 189 on the ReceiptPage.ascx.cs
It appears that the price of a parent order item is being modified temporarily to accomodate (I assume) some kind of kit grouping on the page. As a result, though, when the GoogleAnalyticsWidget tries to use _Order.Items, prices will be added into the order total twice.
Not sure what the best fix for this bug would be. I fixed on mine by setting the ordertotal equal to _Order.TotalCharges, and skipped added an item to the list when it has a parent item.
Is there a better way to go about fixing this??
It appears that the problem is occuring because around line 189 on the ReceiptPage.ascx.cs
Code: Select all
if (index > -1) _Order.Items[index].Price += (item.ExtendedPrice / _Order.Items[index].Quantity);
Not sure what the best fix for this bug would be. I fixed on mine by setting the ordertotal equal to _Order.TotalCharges, and skipped added an item to the list when it has a parent item.
Is there a better way to go about fixing this??
Re: Help! Google Analytics Reporting Wrong after upgrade
So, should this be reported as a bug then?
Scott
Scott
Re: Help! Google Analytics Reporting Wrong after upgrade
Thanks scott! I think you have discovered (and fixed) a couple of bugs.
These will be logged into bugzilla and will be fixed in 7.3.
These will be logged into bugzilla and will be fixed in 7.3.