Google Analytics only tracking some orders...

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
gjaros
AbleCommerce Partner
AbleCommerce Partner
Posts: 1717
Joined: Tue Feb 24, 2004 2:20 pm
Location: Illinois
Contact:

Google Analytics only tracking some orders...

Post by gjaros » Thu Sep 23, 2010 12:56 pm

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.
Image
Image

User avatar
gjaros
AbleCommerce Partner
AbleCommerce Partner
Posts: 1717
Joined: Tue Feb 24, 2004 2:20 pm
Location: Illinois
Contact:

Re: Google Analytics only tracking some orders...

Post by gjaros » Fri Oct 01, 2010 4:21 pm

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);
Image
Image

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Google Analytics only tracking some orders...

Post by AbleMods » Sun Oct 03, 2010 7:49 pm

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.
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

User avatar
gjaros
AbleCommerce Partner
AbleCommerce Partner
Posts: 1717
Joined: Tue Feb 24, 2004 2:20 pm
Location: Illinois
Contact:

Re: Google Analytics only tracking some orders...

Post by gjaros » Mon Oct 04, 2010 9:42 am

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.
Image
Image

Post Reply