9

I set up a new Magento store, and a new analytics profile, and it asked if I wanted to use universal analytics or the original google analytics. After doing some checking, I found out I can create a new profile to track along side the original one so I have both now.

But the universal analytics profile isn't tracking anything and the original one is. It doesn't have traffic or goals. The tracking code is different. Is there a way to have Magento store to use universal analytics as well?

1
  • If you still looking how to implement it see this stackover answer [ Universal Analytics could not track transaction in magento ] stackoverflow.com/questions/22229312/…
    – user6592
    May 13, 2014 at 9:33

5 Answers 5

11

You have to add the new Universal Analytics code your your head.phtml file in your template. You can choose to disable the Google API or keep it active as well.

Your head.phtml file is located at: app/design/frontend/base/default/template/page/html/head.phtml

Just copy to your theme: app/design/frontend/your_theme/default/template/page/html/head.phtml

Add your analytics code before the if it shows otherwise at the end.

Here is a picture tutorial on how to do that: http://www.savethemage.com/blog/how-to-add-googles-universal-analytics-to-your-magento-store/

For tracking goals, you will have to set a new goal for your new profile.

Here is a tutorial on how to create the standard checkout goal funnel for Magento onepage abandonment rates: http://www.savethemage.com/blog/tracking-magento-onepage-abandonment-using-google-universal-analytics/

3
  • 2
    Please note that bare links to your own website/product are not encouraged here for two reasons; First, an answer should be posted as a self-contained answer, not a mere link to an external site. Second, self-promotion tends to be frowned upon here, and often is flagged as spam (especially if there is no disclosure that you are linking to your own site/product).
    – Andrew Barber
    May 29, 2013 at 21:19
  • 1
    There is absolutely no need to edit a template file for simple visitor tracking. You can simply go to System->Design->HTML Head and add the tracking code to the "Miscellaneous Scripts"-box. Apr 29, 2014 at 17:56
  • savethemage.com is no longer available
    – Mike
    May 8, 2017 at 12:16
6

Universal analytics isn't yet supported out of the box in Magento (as at CE 1.7), so to add it to your site you need to modify your site theme.

The Universal Tracking code is also compatible with the old code, so if you are adding this to an existing site the Google recommendations are to start by running them both together to make sure there are no gaps in your records, you can then switch off the old one once you're happy with the new system.

Essentially the minimum you need to do is:

  1. Login to Google Analytics and create a new web property. This new property will capture the Universal Analytics, your old property will hold your historical data.
  2. When prompted select "Universal Analytics" as the tracking method, this is currently the default option for new web properties in Google
  3. You'll be presented with tracking code, you need to add this to your current Magento theme just before the closing tag in your theme.
  4. To add it to your theme look in app/design/frontend/<YOURTHEME>/default/template/page/html/head.phtml edit this file and paste the tracking code at the end of it.
  5. Upload to your site and make sure to flush the Magento Cache so your changes come through.

Alternative Method

If you are not comfortable editing theme files in step (4) you can instead add this code through the configuration settings of your store.

Log into your magento admin and look in System > Configuration > Design > HTML Head there's a box called "Miscellaneous Scripts" that you can add the tracking code to, any script in this box appears just before the closing </head> tag.

More information

Links to the relevant Google pages:

  1. About Universal Analytics
  2. Setting up Universal Analytics - note the "Best practices" section on this page that talks about running the old and new code concurrently as Universal is still in it's early days!
1

Magento has a section for users to insert Universal analytics tracking code, you can find it in: System > Configuration > Sales > Google API See screenshot

All you need to do is go to Admin > User Management > Tracking info > Tracking code to get your tracking ID and put it in Account number in Magento Google API section. Save changes and go to your Google Analytics account to see the result.

Reference source: http://magentoexplorer.com/how-to-install-google-analytics-tracking-code-in-magento

0

For Universal Analytics Tracking ,You need to add your GA code in theme here app/design/frontend//default/template/page/html/head.phtml

You can Edit file and use your tracking code (GA code).

2
0

You can connect your store with Google Analytics by following these steps:

Go to Google Analytics and Sign Up here by adding the details of your store.

Now click on Google API Under SALES by navigating to System → Configuration from Admin Panel of your store. Her enter the Tracking ID in the Account Number text box which you will get after creating an account on Google Analytics and click on Save Config.

Not the answer you're looking for? Browse other questions tagged or ask your own question.