Rich-text Reply

Optimizely global object's schema

arthurkuk 11-01-16
Accepted Solution

Optimizely global object's schema



I'm working on integration of Optimizely with our web analytics system and I currently need to extract data from global optimizely object to send it along events. Problem is that I also need to know precise data types and I'm keep wondering why do[activeExperiment] values have Array<String> datatype, whereas it always (really always?) contains single value?


Also, can I be sure that activeExperimentId and variationId will always be Integers (they're seems to be always stringified integers).



robertchan 11-01-16

Re: Optimizely global object's schema

I don't quite understand the first part of your question, but you can use typeof in your browser console to determine whether you're getting integers. To "always" determine whether this is the case, you can set a conditional around whatever code would follow in the case you desire. So something along the lines of if(typeof activeExperimentId === 'integer') etc.
Robert Chan

Experimentation Hero
arthurkuk 11-02-16

Re: Optimizely global object's schema

Hello Robert,

Thanks for your reply. Problem here is that I need precise type not in runtime, but to create Redshift (columnar SQL DB) table. In order to do that I need to know whether "variationIdsMap[activeExperiment]" can be array with more than one value (because from my understanding we always have a single variation there).

I need this because I need to decide how to store data received from optimizely. It could be either VARCHAR(256) if this is array of more than one value or BIGINT if this is always single-element (which is stringnified integer) array.
JasonDahlin 11-04-16

Re: Optimizely global object's schema

The optimizely.variationIdsMap will contain one Variation ID for each Experiment ID in the object.

Currently, Experiment IDs and Variation IDs are always "all numeric" (large integers in your world).  You should be safe to use BIGINT if that is more efficient for you to use than storing them as text.



optimizely.variationIdsMap for this page contains the IDs of two experiments (4398040989 and 4667460227) and the ID of the variation that I am bucketed into for each experiment (4489110422 and 4664402064).  A user cannot be in more than one variation of an experiment at the same time, so the array will always be a single value (curious why they went with an array if it is always this way... maybe it's part of a future flexibility that allows for a single multi-part experiments - like, one experiment that randomly splits users into multiple variations where each variation does something different - like one updates the headline, one updates the image, and one updates the call to action)


This page's experiments and variations

--Jason Dahlin
Analytics and Testing Guru Smiley Happy

Experimentation Hero