I am setting up some custom variables with Google Analytics using _setCustomVar
. I have seen some documentation (not official) that uses the syntax P1:P2:P3
to populate the value of a custom variable. I cannot find conclusive evidence in the Google Developers documentation that suggests that the value of P1:P2:P3
will be a string concatenated copy of Golf:Player:Scottish
- is this the case?
_gaq.push(['_setCustomVar',
3,
‘P1',
‘Golf’,
3
]);
_gaq.push(['_setCustomVar',
4,
‘P2',
‘Player’,
3
]);
_gaq.push(['_setCustomVar',
5,
‘P3',
‘Scottish’,
3
]);
_gaq.push(
['_setAccount', 'UA-123456-1'],
['_setCustomVar', 1, 'Category', 'P1:P2:P3']
);
AFAIK custom variable names are arbitrary and can be anything (within the core syntax limits, eg: 128 char limit, etc..), GA does not offer this sort of feature. However, I have seen certain Content Management and Template Systems (or plugins of them) do this sort of thing, or similar in principle. But they have separate code to parse for the "placeholder" values and output real values (or js variables holding he values) so that the actual value is passed to GA's _setCustomVar method, not the placeholder value.
It would be nice if GA implemented something like this though. I have seen this sort of thing in other tracking scripts (for instance, Omniture's SiteCatalyst has this sort of thing, they call it "dynamic variables". SiteCatalyst also lets you dynamically pop variables within their interface with either a processing or vista rule).
So it wouldn't be terribly hard for GA to implement. So they could bake it into their on-page coding and/or do it within the interface (probably add onto their filters functionality...it already does this sort of thing in principle to other stuff...).