Google Conversion Room Blog Tips on tracking and improving conversions online

Spotlight on Google Analytics features: Custom variables

Thursday 18 February 2010 | 11:47


Joris said...


Thanks for the interesting post, very helpful information indeed.

It got me thinking into how to organize data inside GA. Let's say you have a website for a large organisation. The organization is divided into departments (about 10), each department is subdivided in offices (about 10 per department). Having custom access to data from each department and/or office is a prerequisite.

This means we need to create an account for each department, and divide each department in offices in the form of profiles. The is also one aggregated account that contains all data (so each page contains two tracking code, one for the department and one for the aggregated account).

The problem here is how to separate the data related to the pages into one profile?
One option is to use filters on a directory ( Since the pages related to an office are scattered around the website, and not logically grouped in the tree structure, this is not an option.
As mentioned in this post, the solution would be to add to each page a custom var (page level) and filter on these to have all office related traffic in one profile. However, currently it is not possible in GA to filter on custom vars, which is really a pitty. I hope they will add this option soon.
The solution to this issue is somewhat complex, but does the trick:
we append in the GA JS code the office name to the title tag of the page, filter on this office to include only this office in one profile, then apply a search and replace filter to remove the office name from the page title so it won't appear in the GA reports. Since we have about 100 different offices some filters need to be created, but since it does the trick fine (i tested it) i guess that's what we need to do.

Any comments and/or suggestions on this are highly welcome.

Thanks again for the good work with this blog, keep it up!

Best regards,

imaginari said...

Thanks for the post, and great usage ideas!
This could be a topic for the one - or for some Help section materials - but could you expand on how to INTERPRET data in custom variable reports? We get visits, hits and time on page, but what does it actually mean for each different type of custom var?


Andy said...

When will profile filters be updated to allow excluding/including traffic based on custom variable values?

Documentation states that _setVar is now deprecated, so how can I use _setCustomVar and exclude internal, dynamic IP traffic with a custom variable of "internal"?

Online Business said...

wow, amazing, i really need to try this out soon. great work guys!

SEO Services India said...

Each analytics package has it's own way of handling custom variables..

Chris said...

Thanks for the explanation. Using straight-forward examples really helps grasp the concept. Once you get the basics, then we can build more complex scenarios. Your examples take it from theory to practical for me.

Dave Lender said...

Can you show how the entire hyperlink code would look? From to ? I'm having problems with getting things in the right place.
Also, does this work with the new asynchronous code?


how do i get my account to be approved?

olast said...

I do miss a php example for custom variables...? ;-)

Rafael Barbolo said...

Something that bothers me is that I want to track what pages each visitor viewed and I can't do it.

I need more than stats on how many hits, views etc. the visitors made.

Can anyone help me with suggestions?

Something I thought that could help was to set a custom_variable that has both the visitor ID and the page path it views. For example:


Then I can see what pages the visitors opened.

Blair Keen said...

What I don't understand is, with Google's increasing desire to understand, track, and value user behaviour, why are custom variables that track these sorts of things more mainstream and accessible for 'regular non-techie' website owners?

Analytics Ninja said...

@Rafael Barbolo

Use your custom variables to set up advanced segments. You'll then be able to see page view in the content report.