Page 1 of 1

Google Analytics only tracking some orders...

Posted: Thu Sep 23, 2010 12:56 pm
by gjaros
One of our clients has Google Analytics configured for two sites. We have the GoogleAnalyticsWidgit conlib on the footer of every page on both sites, but for some reason only some orders are getting recorded in Google. About 50% of the orders placed aren't getting tracked. Has anyone else experienced this? I could understand if it was none of the orders, but can't figure out why it's just some of them.

Thanks.

Re: Google Analytics only tracking some orders...

Posted: Fri Oct 01, 2010 4:21 pm
by gjaros
I think I found the issue. Orders not coming across had " in one or more of the product names, for example if there was an order that contained Picture Frame - 24" by 36" the Google Analytics code wouldn't work. It looks like line 109 of GoogleAnalyticsWidget.aspx.cs needs to have double quotes stripped out. I changed the item.Name call from this:

Code: Select all

String itemLine = string.Format(itemLinePattern, _Order.OrderId, item.Sku, item.Name, GetItemCategory(item), string.Format("{0:F2}", item.Price), item.Quantity);
To this:

Code: Select all

String itemLine = string.Format(itemLinePattern, _Order.OrderId, item.Sku, item.Name.Replace("\"","&quote;"), GetItemCategory(item), string.Format("{0:F2}", item.Price), item.Quantity);

Re: Google Analytics only tracking some orders...

Posted: Sun Oct 03, 2010 7:49 pm
by AbleMods
Very helpful - I didn't even think about quotes throwing off the formatting. Able usually uses a StringHelper to clean stuff up before it gets sent/stored.

Did you see my post from a few weeks ago about the bug in 7.0.5 GA Widget? It's posting order total to the sales
tax column in GA eCommerce.

Re: Google Analytics only tracking some orders...

Posted: Mon Oct 04, 2010 9:42 am
by gjaros
Yeah, I did see that post when I was looking to see if anyone had run into the problem I was having. We've taken note of it so we can fix it for any of our clients needing it. Thanks.