AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

1.9K members online now
1.9K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
Guide Me

ecommerce conversion tracking code

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I need help to track ecommerce conversion.

I have added GA tracking code, also enabled E-commerce tracking option on GA. But, I am not getting Ecommerce data on my GA account.

So, do I need to add any separate data to track conversion i.e., adding products to cart, placing an order or checkout complete????

If so, then kindly help with the code.

Also, help were to place the ecommerce tracking code this our electrical shopping site i.e.,

Eleczo Team
1 Expert replyverified_user

ecommerce conversion tracking code

Rising Star
# 2
Rising Star

You need to add the ecommerce tracking code - it was not clear to me whether you have done this or not. For this you require developer support to add both the transaction hit. The simplest form of ecommerce tracking involves adding extra code to your thank-you page which sends a transaction hit to GA.


If you wish to use enhanced ecommerce - a more complex and richer form of ecommerce tracking -  then you require additional event tracking to measure add to cart events, product impressions etc. Though these can be measured using regular event tracking.


I'd recommend that you:

- check to see if your payment platform already supports a GA integration, many plugins already do

if not, decide whether you want to use:

- enhanced ecommerce 

- ecommerce


Developer notes for regular ecommerce are here:


Enhanced ecommerce is described here:

If you are using Google Tag Manager you can also implement it via that, though it still requires developer work on the page:


Personally, be wary of trying an implementation of enhanced ecommerce unless you have good developer support. You still need a developer onboard for ecommerce, but the code is not as complicated.








John Wedderburn, Advertiser Community, Rising Star
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.

Re: ecommerce conversion tracking code

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Adding the following code will reolve my problem i.e., will I be able to track ecommerce conversions using the following code.


This code I'll be adding in general google analytics tracking code just above this line: 

ga('send', 'pageview');



ga('require', 'ecommerce', ‘ecommerce.js’);

<?php// Function to return the JavaScript representation of a TransactionData object.function getTransactionJs(&$trans) {  return <<<HTML
ga('ecommerce:addTransaction', {  'id': '{$trans['id']}',  'affiliation': '{$trans['affiliation']}',  'revenue': '{$trans['revenue']}',  'shipping': '{$trans['shipping']}',  'tax': '{$trans['tax']}'});
HTML;}// Function to return the JavaScript representation of an ItemData object.function getItemJs(&$transId, &$item) {  return <<<HTML
ga('ecommerce:addItem', {  'id': '$transId',  'name': '{$item['name']}',  'sku': '{$item['sku']}',  'category': '{$item['category']}',  'price': '{$item['price']}',  'quantity': '{$item['quantity']}'});

ga('require', 'ecommerce');<?php
echo getTransactionJs($trans);

foreach ($items as &$item) {
  echo getItemJs($trans['id'], $item);}?>


ecommerce conversion tracking code

Rising Star
# 4
Rising Star

That's the standard code, yes - but you'll still need to programatically fill in the values of SKU, category, price etc.

John Wedderburn, Advertiser Community, Rising Star
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.

ecommerce conversion tracking code

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Checked your website for GA code. Looks fine. 

If E-Commerce tracking is not working, please try Google Analytics code using following Free Magento Extensions: