Google Analytics in Magento

Featured Image

Some of you who work with Magento for a long time might think that this topic is so clear that it doesn’t need to have an article. We get many inquiries to finalize the work somebody already started. One of the things we notice is that some developers tend to embed the Google Analytics code directly in the Magento theme files. Yes, it works and you will see the standard traffic data in the Google Analytics interface, but it is not a way to go.

In most of the cases, those developers edit footer.phtml in app/design/frontend/default/[your_theme]/template/page/html folder. As I said, the Google Analytics will track visitors data properly, but the main issue is that the eCommerce data will not be collected. To enable eCommerce data to be visible, first step is that you let Google Analytics to know that the profile is actually an E-Commerce site.

You will get to this interface by

  1. Logging to Google Analytics
  2. Select an account for this site
  3. On the list of Account profiles, do not go to the reports, click on Edit instead
  4. On the first box “Main Website Profile Information”, there is another Edit link to the right. Click on it.
  5. One there, you will see the interface similar to the one on this image. Let Google Analytics know this is an eCommerce website

Edit Profile in Google Analytics

Although Google Analytics will tell you to embed the javascript code on your website, you don’t have to do that. You just need to see what is the Web Property ID of the profile. One you know it, go to the Magento administration to the interface: System> Configuration> Google API> Google Analytics. Enable it and insert that Web Property ID. Viola.

Google Analytics Magento Admin

Forums say that older versions of Magento before 1.2 do not properly track eCommerce data. In case you have older version of Magento and have this issue, do not install some special plugins. Upgrade Magento instead.

About Tomislav Bilic

Founder and CEO

Tomislav is a founder and CEO at Inchoo. Enjoys traveling - especially quick getaways, traditional cuisine (from most cultures), good wine and strong rakija.

Read more posts by Tomislav / Visit Tomislav's profile


  1. Thank you for providing help in magento analyttics setup. I am new to magento SEO and I have been feeling difficulties in managing some SEO parameters.

  2. Hey Toni,

    Followed the above steps as it is, the site is also showing up in the list but the thing is that I’m not getting any traffic data in it.

  3. Hi Toni Anicic,

    I have done all the above set up but a slight change in code – replaced ga.js with dc.js to support re-marketing.

    I am not getting e-commerce data in the report – does dc.js support e-commerce tracking?


  4. Hi
    I am building an environment in Magento where different sellers can open their stores and sell their merchandise. I want to provide every merchant with his/her own analytics report. Is there a way to track each store separately through GA & report in a Magento interface?



  5. I have setup all of the above but my analytics showing nothing in ecommerce tab. Please let me know the solutions.

  6. Hello,

    Can you please tell me exactly WHAT this will populate in Google Analytics? Will it populate all field in ECommerce tab?

    Average Order Value
    Purchased Products

    Or is there any additional tracking? We’ve implemented on a yet-to-be-launched site, so I can’t see what’s working just yet.

    Also, please, have mercy on me if this is a silly question – not a tecchie.

  7. Hi, I upgraded my site to from, the GA e-commerce worked great but after the upgrade it’s not tracking anymore.

    I checked the settings on your tutorial and everything is correctly set-up and should be working too.

    I have checked several posts for this problem but I still cant find the fix. Any idea what might cause the problem?

    thanks a lot,
    May Ann

  8. Am I right in thinking that if you follow these steps that you don’t have to add any additional e-commerce tracking code within the GA tracking code using parameters such as _addTrans(), _addItem() and _trackTrans(). Will this be done automatically?

  9. Hi,
    I did the above setup as instructed but the problem is my ecommerce transactions are recorded 5 times for a single transaction. When i checked the ecommerce tracking code on the thank you page i found that it is being executed 5 times. Please help me with this. Also if anyone can tell me where can i find the file where the code is written it will be helpful.

  10. Just tested the integration with a brand new installation of Magento. It seems that there are some issues with GA reporting:
    – when I look in the checkout/onepage/success/ page, I did not see any of the GA code for inserting the transaction to Google analytics.
    – When I look in GA, SOME of the data is missing:
    Sales of 0 products generated $15.00 (correct revenue amount) but sales of 0 product?

    the data also shows:
    33.33% Conversion Rate
    1 Transactions (correct)
    $15.00 Average Order Value (correct)
    1 Purchased Products (correct).
    But when I click on the 1 Purchased Products, I get no records found

  11. @David Corman, if you did everything as explained in this article and still can’t see e-commerce tracking you probably missed something. this should work by default, no additional code is needed.

  12. I added the web property id and activated the setting to track e-commerce data but still do not see the tab in my Analytics account for e-commerce tracking. Do I have to install the tracking code into the thank-you page as well?

  13. @Tyler, @karisa: True, Google Analytics is not real time, but it’s not updated once per day, it’s updated more often. Usually it’s somewhat like 3 hours late. You can check the stats for the current day but you’ll need to choose today in the drop down box with dates (top right).

  14. “I get analytics to work…at night after I have left my job. When I check in the morning there are new stats posted. Throughout the day however, the stats do not change. Any idea of whats happening or causing this?”

    Google analytics is not real time, the data is updated once a day, typically overnight.

  15. I get analytics to work…at night after I have left my job. When I check in the morning there are new stats posted. Throughout the day however, the stats do not change. Any idea of whats happening or causing this?

  16. i am getting into the magneto game as well, i always wanted to know the following, most magento installations are installed in a folder. What is the best method of redirecting the visitor to the store directory since they land on the root domain.

    .htaccess file or anything else

  17. Seems a simple enough step, try to complicate the situation by adding in adwords conversion code, the amount of blog posts around that topic seems to show its a big issue for many developers.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.