A few months ago Google Analytics released an awesome new feature – Custom Variables.
If you’re new to custom variables, you should read the official Google help page:
And check out the webinar they did recently:
While custom variables are great – you only get 5 of them, or so Google says. There is an undocumented feature that basically gives you as many custom variables as you want. It’s as simple as setting the number of maximum custom variables as you want to use. Here is the Google Analytics function to use:
[important update July 2, 2010]
Omar brought to my attention that when drilling down via the standard GA interface, when you pick a custom variable after the 5th one (in order that is was set, not in the order on the interface) you get an error saying:
In any case it seems that from a functional standpoint creating more than 5 custom variables is fairly limited since currently you can only see the variable names and not the values for slots 6 and up.
The above code sets the maximum number of custom variables to 10.
Here is some complete code that shows you can use all ten custom variables. I tried this myself and it works :)
I haven’t yet tested the limit of how many custom variables you can have, but keep in mind that Google Analytics has a limit of 2048 characters for the entire tracking request so there is a limit.
Also, just a reminder that custom variables are limited to 64 characters in length for the name and the value.
Here is a screenshot which shows the results of the example above:
The “first_touch” custom variable in the screenshot above is set on a different page.
Let me know if you have any questions.