Category Archives: google analytics

How To Set Up Google Content Experiments in Magento 1.7

I spent a lot of time looking around for a way to conduct Google Analytics Content Experiments in Magento with very little success. I did find this post in Finnish that detailed one approach and I adapted his findings (with the help of Google Translate) in to the following solution.

Step 1 – Set up your Content Experiment code block
In CMS > Static Blocks add a new static block with an easy to identify name such as “Google Content Experiments Code” and an identifier such as “google_code_block”. Paste the Content Experiments code in to the wysiwyg editor by pressing the HTML button and pasting the code in to the pop up window. Click “update” and the window will close but you won’t see anything appear in the wysiwyg window. This is normal.Make sure you enable the code block and save it.

Step 2 – Alter your template to write the code block
In your appdesignfrontenddefaultyourtemplatetemplatepagehtmlhead.phtml file add the following code right at the top after meta charset="UTF-8"

<?php  $routeName = Mage::app()->getRequest()->getRouteName();
$identifier = Mage::getSingleton('cms/page')->getIdentifier();
if($routeName == 'cms' && $identifier == 'home') {
echo $this->getLayout()->createBlock('cms/block')->setBlockId('google_code_block')->toHtml();
} else {


If you are performing an experiment on a page other the home page you will need to change the $identifier string to match your page identifier which is your URL key. You will also need to change the Block ID if you have called your code block something different.

Step 3 – Disable the code block on your variation pages
Set up the variations of your CMS page and in the Layout Update XML part of the Design tab paste the following XML code:
<reference name="head">
<remove name="google_code" />

This will stop the code block from loading on the variation pages as per Google’s instructions.

Step 4 – Verify it all works in Google Analytics!
Check it all works in GA and start your experiment.

I’ve yet to work out a way to perform experiments on category pages without creating a brand new category containing the same products.

Using Alexa for visitor demographics

Alexa often gets bad press for it’s inaccurate statistics but in many cases it’s surprisingly accurate. A quick look at the Traffic Details from Alexa for The Sensualist shows that not only do they have the top keywords exactly the same as Google Analytics reports them but I also discovered some useful marketing data. Alexa shows basic demographic data for your visitors in a series of basic graphs. A quick look will show you the Age, Gender, Education, Browsing Location (home or work) and whether your visitors have children or not, relative to the general Internet browsing population. In The Sensualist’s case you can see that males are under-represented, eg the site attracts mainly females, which is good for a lingerie site and that, understandably, most people visit the site from their home computer.

So it seems that whilst the traffic stats may be out the other data seems pretty much on the money and is worth a look if you’re after some free demographics information.

Google updates Analytics Dashboard

Google has updated it’s already excellent Analytics package with a makeover of the Accounts Overview page. Once you’ve logged in you’ll be greeted with a list of all your Analytics accounts in one easy to reads table with quick access to comparison data such as increases or decreases in visitor numbers, bounce rates, conversions, goals, etc. Each view can be customized to show comparisons by day, week, month or year. You can also filter the view to show only websites you’ve “starred”, eg: you click on the star icon to select them instead of those boring checkboxes.

The screenshot below shows the new look interface: