Skip to content

Instantly share code, notes, and snippets.

@Danny-Driscoll
Danny-Driscoll / sc_integration.html
Created August 30, 2016 03:07 — forked from brendanorourke/sc_integration.html
Optimizely: Single eVar SC integration
<script type="text/javascript">
/*
* The code below should be executed on every page.
* It will cycle through variationMap, prune only those that are still active,
* and concatenate "{{experiment_id}}:{{variation_index}}" into the eVar #
* you pass as an argument.
**/
function setOptimizelyTestMapToEvar(e) {
if ("undefined" != typeof window["optimizely"]) {
var allTests = window["optimizely"].allExperiments