Tell me more ×
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It's 100% free, no registration required.

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

share|improve this question

migrated from stackoverflow.com May 29 at 21:20

2 Answers

up vote 2 down vote accepted

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 should be located at: app/design/frontend/default/YOURTHEME/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/

share|improve this answer
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 at 21:19

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!
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.