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 optimizely.data.state.variationIdsMap[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).
Solved! Go to Solution.
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.
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)
Analytics and Testing Guru