2.7K members online now
2.7K members online now
Use AdWords conversion tracking and reporting to measure your results. Have a question about Google Analytics? Post it here, on the Google Analytics Community!
Guide Me

Ecommerce Tracking Code - Please check?

Participant ✭ ☆ ☆
# 1
Participant ✭ ☆ ☆

Hi all,


I'm working with a site dev to sort out Ecomm tracking. He's added this code to the confirmation page could someone please just check it over. If this works we should get the data to Analtyics and then Adwords?


He has left the comments in there, but that shouldn't cause issues right? I don't think I can see any other issues in the code but I don't really know what to look for.


	ga('require', 'ecommerce');
	ga('ecommerce:addTransaction', {
	  'id': '{transaction_id}',                     // Transaction ID. Required.
	  'affiliation': 'Rudells',   // Affiliation or store name.
	  'revenue': '{order_total}',               // Grand Total.
	  'shipping': '{order_shipping}',                  // Shipping.
	  'tax': '{order_tax}'                     // Tax.{order_total}
	{exp:cartthrob:order_items order_id="{entry_id}" }
	ga('ecommerce:addItem', {
	  'id': '{transaction_id}',                     // Transaction ID. Required.
	  'name': '{item:title}',    // Product name. Required.
	  'sku': '{rudell_code}',                 // SKU/code.
	  'category': '{item:category1} > {item:category2} > {item:category3}',         // Category or variation.
	  'price': '{item:price}',                 // Unit price.
	  'quantity': '{item:quantity}'                   // Quantity.

Thanks in advance!

1 Expert replyverified_user

Ecommerce Tracking Code - Please check?

[ Edited ]
Top Contributor
# 2
Top Contributor

generally, comments should not matter and adding currency is a best-practice.

as is, both exp:cartthrob expressions would throw an error and
the ga-code snippet is missing the initial analytics resource-load.

also, exact placement of such code usually matters to an e-commerce-system.

however, any related issues are usually dependent on
the specific e-commerce-system's internal details --

for example, both exp:cartthrob's may be perfectly fine

within the context of that specific e-commerce-system.

the basic structure of the code seems sound and the comments look to be added
properly -- but only someone at cart-throb would likely know how to properly
place cartthrob-specific details, and if all the related parameters/variables
used would accurately reflect an offer being sold, based on how that particular
e-commerce system functions.

the site looks to be using cart-throb; if so, the best likely course would be
to contact cart-throb support directly and also possibly ask within one of
the cart-throb support-forums.

see also