Google Analytics in Magento

Google Analytics in Magento

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.

You made it all the way down here so you must have enjoyed this post! You may also like:

Adding Magento products to Google Merchant Center Toni Anicic
Toni Anicic, | 127

Adding Magento products to Google Merchant Center

Magento & GWT “Googlebot found an extremely high number of URLs on your site” Toni Anicic
Toni Anicic, | 2

Magento & GWT “Googlebot found an extremely high number of URLs on your site”

Track validation errors on Magento forms using Google Analytics Nikola Stojiljkovic
Nikola Stojiljkovic, | 2

Track validation errors on Magento forms using Google Analytics


  1. Analytics works as good. Eventhough ECommerce is enabled (3months before) stills ecommerce related data are not populating in it. Is there any reason behind it ? have tried both placing the GA Snippets and Configuring in Admin panel

  2. Digital Marketing Company In Gurgaon
    Shadow Technology is that the growing IT company providing Webs and different IT services in Gurgaon. we tend to square measure functioning from past five years within the trade with 100 percent client orientating services.Visit:
    As a clever we tend tobs and software system service supplier we square measure providing web site planning Service in Gurgaon with SEO , on-line promoting , 3d Animation and software system Development. At Shadow Technology, we tend to live the worth of technology by however it edges individuals.Call for more information at 9717755870

  3. Hi, thanks for sharing valuable information. I was working on e-commerce store to sell the toys & games for kids. I was really seeking to track the traffic & user behaviour on my store. This write-up really helped me a lot to set-up the tracking.

  4. hi tony
    What is the best method of redirecting the visitor to the store directory since they land

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

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

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


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



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

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

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

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

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

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

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

  16. @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).

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

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

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

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

Tell us about your project

Drop us a line. We'd love to know more about your project.