Rich-text Reply

Not seeing UA dimension added

stephen-page 09-02-14
Accepted Solution

Not seeing UA dimension added

So we're trying to add Universal analytics to our testing.


The snippet is called first.

The optimizely code is inserted immediately before the ga('send') action. Almost immediately after the snippet call.

This all happens in the header.


Using the ga.debug plugin for Chrome, I'm not seeing the dimension being added. Nor is it showing up in my ga dashboard.


I've tried setting a new dimension and overwriting an old one - neither seems to work.


I AM testing this locally, but the rest of the variation works - why not this part?


michaelwei 09-03-14

Re: Not seeing UA dimension added

Hi Stephen,

Just to double-check, did you enable UA in the "Options" of the experiment? It should be enabled and the right dimension specified in addition to the code you added in order for it to work.

Re: Not seeing UA dimension added

Yes, I did enable UA in the experiment.

Since this is a local test, we have a script that redefines ga and spits every call to it into the console. Thus I can see the dimensions being set, and the pageview being sent. Perhaps the Optimizely code _requires_ a connection to the google server, and thus my debug is breaking it. But I'm assuming all it's doing is spitting out a line of javascript like:
gaq('set', 'dimension10', "Variation #1"]);

Re: Not seeing UA dimension added

I should clarify that response - when I didn't see the dimension being set with my debug code, I turned it off and used the Chrome GA debug plugin (so it was actually sending to GA) - still no joy.
michaelwei 09-05-14

Re: Not seeing UA dimension added

Optimizely doesn't require a connection to the google server, you're right in that it just adds a value to the gaq or ga object. You mentioned your script redefines ga - does it check to see if ga exists first? With something like this:


var _gaq = _gaq || [];

If it doesn't, it might be overwriting the custom dimension that Optimizely had set. 


Re: Not seeing UA dimension added

[ Edited ]

No, and it shouldn't need to. Besides, I immediately added that I've checked it with the debug on and off...and it doesn't work either way.


In the source it looks like this:

Screen Shot 2014-09-05 at 12.57.37 PM.png



Everything appears to be in order, my debug and Google Analytics show all our other dimensions getting passed, but the variation is not.

michaelwei 09-06-14

Re: Not seeing UA dimension added

Is the experiment running? If the experiment you're looking for isn't running, then it won't show up at all.


What should happen is that the optimizely.push('activateUniversalAnalytics') push will take the experiment data, if available, and push that to the GA Dimension value you set in the experiment options.


A couple things to do:

1. Confirm the experiment is alive by running "optimizely.activeExperiments" in the console?

2. Look at the GA debug console printout and see if there's a ga('set', 'dimension10', 'Variation###'). If there is, then it's working but something is not lining up. If there isn't, then it isn't getting run at all


Also, just wanted to point out since you had it circled as well, that 3rd line in your code with 'setDimensionValue' is for an Optimizely Dimension, which is used for dimensions within Optimizely, and doesn't have anything to do with Google Analytics.