Using Custom Variables in Google Analytics

IMPORTANT:

This is a historical post from 13 January 2011.

I've been using Custom Variables in Google Analytics since they were released. Custom Variables have solved many problems and put an end to most of the excuses people give me for not using Google Analytics. Most importantly, when trying Custom Variables as a solution, they are really happy with the results!

I would usually write about the coding and the implementation in detail but this time I just want to share some ideas with you of how you can use Custom Variables. Here we go...

1. First and Last Click Attribution

first-click-attribution

first-click-attribution

By default, Google Analytics presents the source and medium of the conversion based on the last click that generated the conversion. However, many people want to know which initial touch point actually generated the purchase, sign-up, download, etc. You can get this kind of information by using Custom Variables at a visitor level.

Imagine you have different campaigns (not only AdWords campaigns) for a specific product. If visitors come to your site for the first time as a result of an email campaign, you could set two Custom Variables; CVSource and CVMedium. To make this work you will need to add a piece of code to check if the Custom Variable is set or not. If the CVSource and CVMedium are not yet set (i.e. undefined), you will need to set them. Otherwise don't do anything.

Now suppose a visitor spends some time on your site but he/she doesn't complete the goal e.g buy the product. Then a few days later, the same visitor comes to your site from a link posted on Twitter and this time he/she completes the purchase. In a normal scenario you would see the purchase came from Twitter which is true but you want to know which campaign generated his/her first visit and maybe analyse why the first one didn't work whereas the second source did.

Using Custom Variables and the technique I outlined above (remember no excuses) you can determine which initial touchpoint started the momentum toward the final conversion. You don't have to give 100% of the credit for the conversion to the last source, you can split it between the first and last source to see which is better and how the campaigns work together.

2. Tracking Website Sections and Categories

Sometimes you have different content to present to visitors and different goals classified by categories in your website. These categories could be presented as part of the menu, lists, sub-menu, etc. You could then set Custom Variables for a session level or in some cases for a visitor level. As a result you can identify the most visited category much more easily than if you filtered by content in your content report in Google Analytics. This also allows you to check which categories are driving more visitors to complete a particular goal and which ones are the most effective categories for converting or completing goals.

3. Segmentation by Type of Information

Tracking Demographics

Many sites use forms to collect information required for purchasing products or services. Awareness of trends in the market and understanding customer/client needs are important to targeting the right audience at the right time with a campaign to promote a product or service.

custom-variables-demographics

custom-variables-demographics

Imagine your marketing team has created two new ads; one targeting young females and the other targeting families. If the customer already has a login and has previously entered information such as age, gender, income and occupation this makes it easy to segment them and target the ads.

Tracking Location

custom-variables-location

custom-variables-location

Not all the classifications defined for a location are available by default in Google Analytics because they are not standard for each country. You can see your reports segmented by Continent, Country/Territory, Sub Continent Region and City but what if you would like to see that information classified by State/Province or by smaller locations inside the City e.g. by suburb. Use Custom Variables! It's up to you to find creative ways of capturing the specific locations your visitors are coming from but if you can access that data you can assign that value to your Custom Variable in a visitor or session scope.

4. Comments and Rating

Some of you might have implemented a plugin or tool to add comments to your articles for example in a blog or to let visitors rate a product or service. You could use Custom Variables to see how many commentators rate your product, service or blog post 'good' or 'bad'.

Let's say you set a Custom Variable called Ratings_Feedback with two values 'Good' or 'Bad'. Then, each time someone rates a particular element in your website the value will be stored in the Custom Variable. You can then look at your reports and find out: how many ratings you have; how many visitors out of the total are using the plugin tool; and how many rate a specific product or service as 'good' or 'bad' etc.

custom-variables-rating

custom-variables-rating

Effectively Using Google Analytics Custom Variables

I have found using Custom Variables very interesting and effective for all sorts of challenges, and great for insights into using the ecommerce tracking code and/or event tracking. My final suggestion before you start implementing Custom Variables across your site is to analyse your needs very carefully. Try to find out first if you can get the data you want to see with the default dimensions and metrics provided by the default Google Analytics reports.

If it is not possible to do it with the standard tracking code, ecommerce tracking code, virtual pageviews and/or event tracking, then take time to define and design the use of Custom Variables. By following my advice (remember no excuses) you are sure to get the right information you need to segment and analyse your data for great results!

I hope you find this blog post motivating. Custom Variables are an excellent feature of Google Analytics, provide many benefits, and will make your reports easier to prepare and more effective!