Reputation: 4066
I am trying to set a GA's custom dimension in my code. I know the most straightforward way to do it would be:
ga("set", "dimension1", "1");
However, I don't have access to ga()
where I want to set this dimension. As a result, I tried the following lines:
_gaq.push(["_set", "dimension1", "1"]);
_gaq.push(["_setCustomVar", 1, "dimension1", "1"]);
The first one doesn't work at all, and the second one sets a custom variable, not a custom dimension.
I cannot find any reference to an hypothetical _setCustomDimension()
function in GA documentation, and nothing about dimensions in ga.js either.
Is there a solution to that?
Upvotes: 4
Views: 1573
Reputation: 32760
No. There are no custom dimensions in ga.js, you need to switch your property to Universal Analytics (or use custom variables instead).
I admit it's a bit confusing that alle versions of Google Analytics use the same user interface - there are some menu items that apply only to certain versions (or certain setups for certain versions).
Upvotes: 3