Google Analytics in Magento

12 Comments 2nd JUL 2009 | Posted by Tomislav Bilic 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.

If you like what you read, please share it.

  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Yahoo! Bookmarks
  • Reddit
  • Technorati
  • Twitter
  • StumbleUpon
  • LinkedIn
  • Netvibes
  • NewsVine
  • Sphinn
  • Tumblr
  • Posterous

To post code in comments, place your code inside [code] and [/code] tags.

There are 12 comments (Add Yours +)

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

  • 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

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

  • Waow really useful to have the E-commerce tab on Analytics !
    Thanks a lot

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

  • Toni Anicic Says

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

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

  • Toni Anicic Says

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

  • 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

  • Thank’s guy, It’s a very helpfull tip!!!

  • Rahul Singh Says

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

  • Thanks a lot for this tip….Love your work….

Leave a Comment

Please wrap all source codes with [code][/code] tags.
Magento Design and Development | Magento SEO | iPhone Application Development Web Application Development with ZEND | WordPress Ecommerce | WordPress development
Sitemap

Inchoo - webappsolutions | 2009