Skip to content

Instantly share code, notes, and snippets.

@vmysla
Created April 5, 2014 23:05
Show Gist options
  • Save vmysla/9999238 to your computer and use it in GitHub Desktop.
Save vmysla/9999238 to your computer and use it in GitHub Desktop.
optimizley beautified (no $)
optimizelyCode = function () {
var DATA = {
"log_host": "log.optimizely.com",
"goal_expressions": {
"791962898": ["^button\\/click\\/get\\_an\\_answer$"],
"789281734": ["^engagement$"]
},
"experiments": {
"792022794": {
"name": "JA14745: [LEAP] Legal SIP page with new JA styles",
"conditions": [{
"values": [{
"match": "substring",
"value": "leap.justanswer.com/static/sip/JA14745/modern"
}, {
"match": "substring",
"value": "leap.justanswer.com/static/sip/JA14745/classic"
}],
"type": "url"
}, {
"only_first_time": true,
"type": "visitor",
"value": "all"
}],
"enabled_variation_ids": ["791992883", "792102888"],
"variation_ids": ["791992883", "792102888"]
}
},
"www_host": "www.optimizely.com",
"public_suffixes": {
"justanswer.com": ["leap.justanswer.com"]
},
"version": "www-master-1400.374919152173152631",
"admin_account_id": 52447594,
"blacklisted_experiments": [130545666, 399230979, 787730774, 245745673, 175273998, 82851860, 62707736, 497170467, 568311845, 545812537, 75130938, 168693824, 68429892, 69097544, 400742473, 137533515, 50098252, 355610701, 146458709, 72347735, 84322394, 190081116, 125866079, 127580268, 165759085, 215345266, 70056056, 86126716, 459860096, 141140097, 643920005, 567980167, 613800072, 627540114, 207743124, 83427484, 96647877, 170533027, 289757350, 97607849, 403181738, 76820658, 121321654, 94463348, 199348411, 69214405, 429142214, 98273480, 275443914, 140746960, 308324561, 86745301, 96975067, 104528095, 121655520, 69961959, 80322793, 139923699, 343740664, 433750267, 189085950, 327770837, 93702403, 69431556, 407640329, 273291533, 129382673, 69953813, 230347033, 297922842, 591501607, 316769331, 212353332, 230345017, 786160010, 77142336, 137427267, 202002756, 547813705, 229286218, 85051725, 179280207, 639230288, 125278550, 180142278, 198666610, 204525941, 405721463, 196325819, 633440650, 89338251, 140488602, 574701975, 230048155, 98304413, 87956549, 77169057, 146803106, 51730843, 94622121, 138068400, 97776055, 87130554, 219736479, 183376317, 785990078, 312583139, 73796032, 177111492, 50055621, 198592968, 197165522, 272392660, 68866517, 346581466, 314900957, 306711006, 168073702, 341752298, 53697003, 655010284, 245406193, 110184948, 175315446, 61051386, 246366716, 590774788, 127599110, 67193358, 53635600, 405330449, 68520471, 146502168, 544610844, 76522013, 101024295, 120277548, 119194161, 208357946, 241795167, 567441985, 560880194, 212671045, 367010379, 711330380, 129292877, 183321167, 145846864, 84017745, 253381836, 349551193, 525110031, 188803677, 68463203, 349790821, 357411430, 154755689, 282905021, 404611696, 442090098, 65665658, 99064445, 64797312, 214897283, 414780041, 198564490, 146500375, 627110540, 83042958, 4603178444128256, 113969812, 251935386, 244331163, 523121308, 779664039, 86688427, 96852654, 582970036, 189868725, 431280823, 79821496, 277834430, 246258368, 94132932, 325851845, 93217482, 180458193, 241820370, 99033649, 176370398, 107653244, 197735146, 5289699975364608, 71269112, 79905533, 595432190, 65645319, 98370315, 206574350, 157895439, 124586768, 49158935, 426890008, 68850458, 210928412, 198435613, 457360165, 309308203, 549571384, 654971712, 230624074, 785890123, 178518866, 227394394, 359820123, 198456166, 87479153, 89324402, 86053747, 168001463, 414090105, 192084864, 576523137, 177136107, 62028680, 701142508, 105534350, 118326167, 582120344, 609151897, 349850522, 74275745, 129341596, 558250924, 69256110, 717650863, 236286903, 481721273, 545530815, 651910083, 69964741, 77149127, 83444681, 166407124, 123317205, 114152407, 70083546, 177107450, 231871653, 309464035, 223876074, 128205803, 195664877, 143076347, 384660479, 199398402, 570100742, 191163403, 225960972, 56349712, 128250899, 61148191, 199449633, 50105179, 429360165, 5801186556903424, 524000300, 93731891, 553260084, 165876791, 203211832, 454880320, 80000069, 144327751, 67800138, 549551181, 61578322, 266656860, 97864801, 398822498, 197071974, 65668205, 86269039, 325117052, 100035776, 105092226, 595260547, 620932229, 161764709, 129350802, 127966356, 221562006, 198675652, 221267103, 177647814, 142101670, 154801319, 110240938, 347991213, 481961501, 68504752, 118246579, 118168756, 121074880, 240413890, 543993028, 312462537, 161311948, 76573905, 233475283, 115055828, 589720789, 98976983, 250209500, 117343782, 214453479, 484990194, 98307318, 167523576, 68109564, 78193917, 198966527, 127411467, 398931212, 101113101, 159726862, 74581264, 338763032, 590130457, 266745114, 68498723, 162622757, 177110310, 101606961, 67771689, 96685356, 137512237, 124693807, 108225840, 101573941, 148842719, 138046784, 354490592, 343420226, 93908299, 69188942, 101119311, 67448145, 145995095, 89779545, 177991003, 179758428, 143052346, 570451300, 348851379, 229410151, 580060523, 159790449, 580820338, 64034707, 198561140, 134803689, 325682558, 125748607, 76086663, 99122568, 278087051, 121265552, 148229530, 79904155, 389210010, 78302622, 325723551, 65629600, 330481066, 6330622880514048, 272479663, 553190833, 69047734, 177909175, 84344250, 167548831, 50087356, 64733591, 214748406, 114343367, 542932426, 61187532, 63548878, 175125971, 233709016, 97005019, 335998429, 146095583, 778462688, 68344400, 229840363, 353631724, 262505044, 60196349, 67788294, 108174860, 166565392, 59215790, 162777689, 141346332, 91129373, 96757278, 64761382, 110196657, 60718633, 138651181, 240111152, 133314097, 93468210, 154672734, 116244026, 64728649, 551960138, 199502775, 61130318, 68075089, 65742418, 118226519, 67765850, 192452187, 157883998, 185269520, 4792135530315776, 345175668, 546690677, 187154044, 188938517, 201369216, 579960449, 168337026, 160437897, 266086028, 96997006, 670410384, 114204310, 315614871, 190037657, 259512944, 137086161, 125329067, 193951406, 177419954, 593970873, 96235199, 6542919892729856, 301389506, 577081028, 78065352, 121716435, 117454550, 76461787, 145604316, 113184488, 157136508, 301590258, 69197558, 537392893, 91664001, 89808649, 178342871, 48770828, 113458960, 168496913, 197007128, 191149849, 149122010, 652670750, 189966116, 132525865, 582410034, 778923835, 650411840, 116911940, 112604998, 50610003, 141371024, 187273786, 251420516, 121702245, 188221289, 75280235, 110169972, 576860021, 345436022, 124637048, 203830309, 133392704, 146104206, 536420243, 140775320, 335470489, 540522394, 308783004, 146925470, 141879199, 197179297, 58929059, 141295524, 754775973, 758566824, 376930221, 110022574, 168492977, 146714547, 292923317, 145590198, 83840951, 308543419, 99108800, 316227522, 346881991, 221683667, 157879564, 96952279, 571271129, 280590306, 83288036, 603920357, 139736401, 138581992, 91117564, 214775793, 315828211, 113995764, 406511609, 69080063, 213739516, 114264062, 93747199],
"project_id": 794920136,
"revision": 4,
"installation_verified": true,
"api_host": "api.optimizely.com",
"variations": {
"792102888": {
"code": "$(document).ready(function() { $('.header-title').title='JustAnswer'; });",
"name": "Modern"
},
"791992883": {
"code": "$(document).ready(function() { $('#JA_siteLogo').title='JustAnswer Law'; });",
"name": "Classic"
}
},
"segments": {
"787614865": {
"name": "Browser",
"segment_value_type": "browser",
"api_name": "optimizely_browser",
"id": 787614865
},
"794920138": {
"name": "Campaign",
"segment_value_type": "campaign",
"api_name": "optimizely_campaign",
"id": 794920138
},
"786379268": {
"name": "Mobile Visitors",
"segment_value_type": "mobile",
"api_name": "optimizely_mobile",
"id": 786379268
},
"794920137": {
"name": "Source Type",
"segment_value_type": "source_type",
"api_name": "optimizely_source_type",
"id": 794920137
}
},
"click_goals": [{
"event_name": "button/click/get_an_answer",
"experiments": {
"792022794": true
},
"selector": ".get-an-answer"
}]
};
var optly = {
nativity: {}
};
optly.nativity.getNativeGetElementsByClassName = function () {
var a = document.getElementsByClassName;
if (!optly.nativity.isNativeFunction(a)) var a = (window.optimizely || {}).getElementsByClassName,
b = (window.optly || {}).getElementsByClassName, a = optly.nativity.isNativeFunction(a) ? a : optly.nativity.isNativeFunction(b) ? b : null;
return a
};
optly.nativity.isNativeFunction = function (a) {
return a && -1 !== String(a).indexOf("[native code]")
};
optly.Cleanse = {};
optly.Cleanse.each = function (a, b, d) {
var h = !! Object.prototype.__lookupGetter__,
e = !! Object.prototype.__lookupSetter__,
c;
for (c in a)
if (a.hasOwnProperty(c)) {
var f = h ? a.__lookupGetter__(c) : null,
g = e ? a.__lookupSetter__(c) : null;
try {
b.call(d, c, !f ? a[c] : null, f, g)
} catch (i) {}
}
};
optly.Cleanse.finish = function () {
if (optly.Cleanse.running) {
optly.Cleanse.running = !1;
optly.Cleanse.each(optly.Cleanse.types, function (a, d) {
Object.prototype.__defineGetter__ && optly.Cleanse.each(optly.Cleanse.getters[a], function (c, b) {
d.prototype.__defineGetter__(c, b);
optly.Cleanse.log("restored getter", a, c)
});
Object.prototype.__defineSetter__ && optly.Cleanse.each(optly.Cleanse.setters[a], function (c, b) {
d.prototype.__defineSetter__(c, b);
optly.Cleanse.log("restored setter", a, c)
});
optly.Cleanse.each(optly.Cleanse.properties[a],
function (b, f) {
d.prototype[b] = f;
optly.Cleanse.log("restored property", a, b)
})
});
optly.Cleanse.unfixGetElementsByClassName();
optly.Cleanse.log("finish");
var a = window.console;
if ((-1 !== window.location.hash.indexOf("optimizely_log=true") || -1 !== window.location.search.indexOf("optimizely_log=true")) && a && a.log)
for (var b = optly.Cleanse.logs, d = 0; d < b.length; d++) a.log(b[d])
}
};
optly.Cleanse.log = function (a, b, d) {
b ? (b = b.replace(/_/g, ""), optly.Cleanse.logs.push("Optimizely / Info / Cleanse / " + a + ": " + b + "." + d)) : optly.Cleanse.logs.push("Optimizely / Info / Cleanse / " + a)
};
optly.Cleanse.start = function () {
var a = window.location.hostname;
if (!(-1 !== a.indexOf("optimizely") && -1 === a.indexOf("edit") && -1 === a.indexOf("preview") && -1 === a.indexOf("test")))
if (optly.Cleanse.running) optly.Cleanse.log("already running so didn't start");
else {
optly.Cleanse.log("start");
optly.Cleanse.running = !0;
for (var b in optly.Cleanse.types) optly.Cleanse.types[b] || delete optly.Cleanse.types[b];
optly.Cleanse.each(optly.Cleanse.types, function (a, b) {
optly.Cleanse.getters[a] = {};
optly.Cleanse.properties[a] = {};
optly.Cleanse.setters[a] = {};
optly.Cleanse.each(b.prototype, function (e, c, f, g) {
optly.nativity.isNativeFunction(c) || optly.nativity.isNativeFunction(f) || optly.nativity.isNativeFunction(g) ? optly.Cleanse.log("ignore native code", a, e) : (f ? (optly.Cleanse.getters[a][e] = f, optly.Cleanse.log("cleansed getter", a, e)) : (optly.Cleanse.properties[a][e] = c, optly.Cleanse.log("cleansed property", a, e)), g && (optly.Cleanse.setters[a][e] = g, optly.Cleanse.log("cleansed setter", a, e)), delete b.prototype[e])
})
});
optly.Cleanse.fixGetElementsByClassName();
optly.Cleanse.hasRunStart = !0
}
};
optly.Cleanse.fixGetElementsByClassName = function () {
if (!optly.nativity.isNativeFunction(document.getElementsByClassName)) {
var a = optly.nativity.getNativeGetElementsByClassName();
a ? (optly.Cleanse.getElementsByClassName = document.getElementsByClassName, document.getElementsByClassName = a) : optly.Cleanse.log("Error: native HTMLElement.prototype.getElementsByClassName missing")
}
};
optly.Cleanse.unfixGetElementsByClassName = function () {
optly.Cleanse.getElementsByClassName && (document.getElementsByClassName = optly.Cleanse.getElementsByClassName, optly.Cleanse.getElementsByClassName = null)
};
optly.Cleanse.getElementsByClassName = null;
optly.Cleanse.getters = {};
optly.Cleanse.logs = [];
optly.Cleanse.properties = {};
optly.Cleanse.setters = {};
optly.Cleanse.types = {
HTMLElement_: window.HTMLElement,
Object_: Object
};
window.optly = window.optly || {};
window.optly.Cleanse = {
finish: optly.Cleanse.finish,
logs: optly.Cleanse.logs,
start: optly.Cleanse.start
};
optly.Cleanse.start();
var $ = jQuery;
function h(a) {
throw a;
}
var i = void 0,
k = !0,
m = null,
n = !1;
function ba() {}
function ca(a, b, c) {
return a.call.apply(a.bind, arguments)
}
function da(a, b, c) {
a || h(Error());
if (2 < arguments.length) {
var d = Array.prototype.slice.call(arguments, 2);
return function () {
var c = Array.prototype.slice.call(arguments);
Array.prototype.unshift.apply(c, d);
return a.apply(b, c)
}
}
return function () {
return a.apply(b, arguments)
}
}
function o(a, b, c) {
o = Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? ca : da;
return o.apply(m, arguments)
}
function ea(a, b) {
var c = Array.prototype.slice.call(arguments, 1);
return function () {
var b = Array.prototype.slice.call(arguments);
b.unshift.apply(b, c);
return a.apply(this, b)
}
};
var fa = n,
ha = 0,
q = {};
function t(a) {
fa && (ha++, q[a] = q[a] || 0, q[a]++)
}
function ia() {
if (!fa || 0 === ha) return "";
var a = ["_id_:" + Math.floor(1E3 * Math.random()), "_T_:" + ha],
b = 0,
c;
for (c in q)
if (q.hasOwnProperty(c) && 0 < q[c] && (a.push(c + ":" + q[c]), b++, 20 === b)) break;
return encodeURIComponent(a.join(","))
};
function ja(a, b, c) {
var d = a.split("?");
if (d[1]) {
var e = [];
$.each(d[1].split("&"), function () {
0 !== this.indexOf(ka) && e.push(this)
});
d[1] = e.join("&");
a = d.join("?")
}
switch (c) {
case "exact":
return a = la(a), a === la(b);
case "regex":
try {
return Boolean(a.match(b))
} catch (f) {
return t("sm1"), n
}
case "simple":
return a = la(ma(a)), b = la(ma(b)), a === b;
case "substring":
return a = la(a, k), b = la(b, k), -1 !== a.indexOf(b);
default:
return n
}
}
function ma(a) {
var b = a.indexOf("?"); - 1 !== b && (a = a.substring(0, b));
b = a.indexOf("#"); - 1 !== b && (a = a.substring(0, b));
return a
}
function la(a, b) {
var a = a.replace("/?", "?"),
a = a.toLowerCase().replace(/[/&?]+$/, ""),
c = na.slice(0);
b || (c = c.concat(oa));
for (var d = c.length, e = 0; e < d; e++) a = a.replace(RegExp("^" + c[e]), "");
return a
}
var na = ["https?://.*?.?optimizelyedit.(com|test)/", "https?://.*.?optimizelypreview.(com|test)/", "https?://(edit|preview)(-hrd|-devel)?.optimizely.(com|test)/", "https?://.*?.?optimizelyedit(-hrd)?.appspot.com/", "https?://"],
oa = ["www."],
ka = "optimizely_";
function pa(a) {
a = a || {};
if (u) {
a && a.sVariable && (qa = a.sVariable);
var b = qa || ("undefined" !== typeof window.s ? window.s : m);
if (b)
if (ra) {
if ((a = sa) && b) try {
w("Integrator", "Fixing SiteCatalyst referrer to %s", a), b.referrer = String(a)
} catch (c) {
w("Integrator", "Error setting SiteCatalyst referrer: %s", c)
}
w("Integrator", "Tracking with SiteCatalyst");
x(ta(), function (a) {
var c = y(a),
a = z(c, a, 100, 100, 25, k),
f = a.key + ": " + a.value,
a = [],
g = A(c, "site_catalyst_evar") || m,
c = A(c, "site_catalyst_prop") || m;
g !== m && a.push("eVar" + g);
c !==
m && a.push("prop" + c);
x(a, function (a) {
w("Integrator", "Setting SiteCatalyst %s='%s'", a, f);
b[a] = f
})
})
} else ua = k;
else B("Integrator", "Error with SiteCatalyst integration: 's' variable not defined")
}
}
function va(a) {
a = xa(a) ? Number(a) : -1;
if (-1 !== [1, 2, 3].indexOf(a)) ya = a;
else return ya
}
function za() {
if (u) {
var a = sa;
if (a) try {
w("Integrator", "Fixing _gaq._setReferrerOverride with %s", a), _gaq.push(["_setReferrerOverride", a])
} catch (b) {
w("Integrator", "Error setting Google Analytics referrer: %s", b)
}
x(ta(), function (a) {
var b = y(a);
if (A(b, "chartbeat")) {
var c = Aa;
Aa = "";
var g = z(b, a, 10, 10, 5, n);
Aa = c;
c = Ba(a);
Ca = g.key + ": " + String(c);
try {
w("Integrator", "Calling _cbq.push"), _cbq.push(["_optlyx", Ca])
} catch (j) {
B("Integrator", "Error sending Chartbeat data for " + D(b))
}
}
if (A(b, "crazyegg")) {
g = z(b, a, 100,
100, 15, n);
try {
w("Integrator", "Defining CE_SNAPSHOT_NAME"), window.CE_SNAPSHOT_NAME = g.key + ": " + g.value
} catch (l) {
B("Integrator", "Error sending CrazyEgg data for " + D(b))
}
}
if (Da(b)) {
g = Da(b);
c = 0;
F(g) && (c = g.slot || c);
var g = c,
c = Da(b),
p = "";
F(c) && (p = c.tracker || p);
c = p;
p = z(b, a, 28, 24, 5, k);
try {
var r = "";
"" !== c && (r = c + ".");
w("Integrator", "Calling _gaq._setCustomVar for slot %d and scope %d", g, ya);
_gaq.push([r + "_setCustomVar", g, p.key, p.value, ya])
} catch (v) {
B("Integrator", "Error sending Google Analytics data for " + D(b))
}
}
if (G("kissmetrics")) {
g =
z(b, a, 100, 100, 15, k);
c = {};
c[g.key] = g.value;
try {
w("Integrator", "Calling _kmq.set"), _kmq.push(["set", c])
} catch (E) {
B("Integrator", "Error sending KISSmetrics data for " + D(b))
}
}
if (A(b, "mixpanel")) {
g = z(b, a, 100, 100, 15, n);
c = {};
c[g.key] = g.value;
try {
w("Integrator", "Calling mixpanel.push"), mixpanel.push(["register", c])
} catch (aa) {
B("Integrator", "Error sending Mixpanel data for " + D(b))
}
}
if (Fa(b, "acct_no")) {
g = Fa(b, "acct_no");
c = Fa(b, "url");
p = z(b, a, 28, 24, 5, k);
a = c + "/hit.xiti?s=" + g + "&abmvc=" + (b + "[" + encodeURIComponent(p.key) +
"]-0-" + a + "[" + encodeURIComponent(p.value) + "]") + "&type=mvt";
try {
w("Integrator", "Sending AT Internet log call for account %s", g), Ga(a, m)
} catch (Ea) {
B("Integrator", "Error sending AT Internet data for " + D(b))
}
}
});
a = H("optimizelyChartbeat") || "";
try {
if (a && Ca != a && (w("Integrator", "Calling _cbq.push for referral"), _cbq.push(["_optlyr", a])), Ca != a) w("Integrator", "Set new Chartbeat referral cookie."), I("optimizelyChartbeat", Ca)
} catch (c) {
B("Integrator", "Error sending Chartbeat referral for " + a)
}
ra = k;
Ha && (Ia(), Ha =
n);
ua && (pa(), ua = n)
}
}
function Ja() {
if (window.ClickTaleContext) {
try {
window.ClickTaleContext.getAggregationContextAsync("1", function (a) {
a.Location && window.optimizely.push(["overrideUrl", a.Location]);
for (var b in a.PageEvents) {
var e = a.PageEvents[b][2].match(/x[0-9]+=[0-9_]+/g);
w("Integrator", "Playback ClickTale Integration - %s", e);
for (b = 0; b < e.length; b++) {
w("Integrator", "Playback ClickTale Integration - %s", e[b]);
for (var f = e[b].split("=")[0].substr(1), g = e[b].split("=")[1].split("_"), j = 0; j < g.length; j++) Ka(g[j]) ? w("Integrator",
"Skip activation for redirect.") : window.optimizely.push(["activate", f, g[j], {
force: k
}])
}
}
})
} catch (a) {
w("Integrator", "Playback ClickTale Aggregation Integration failed.")
}
try {
window.ClickTaleContext.getRecordingContextAsync("1.1", function (a) {
if (a.inSingleRecordingScope) {
a.location && window.optimizely.push(["overrideUrl", a.location]);
w("Integrator", "Playback ClickTale getRecordingContextAsync callback");
for (var b in a.fields) w("Integrator", "Playback ClickTale Integration - %s=%s", b, a.fields[b]), Ka(a.fields[b]) ?
w("Integrator", "Skip activation for redirect.") : window.optimizely.push(["activate", b, a.fields[b], {
force: k
}])
}
})
} catch (b) {
w("Integrator", "Playback ClickTale Recording Integration failed.")
}
} else w("Integrator", "ClickTaleContext not defined.")
}
function La() {
w("Integrator", "Tracking with ClickTale.");
"function" == typeof window.ClickTaleField ? x(ta(), function (a) {
var b = y(a),
c = z(b, a, 100, 100, 15, n),
c = c.key + ": " + c.value + " (x" + b + "=" + a + ")";
w("Integrator", "Setting ClickTale - %s", c);
window.ClickTaleField(b, a);
window.ClickTaleEvent(c)
}) : w("Integrator", "ClickTaleField() not defined.")
}
function Ma(a) {
Aa = a
}
function Na(a) {
qa = a
}
function Oa(a, b) {
return a.replace(/[^a-zA-Z0-9\.\~\!\*\(\)\']+/g, "_").substring(0, b)
}
function ta() {
var a = Pa.concat(J),
b = [];
x(Qa(), function (c) {
var e = y(c),
f = n;
if (Ra(e)) {
var g = Sa(c);
Ta(a, e) && (w("Integrator", '"%s" relevant because experiment active', g), f = k);
f && b.push(c)
}
});
var c = Ua;
c && b.push(c);
return b
}
function Ka(a) {
return (a = Va(Wa(a))) ? a[1] : m
}
function Ia() {
if (u)
if (ra) {
var a = sa;
if (a) try {
w("Integrator", "Fixing Universal Analytics set referrer with %s", a);
for (var b = ga.getAll(), c = 0; c < b.length; ++c) b[c].set("referrer", a)
} catch (d) {
w("Integrator", "Error setting Universal Analytics referrer: %s", d)
}
w("Integrator", "Tracking with Universal Analytics");
x(ta(), function (a) {
var b = F(window.ga) ? window.ga : m,
c = y(a);
if (Xa(c, "slot")) {
var d = Xa(c, "slot"),
l = Xa(c, "tracker"),
p = z(c, a, 100, 100, 25, k),
a = p.key + " (" + c + "): " + p.value;
150 < a.length && (a = p.key.substring(0,
80) + " (" + c + "): " + p.value, a = a.substring(0, 149));
c = l ? l + "." : "";
w("Integrator", "Calling ua set dimension - ga(%sset, dimension%d, %s)", c, d, a);
b(c + "set", "dimension" + d, a)
}
})
} else Ha = k
}
function z(a, b, c, d, e, f) {
a = Aa + (A(a, "name") || "");
b = Ya(b);
1 < b.length ? (b = $.map(b, function (a) {
return a.substr(0, e - 1)
}), b = b.join("~")) : b = b[0];
f ? (a = Oa(a, c), b = Oa(b.replace("#", ""), d)) : (a = a.substring(0, c), b = b.substring(0, d));
return {
key: a,
value: b
}
}
var Ha = n,
ua = n,
Ca = "",
ya = 2,
ra = n,
Aa = "Optimizely ",
qa = m;
var Za, $a;
function ab(a, b, c) {
if (!K) return n;
var d = "number" === typeof b || "string" === typeof b ? String(b) : m,
e = b === k || b && b.force === k || c && c.force === k,
c = ("object" === typeof b ? b : c) || {}, f = c.skip === k,
b = c.skipPageview === k,
g = c.enabledStatus;
if (d) try {
bb(a, d, k)
} catch (j) {
B("API", "Error while activating experiment " + a + " for variation " + d + " -- proceeding without bucketing user."), t("a1")
}
var l = m,
p = [],
r = [];
xa(a) ? p.push(a) : x(cb(), function (a) {
db(a) && p.push(a)
});
B("API", "Testing experiments to activate");
x(p, function (a) {
if (!e && !eb(a)) fb(a);
else if (e || gb(a, {
manualMode: k,
objectType: "experiment",
enabledStatus: g,
visitor: L
}))(l = hb(a, f)) && r.push(a)
});
ib(r, p);
jb();
za();
K && !b && M(document.location.href, "pageview")
}
function kb() {
if (!K) return n;
B("API", "Testing geodelayed segments");
x(lb, function (a) {
mb(a)
});
var a = m,
b = nb,
c = [];
B("API", "Testing geodelayed experiments");
x(b, function (b) {
gb(b, {
manualMode: k,
objectType: "experiment",
visitor: L
}) && (a = hb(b)) && c.push(b)
});
ib(c, b);
jb();
za();
K && !ob && M(document.location.href, "pageview");
nb = [];
lb = [];
window.optimizelyGeo = {};
pb("Geo Activating");
return k
}
function fb(a) {
qb("Geo Activating");
nb.push(a)
}
function rb(a, b) {
var c = sb(a) || a,
d = tb()[c];
d ? d.audience_id ? L.p(d.audience_id, n) : d.dimension_id ? L.n(d.dimension_id, b || k) : ub(c, b) : B("API", "Unable to find segment: " + c)
}
function bb(a, b, c) {
vb = k;
K && c !== k && M(document.location.href);
var a = String(a),
b = String(b),
d = m,
e = b.split("_"),
f = wb(a),
b = f && 0 !== f.length;
if ("-1" === e[0]) {
c = a;
xb[c] && delete xb[c];
yb[c] && delete yb[c];
for (e = 0; e < N.length; e++) N[e].k === c && N.splice(e, 1);
zb()
} else if (b && e.length == f.length) d = [], x(e, function (a, b) {
256 >= Number(a) ? d.push(Ab(f[b])[a]) : d.push(a)
}), d = d.join("_");
else if (!b && 1 == e.length && 256 >= Number(e[0])) {
var c = String,
e = e[0],
g = Bb(a),
j = m;
try {
j = g[e]
} catch (l) {
t("d1")
}
d = c(j)
} else 1 == e.length ? d = e[0] : B("API",
"Error: could not bucket user. Unknown arguments.");
d && (b && Cb(a, d) ? (b = d, c = Cb(a, b), Db[a] = Db[a] || {}, Db[a][c] = b, B("Distributor", "Preferring variation partial " + b + " of section " + c + " of experiment " + a), a = Eb(a), 1 === a.length && Fb(a[0], "api.bucketUser", k)) : Fb(d, "api.bucketUser", k));
jb()
}
function Gb(a) {
a && "tracking" === a || (K = n);
u = n
}
function Hb() {
B("API", "Finalizing API.");
Ib();
Za = k
}
function Jb(a, b) {
var c = [],
d = b;
O(b) && (c = Kb(b, 1), d = b[0]);
var e = a[d];
e ? (B("API", 'Called function "' + d + '"'), e.apply(m, c)) : B("API", 'Error for unknown function "' + d + '"');
Lb()
}
function Mb(a, b) {
Za ? B("API", "Error: can't add custom tags after Optimizely loads") : ($a = $a || {}, 2 == arguments.length ? $a[a] = b : 1 == arguments.length && $.extend(k, $a, a))
}
function Nb(a, b) {
var c = sb(a) || a,
b = F(b) ? b : k,
d = tb()[c];
d ? d.audience_id ? L.w(d.audience_id, n) : d.dimension_id ? L.n(d.dimension_id, m) : Ob(c, b) : B("API", "Unable find segment for: " + c)
}
function Pb() {
var a = R(tb());
x(a, function (a) {
Nb(a, n)
});
Qb()
}
function Ib() {
Rb = {};
Sb = {};
Tb = {};
x(Qa(), function (a) {
var b = y(a);
Rb[b] = a.split("_");
Sb[b] = Ba(a);
Tb[b] = Sa(a)
});
S = {
experiments: {},
sections: {},
segments: {},
state: {},
variations: {},
visitor: {}
};
S.customTags = $a;
for (var a = cb(), b = 0; b < a.length; b++) {
var c = a[b],
d = {};
d.code = A(c, "code") || "";
d.name = A(c, "name") || "";
d.manual = db(c);
d.section_ids = wb(c);
d.variation_ids = Bb(c);
S.experiments[c] = d
}
a = R(tb());
for (b = 0; b < a.length; b++) c = a[b], S.segments[c] = {
name: Ub(c, "name") || ""
};
a = R(G("sections") || {});
for (b = 0; b < a.length; b++) c = a[b],
d = {}, d.name = G("sections", c, "name") || "", d.variation_ids = Ab(c), S.sections[c] = d;
a = R(G("variations") || {});
for (b = 0; b < a.length; b++) c = a[b], d = {}, d.name = Sa(c), d.code = Wa(c), S.variations[c] = d;
a = {};
b = Vb();
a.browser = {
ff: "Firefox",
ie: "Internet Explorer",
safari: "Safari",
gc: "Google Chrome",
opera: "Opera"
}[b] || "";
a.location = Wb();
a.ip = Xb();
a.params = {};
c = Yb();
c.reverse();
b = 0;
for (d = c.length; b < d; b++) try {
a.params[Zb(c[b][0])] = Zb(c[b][1])
} catch (e) {
B("API", "Failed to decode parameter " + c[b][0] + "=" + c[b][1]), t("a2")
}
a.referrer =
String(document.referrer);
a.segments = $b();
a.mobile = "unknown" !== ac();
a.os = bc();
a.dimensions = L.d;
a.audiences = L.b;
S.visitor = a;
b = {};
b.activeExperiments = Pa || [];
b.variationIdsMap = Rb;
b.variationMap = Sb;
b.variationNamesMap = Tb;
S.state = b;
cc(window.optimizely, {
activeExperiments: Pa,
allExperiments: dc(),
all_experiments: dc(),
data: S,
variationIdsMap: Rb,
variationMap: Sb,
variationNamesMap: Tb,
variation_map: Sb
})
}
function ec(a) {
if (!xa(a)) return n;
fc = Number(a)
}
function gc() {
hc = k
}
function ic(a) {
var b = "";
"number" !== typeof a ? (b = "must be a number.", a = 31536E4) : a = Math.floor(86400 * a);
7776E3 > a && (b = "less then minimum.", a = 7776E3);
B("API", (b && "Days argument " + b) + " Cookie expiration set to " + a + " seconds.");
jc = a;
kc()
}
function lc() {
ob = k
}
var S = {}, nb = [],
lb = [],
Rb = {}, Sb = {}, Tb = {}, L = m;
function hb(a, b) {
var b = b === k,
c, d = m;
x(N, function (b) {
a == b.k && (d = b.id)
});
if ((c = d) && 0 < c.length) return B("Distributor", "Not distributing experiment " + a + " (already in plan)"), k;
if (b || a in xb) return B("Distributor", "Not distributing experiment " + a + " (is ignored)"), n;
c = A(a, "enabled_variation_ids") || [];
if (0 === c.length) return B("Distributor", "Permanently ignoring experiment " + a + " (no enabled variations)"), mc(a), n;
var e = A(a, "ignore") || 0;
if (e > Math.floor(100 * Math.random())) return B("Distributor", "Permanently ignoring experiment " +
a + "(" + e + "% likelihood)"), mc(a), n;
e = c;
Db[a] !== i && (B("Distributor", "Taking into account bucketUser variations for experiment " + a), e = Eb(a));
var f;
f = e;
var g = [],
j = A(a, "variation_weights") || {};
x(f, function (a) {
g.push(j[a])
});
f = nc(g);
e = e[f];
B("Distributor", "Picked variation " + e + " [index " + f + " of " + c.length + "]");
Fb(e, "distributor");
return k
}
function Eb(a) {
var b = [];
x(A(a, "enabled_variation_ids") || [], function (c) {
var d = k,
e;
for (e in Db[a]) - 1 === c.indexOf(Db[a][e]) && (d = n);
d && b.push(c)
});
return b
}
var Db = {};
function Yb() {
var a = window.location.search || "";
0 === a.indexOf("?") && (a = a.substring(1));
for (var a = a.split("&"), b = [], c = 0; c < a.length; c++) {
var d = "",
e = "",
f = a[c].split("=");
0 < f.length && (d = f[0]);
1 < f.length && (e = f[1]);
b.push([d, e])
}
return b
}
function oc() {
for (var a = window.location.search, b, c = /optimizely_([^=]+)=([^&]*)/g, d = {}; b = c.exec(a);) d[b[1]] = Zb(b[2]);
return d
}
var pc = /x(\d+)/;
function qc(a) {
return a && -1 !== String(a).indexOf("[native code]")
};
function Va(a) {
return a.match(/_optimizely_redirect(?:_no_cookie)?=(\S+)/)
}
function rc(a) {
return -1 !== a.indexOf("_optimizely_redirect_no_cookie")
}
function sc(a) {
var a = a || "",
b = H("optimizelyRedirect");
return rc(a) || !b || b && "true" === b.split("|")[1] ? k : n
}
var sa = m,
Ua = "";
function tc() {
var a = window.navigator,
b = a.userAgent,
c = uc([{
id: "gc",
substring: "Chrome",
g: "Chrome"
}, {
id: "safari",
ca: a.vendor,
substring: "Apple",
g: "Version"
}, {
id: "ff",
substring: "Firefox",
g: "Firefox"
}, {
id: "opera",
prop: window.opera,
g: "Opera"
}, {
id: "ie",
substring: "MSIE",
g: "MSIE"
}, {
id: "ie",
substring: "Trident",
g: "rv"
}], b),
d = uc([{
id: "android",
substring: "Android"
}, {
id: "blackberry",
substring: "BlackBerry"
}, {
id: "ipad",
substring: "iPad"
}, {
id: "iphone",
substring: "iPhone"
}, {
id: "ipod",
substring: "iPod"
}, {
id: "windows phone",
substring: "Windows Phone"
}], b),
e = m,
f = c.g;
f && (e = vc(b, f) || vc(a.appVersion, f));
return {
K: c.id || "unknown",
L: e || "unknown",
aa: d.id || "unknown"
}
}
function vc(a, b) {
var c = a.indexOf(b),
d = m; - 1 !== c && (c += b.length + 1, d = parseFloat(a.substring(c)));
return d
}
function uc(a, b) {
return x(a, function (a) {
var d = a.ca || b;
if (d && -1 !== d.indexOf(a.substring) || a.prop) return a
}) || {}
};
var wc = window.OPTIMIZELY_TEST_MODULE,
xc = "com local net org xxx edu es gov biz info fr nl ca de kr it me ly tv mx cn jp il in iq test".split(" "),
yc = /\/\*\s*_optimizely_variation_url( +include="([^"]*)")?( +exclude="([^"]*)")?( +match_type="([^"]*)")?( +include_match_types="([^"]*)")?( +exclude_match_types="([^"]*)")?( +id="([^"]*)")?\s*\*\//;
var fc = 0,
K = k,
zc = n,
hc = n,
T = "",
Ac = n,
U = n,
Bc = n,
vb = n,
ob = n,
u = k,
jc = 31536E4;
function Cc(a) {
var b = a || Dc;
B("Segmenter", "Loading segments cookie.");
if (a = H("optimizelySegments")) {
try {
a = Ec(a)
} catch (c) {
t("s1"), a = {}
}
x(a, function (a, c) {
var d = tb()[a];
B("Segmenter", "Segments cookie contains segment id: " + a);
d && d.audience_id ? b.p(d.audience_id, n) : d && d.dimension_id ? b.n(d.dimension_id, c) : V[a] = c
})
}
B("Segmenter", "Evaluating all segments.");
for (var a = R(tb()), d = 0; d < a.length; d++) {
var e = a[d];
Ub(e, "is_api_only") ? B("Segmenter", "Not doing anything since segment " + e + " is api only.") : (B("Segmenter",
"Testing whether to add to segment " + e), eb(e) ? mb(e) : lb.push(e))
}
Fc.push(kc);
Qb();
B("Integrator", "Loading third-party segments.");
if (window.bk_results) {
a = window.bk_results;
B("Integrator", "Loading BlueKai segments.");
try {
for (var f = a.campaigns, a = 0; a < f.length; a++) ub(f[a].seg_id, k)
} catch (g) {
B("Integrator", "Error loading BlueKai segments.")
}
}
}
function kc() {
var a = {};
x(V, function (b, c) {
c && (a[b] = c)
});
I("optimizelySegments", Gc(a), jc)
}
function ub(a, b) {
a && !isNaN(parseInt(a, 10)) ? (!b && "" !== b && (b = k), V[a] = b, Qb()) : B("Segmenter", "Unable to find segment for ID: " + a)
}
function Qb() {
x(Fc, function (a) {
a()
})
}
function mb(a) {
B("Segmenter", "Evaluating Segment " + a);
var b = gb(a, {
objectType: "segment"
});
Hc(a, "add");
if (b) {
a: {
var c = b = m;
switch (Ub(a, "segment_value_type") || "") {
case "browser":
b = W.A();
c = "unknown";
break;
case "campaign":
b = W.f("utm_campaign");
c = "none";
break;
case "country":
b = W.m().country;
c = "unknown";
break;
case "language":
b = W.q();
c = "none";
break;
case "mobile":
b = "unknown" !== W.D();
break;
case "os":
b = W.T();
c = "unknown";
break;
case "referrer":
b = W.U();
c = "none";
break;
case "source_type":
b = Ic();
c = "direct";
break;
default:
b =
"true";
break a
}
if (b === m) {
if (V.hasOwnProperty(a)) {
b = m;
break a
}
b = c
}
b = Jc(b)
}
b !== m && ub(a, b)
}
}
function Ic() {
var a = W.t();
if (W.f("utm_source") || W.f("gclid") || W.f("otm_source")) return "campaign";
for (var b = ["google\\.\\w{2,3}(\\.\\w{2,3})?/(search|url)", "https://(www)?\\.google\\..*?/$", "bing\\.\\w{2,3}(\\.\\w{2,3})?/(search|url)", "yahoo\\.\\w{2,3}(\\.\\w{2,3})?/search", "baidu\\.\\w{2,3}(\\.\\w{2,3})?/s?"], c = 0; c < b.length; c++)
if (a.match(b[c])) return "search";
return a && Kc(a) !== Kc(W.l()) ? "referral" : m
}
function Lc() {
var a = [];
x(V, function (b, c) {
c && a.push(b)
});
return a
}
function $b() {
var a = {};
x(V, function (b, c) {
c && (a[String(b)] = c)
});
return a
}
function Ob(a, b) {
var c = sb(a) || a;
V[c] ? (V[c] = n, ("undefined" === typeof b || b) && Qb()) : B("Segmenter", "Not removing " + a + ", not found")
}
function Jc(a, b) {
var c, b = F(b) ? b : k;
c = c || Mc;
a = Zb(a);
a = String(a);
b && (a = a.toLowerCase());
a = a.substring(0, c);
return encodeURIComponent(a)
}
var Hc = ba,
Fc = [],
V = {}, Mc = 20;
function Fb(a, b, c) {
var d;
d = n === k;
var c = c === k,
e = n,
f = y(a);
if (f && (c || !Nc(f))) {
e = k;
if (c && Nc(f))
for (c = 0; c < N.length; c++) N[c].k === f && N.splice(c, 1);
N.push({
k: f,
id: a,
source: b
});
d && (J = J || [], J.push(f));
yb[f] = k;
zb();
B("Plan", "Added experiment " + f + " and variation id " + a + " to the plan, source is " + b, k)
}
return e
}
function Nc(a) {
return a in xb || a in yb
}
function Qa(a) {
var b = [],
c = !F(a),
a = a || [];
x(N, function (d) {
(c || Ta(a, d.k)) && b.push(d.id)
});
return b
}
function mc(a) {
var b;
if (b === k || !Nc(a)) xb[a] = k, zb()
}
function jb() {
var a = {};
x(Oc, function (b, c) {
a[b] = c
});
x(N, function (b) {
var c = y(b.id);
a[c] = b.id
});
x(xb, function (b) {
a[b] = "0"
});
x(G("blacklisted_experiments") || {}, function (b) {
b in a && delete a[b]
});
I("optimizelyBuckets", Gc(a), jc)
}
function zb() {
x(Pc, function (a) {
a()
})
}
function Qc(a, b, c, d) {
if (-1 !== a.indexOf("_optimizely_redirect")) b.push({
code: a,
type: "code forced (redirect)",
o: d
});
else {
for (var a = a.split("\n"), e = n, f = n, g = [], j = []; 0 < a.length;) {
var l = Rc(a.shift()),
p = 0 < j.length;
if (l)
if (Boolean(l.match(/_optimizely_evaluate\s{0,9}=\s{0,9}force/i))) f = k;
else if (Boolean(l.match(/_optimizely_evaluate\s{0,9}=\s{0,9}safe/i)) || Boolean(l.match(/_optimizely_evaluate\s{0,9}=\s{0,9}end_force/i))) f = n;
else if (Boolean(l.match(/_optimizely_evaluate\s{0,9}=\s{0,9}editor_only/i))) e = k;
else if (Boolean(l.match(/_optimizely_evaluate\s{0,9}=\s{0,9}end_editor_only/i))) e = n;
else if (!Sc.exec(l) && !e)
if (f) g.push(l);
else {
if (!p) {
var r = Tc.exec(l),
v = [];
r ? (v.push(r[1].replace(/^['"]|['"]$/g, "")), (r = Uc.exec(l)) && 4 < r.length && v.push(r[4]), c.push({
code: l,
c: v,
type: "safe jquery",
j: k,
o: d
})) : p = k
}
p && j.push(l)
}
}
0 < g.length && b.push({
code: g.join("\n"),
type: "forced evaluation",
o: d
});
0 < j.length && c.push({
code: j.join("\n"),
type: "safe non-jquery",
da: k,
o: d
})
}
}
function Vc(a, b, c) {
for (var d = {
values: []
}, e = 0, f = a.length; e < f; e++) d.values.push({
value: a[e],
match: b[e] || c
});
return d
}
var Pc = [],
Oc = {}, xb = {}, Uc = /^\$j?\(['"](.+?)['"]\)\.detach\(\)\.(appendTo|insertAfter|insertBefore|prependTo)\(['"](.+?)['"]\);(?:\s|(?:\/\/.*|\/\*(?:[^*]|\*(?!\/))*\*\/))*$/,
Sc = /^(?:\s|(?:\/\/.*|\/\*(?:[^*]|\*(?!\/))*\*\/))*$/,
Tc = /^\$j?\((['"].+?['"]|document)\)\..+;(?:\s|(?:\/\/.*|\/\*(?:[^*]|\*(?!\/))*\*\/))*$/,
yb = {}, N = [];
function Wc(a, b) {
if (a && b)
if (Xc) B("Evaluator", "Bound event " + b + " to selector " + a), Yc(a, b);
else {
var c = {
e: b,
c: a,
type: "event '" + b + "' (click goal)",
j: k
};
B("Evaluator", "Add step to bind event " + c.e + " to selector " + c.c);
Zc.push(c)
}
}
function ib(a, b) {
if (K) {
O(a) ? $c(a) : (a = [], $c(b));
a = a.concat(J);
J = [];
for (var c = 0; c < a.length; c++) Ta(Pa, a[c]) || Pa.push(a[c]);
c = a;
c === i ? c = [] : xa(c) && (c = [c]);
for (var d = Qa(c), e = [], f = [], g = [], j = [], l = ad(bd(), function (a) {
return a.experiments ? n : cd(a.url_conditions || [])
}), p = 0, r = l.length; p < r; p++) {
var v = {
e: l[p].event_name,
c: l[p].selector,
type: "event '" + l[p].event_name + "' (click goal)",
j: k
};
"revenue" in l[p] && (v.revenue = l[p].revenue);
e.push(v)
}
x(c, function (a) {
var b = {}, c = A(a, "events") || {};
x(c, function (a, c) {
b[a] = [c]
});
var c = ad(bd(), function (b) {
return "experiments" in b ? a in b.experiments : n
}),
d = 0;
for (; d < c.length; d++) {
var r = c[d];
b[r.selector] || (b[r.selector] = []);
b[r.selector].push({
eventName: r.event_name,
revenue: r.revenue,
experimentIds: r.experiments
})
}
x(b, function (b, c) {
x(c, function (c) {
e.push({
e: c.eventName,
h: c.experimentIds,
a: c.revenue,
c: b,
type: "event '" + c.eventName + "' (experiment " + a + ")",
j: k
})
})
});
c = A(a, "css") || "";
d = A(a, "code") || "";
c && g.push({
code: '$("body").append("<style>' + c.replace(/([\f\n\r\t\\'"])/g, "\\$1") +
'</style>");',
c: "body",
type: "global css (experiment " + a + ")",
j: k
});
d && Qc(d, f, j)
});
x(d, function (a) {
for (var b = Wa(a), b = b.split("\n"), c = [], d = k, e = 0, g = b.length; e < g; e++) {
var r = $.trim(b[e]);
if (r === "/* _optimizely_variation_url_end */") d = k;
else if (r !== "") {
var l = yc.exec(r);
if (l && l.length === 13) {
var v = l[2] ? l[2].split(" ") : [],
r = l[4] ? l[4].split(" ") : [],
p = l[6] ? l[6] : "substring",
te = l[8] ? l[8].split(" ") : [],
l = l[10] ? l[10].split(" ") : [];
if (v.length > 0) {
d = Vc(v, te, p);
d = cd(d)
}
if (d && r.length > 0) {
d = Vc(r, l, p);
d = !cd(d)
}
} else d &&
c.push(r)
}
}
b = c.join("\n");
Qc(b, f, j, a)
});
c = [];
c.push.apply(c, f);
c.push.apply(c, g);
c.push.apply(c, j);
c.push.apply(c, e);
Zc.push.apply(Zc, c);
dd()
}
}
function dd() {
var a = n;
ed = m;
for (B("Evaluator", fd + " times waited"); !a && 0 < Zc.length;) {
B("Evaluator", Zc.length + " steps remaining");
var b = Zc.shift(),
c = b,
a = n;
if (c.da && !Xc) B("Evaluator", "Document not ready yet"), a = k;
else if (c.j && !Xc && (c = c.c))
for (var c = O(c) ? c : [c], d = 0; d < c.length; d++) {
var e = c[d];
if (!(e === m || e === i || !e.length))
if (0 === ("document" == e ? $(document) : $(e)).length) B("Evaluator", "'" + e + "' not found"), a = k
}
if (a) Zc.unshift(b);
else if (b.e) pb("Potential Flash"), qb("Bind Events"), B("Evaluator", "Bound event " +
b.e + " to selector " + b.c), c = {}, b.a && (c = {
a: b.a,
h: b.h
}), Yc(b.c, b.e, c);
else if (b.code) {
B("Evaluator", "Run code: " + b.code);
try {
gd(b.code, b.o)
} catch (f) {
t("e2"), hd(f), h(f)
}
}
}
a ? (ed = setTimeout(dd, 0 === fd ? 10 : 50), fd++) : (B("Evaluator", fd + " total times waited"), pb("Potential Flash"), pb("Bind Events"), pb("Client Evaluate"))
}
function gd(a, b) {
a = a.replace(id, jd);
if (Va(a))
if (B("Evaluator", "Redirect detected"), sc(a)) {
B("Evaluator", "OK to redirect");
var c = rc(a);
B("Evaluator", "setting a redirect cookie" + (b ? " for variation: " + b : ""));
I("optimizelyRedirect", (b || "unknown variation") + "|" + (c ? "true" : "false"), 5);
I("optimizelyReferrer", document.referrer, 5)
} else {
B("Evaluator", "NOT OK to redirect");
return
}
eval("var $j = $;");
try {
eval(a)
} catch (d) {
t("e1"), c = U, U = k, B("Evaluator", "Error: " + d.message), B("Evaluator", "Code: " + a), U = c, B("Evaluator",
"Failed to run code: " + d.message)
}
}
function Yc(a, b, c) {
c = c || {};
if (!kd[a] || !kd[a][b]) {
var d = function () {
M(b, "custom", c)
}, e = $(a);
if (0 < e.length) {
var f = function () {
e.unbind("touchend", d);
e.unbind("touchmove", f);
e.unbind("mousedown", d)
}, g = function () {
f();
e.bind("touchmove", f);
e.bind("touchend", d)
};
e.bind("mousedown", d);
e.bind("touchstart", g)
} else e = $("html"), f = function () {
e.undelegate(a, "touchend", d);
e.undelegate(a, "touchmove", f);
e.undelegate(a, "mousedown", d)
}, e.delegate(a, "touchstart", function () {
f();
e.delegate(a, "touchend", d);
e.delegate(a,
"touchmove", f)
}), e.delegate(a, "mousedown", d);
kd[a] || (kd[a] = {});
kd[a][b] = "mousedown touchstart"
}
}
function ld(a) {
md = a
}
function $c(a) {
a || (a = cb());
for (var b = 0; b < a.length; b++) D(a[b])
}
var kd = {}, Pa = [],
J = J || [],
md = 0,
Xc = n,
Zc = [],
ed = m,
fd = 0;
$(function () {
Xc = k;
ed !== m && (B("Evaluator", "Document is ready"), clearTimeout(ed), 0 < md ? setTimeout(dd, md) : dd())
});
function nd(a, b) {
var c = {}, c = i,
d = G("custom_revenue_goals");
d && (a in d && xa(d[a])) && (c = d[a]);
var c = b && xa(b) ? {
a: Number(b)
} : b && b.revenue ? {
a: b.revenue
} : c ? {
a: c
} : b,
d = od(),
e = {};
x(d, function (a) {
e[a] = k
});
$.extend(c, {
h: e
});
M(a, "custom", c)
}
function M(a, b, c) {
c = c || {};
u && (pd.push({
name: a,
type: b,
options: c
}), qd ? (rd(), B("Tracker", "Tracking event '" + a + "'")) : B("Tracker", "Queued tracking event '" + a + "'"))
}
function sd() {
td();
$("html").bind("mousedown", ud);
$("html").bind("touchstart", vd)
}
function td() {
$("html").unbind("touchstart", vd);
$("html").unbind("mousedown touchend", ud);
$("html").unbind("touchmove", sd)
}
function vd() {
$("html").bind("touchend", ud);
$("html").bind("touchmove", sd)
}
function wd() {
var a = document.location.href,
b = G("pageview_revenue_goals");
b && 0 < R(b) ? x(R(b), function (c) {
M(a, "pageview", {
a: c,
h: b[c]
})
}) : M(a, "pageview")
}
function xd(a) {
var b = G("goal_expressions"),
c = [],
d;
for (d in b) b.hasOwnProperty(d) && $.each(b[d], function (b, f) {
try {
if (a.match(f)) return c.push(d), n
} catch (g) {
t("t1")
}
return k
});
return c
}
function yd() {
var a = H("optimizelyPendingLogEvents") || "[]",
b = [];
try {
b = Ec(a)
} catch (c) {
t("t2")
}
if (O(b))
for (var a = 0, d = b.length; a < d; a++) {
var e = b[a];
if ("string" !== typeof e) {
b = [];
break
} else try {
Ec(e);
b = [];
break
} catch (f) {}
} else b = [];
return b
}
function Ga(a, b) {
if (zd && -1 !== a.indexOf(Ad)) try {
var c = new XMLHttpRequest;
if ("withCredentials" in c) {
c.onload = b;
c.open("GET", a, k);
c.withCredentials = k;
c.send();
return
}
zd = n;
B("Tracker", "Found that XHR with credentials is not supported in this browser.")
} catch (d) {
t("t4"), B("Tracker", "XHR not supported"), zd = n
}
var c = a,
e = new Image;
e.onload = b;
c = c.replace("&" + Ad, "");
e.src = c;
Bd.push(e)
}
function Cd(a) {
var b = (a = a === k || "true" === a) ? "true" : "false";
a ? (I("optimizelyOptOut", b, jc), I("optimizelyBuckets", b, jc), alert("You have successfully opted out of Optimizely for this domain.")) : (I("optimizelyOptOut", b, jc), alert("You are NOT opted out of Optimizely for this domain."))
}
function ud() {
td();
M("engagement")
}
var pd = [],
qd = n;
function rd() {
var a = ["a=" + Dd(), "d=" + Ed(), "y=" + !! G("ip_anonymization")];
vb && a.push("override=true");
x(Qa(), function (b) {
var c = y(b);
a.push("x" + c + "=" + b)
});
x($b(), function (b, c) {
a.push("s" + b + "=" + c)
});
var b = [];
x(pd, function (a) {
var c = [],
d = [];
a.name && (c.push("n=" + encodeURIComponent(a.name)), d = d.concat(xd(a.name)));
if (a.type && "pageview" === a.type) {
var d = d.concat(Pa.concat(J)),
e = Ua;
e && (e = y(e), d.push(e))
}
0 < d.length && c.push("g=" + d.join(","));
a.options.anonymous !== k && c.push("u=" + Fd());
zd && ("pageview" === a.type ||
"custom" === a.type) && c.push(Ad);
c.push("t=" + +new Date);
hc && c.push("dtpc=" + hc);
if (a.options && a.options.a) {
var d = od(),
f = a.options.h,
d = ad(d, function (a) {
return !f[a]
}),
e = [];
0 < d.length && (e = c.concat(["f=" + d.join(",")]), b.push(e.join("&")));
c.push("v=" + encodeURIComponent(a.options.a));
0 < R(f).length && (e = c.concat(["f=" + R(f).join(",")]), b.push(e.join("&")))
} else c.push("f=" + od().join(",")), b.push(c.join("&")); if ("custom" === a.type) try {
var g = a.name,
j = Fd(),
l = H("optimizelyCustomEvents") || "{}";
try {
l = Ec(l)
} catch (p) {
l = {}, t("t6")
}
var Q = l[j] || (l[j] = []),
Q = O(Q) ? Q : []; - 1 !== $.inArray(g, Q) && Q.splice($.inArray(g, Q), 1);
Q.push(g);
10 < Q.length && Q.shift();
l[j] = Q;
var a = 0,
c = m,
g = 0,
wa;
for (wa in l) l.hasOwnProperty(wa) && (a++, l[wa].length > g && wa !== j && (c = wa, g = l[wa].length));
10 < a && c !== m && delete l[c];
I("optimizelyCustomEvents", Gc(l), jc)
} catch (Re) {
t("t5")
}
});
var c = b.concat(yd());
Gd(c);
if (0 !== (!fa ? 0 : ha)) a.push("err=" + ia()), ha = 0, q = {};
var d = a.join("&"),
c = Hd ? b : c;
Hd = k;
for (var e = 0, f = c.length; e < f; e++) {
var g = c[e],
j = d + "&" + g;
B("Tracker", "Making a log request.");
var l = Dd(),
p = G("log_host");
l && (p = l.toString() + "." + p);
l = document.location.protocol;
"chrome-extension:" === l && (l = "http:");
Ga(l + "//" + p + "/event?" + j, function () {
for (var a = g, b = yd(), c = 0, d = b.length; c < d; c++)
if (b[c] === a) {
b.splice(c, 1);
break
}
Gd(b);
B("Tracker", "Removed a pending log event from the pending events cookie.")
})
}
pd = [];
qd = k
}
function Gd(a) {
for (var b = Gc(a); 1536 < b.length;) a = a.slice(0, -1), b = Gc(a);
I("optimizelyPendingLogEvents", b, 15)
}
function hd(a) {
var b = "BUG-553: " + (a.name || "no-name"),
c = a.message || "no-message",
a = (a.stack || "error\nno stack").split("\n").slice(0, 2).join(" ");
M([b, c, a].join(", "), "custom");
rd()
}
var Bd = [],
Hd = n,
Ad = "wxhr=true",
zd = k;
function Ed() {
return G("admin_account_id")
}
function Id(a) {
return (G("audiences") || {})[a]
}
function bd() {
if (!Jd) {
var a = G("click_goals") || [];
Jd = [];
for (var b = 0, c = a.length; b < c; b++)
for (var d = a[b], e = d.selector.split(","), f = 0, g = e.length; f < g; f++) {
var j = e[f];
j && (j = {
event_name: d.event_name,
selector: j
}, "experiments" in d ? j.experiments = d.experiments : "url_conditions" in d && (j.url_conditions = d.url_conditions), "revenue" in d && (j.revenue = d.revenue), Jd.push(j))
}
}
return Jd
}
function Kd() {
return G("dimensions") || {}
}
function Ld(a) {
return (a = Kd()[a]) ? a.condition_type : m
}
function od() {
var a = ad(cb(), Ra);
od = function () {
return a
};
return a
}
function sb(a) {
var b = tb(),
c;
for (c in b)
if (Object.prototype.hasOwnProperty.call(b, c)) {
var d = b[c];
if (d && d.api_name === a) return String(c)
}
return m
}
function dc() {
return G("experiments") || {}
}
function cb() {
return R(G("experiments") || {})
}
function db(a) {
return A(a, "manual") || n
}
function D(a) {
return 'experiment "' + (A(a, "name") || "") + '" (' + a + ")"
}
function wb(a) {
return A(a, "section_ids") || []
}
function Bb(a) {
return A(a, "variation_ids") || []
}
function Dd() {
return G("project_id")
}
function tb() {
return G("segments") || {}
}
function Cb(a, b) {
for (var c = wb(a), d = 0; d < c.length; d++) {
var e = Ab(c[d]);
if (Ta(e, b)) return c[d]
}
return ""
}
function Md(a) {
var b = {}, c = G("public_suffixes") || {};
x(c, function (a, c) {
x(c, function (c) {
b[c] = a
})
});
Md = function (a) {
return b[a] || ""
};
return Md.call(m, a)
}
function Ab(a) {
return G("sections", a, "variation_ids") || []
}
function Wa(a) {
var b = [];
x(a.split("_"), function (a) {
(a = G("variations", a, "code")) && b.push(a)
});
return b.join("\n")
}
function y(a) {
var b = {};
x(cb(), function (a) {
x(wb(a), function (d) {
x(Ab(d), function (d) {
b[d] = a
})
});
x(Bb(a), function (d) {
b[d] = a
})
});
y = function (a) {
return b[a.split("_")[0]] || ""
};
return y.call(m, a)
}
function Ba(a) {
var b = y(a),
c = wb(b);
if (0 === c.length) {
c = Bb(b);
for (b = 0; b < c.length; b++)
if (c[b] === a) return b
} else {
for (var a = a.split("_"), b = [], d = 0; d < c.length; d++)
for (var e = Ab(c[d]), f = 0; f < e.length; f++) e[f] === a[d] && b.push(f);
if (b !== []) return b
}
return -1
}
function Sa(a) {
var b;
return Ya(a).join(b || ", ")
}
function Ya(a) {
var b = [];
x(a.split("_"), function (a) {
b.push(G("variations", a, "name") || "Unnamed")
});
return b
}
function Ra(a) {
return !!A(a, "enabled")
}
function A(a, b) {
return G("experiments", a, b)
}
function Da(a) {
return A(a, "google_analytics")
}
function Xa(a, b) {
var c = A(a, "universal_analytics");
return F(c) ? c[b] : m
}
function Fa(a, b) {
var c = A(a, "at_internet");
return F(c) ? c[b] : m
}
function G(a) {
var b = DATA;
if (x(arguments, function (a) {
a = b[a];
if (F(a)) b = a;
else return m
}) !== m) return b
}
function Ub(a, b) {
return G("segments", a, b)
}
var Jd = m;
function H(a) {
var b = RegExp("^" + a + "=?(.*)"),
c = [];
x((document.cookie || "").split(/\s*;\s*/), function (a) {
(a = a.match(b)) && c.push(Zb(a[1]))
});
var d = c.length;
1 < d && w("Cookie", "Values found for %s: %s", a, d);
return 0 === d ? m : c[0]
}
function I(a, b, c) {
var d = Nd || Od || Pd,
e = document.location.hostname,
b = b || "";
!Od && G("remote_public_suffix") && Qd.push({
ea: c,
name: a,
value: b
});
d && (d === Od && d !== Pd) && (Rd(a, e), Rd(a, Pd));
Sd(a, b, d, c);
var f = H(a);
f === b ? w("Cookie", "Successful set %s=%s on %s", a, b, d) : (w("Cookie", "Setting %s on %s apparently failed (%s != %s)", a, d, f, b), w("Cookie", "Setting %s on %s", a, e), Sd(a, b, e, c), f = H(a), f === b ? (w("Cookie", "Setting %s on %s worked; saving as new public suffix", a, e), Pd = e) : (w("Cookie", "Could not set cookie %s, disabling event tracking.",
a), u = n))
}
function Rd(a, b) {
w("Cookie", "Deleting %s on %s", a, b);
document.cookie = [a, "=; domain=.", b, "; path=/; expires=", (new Date(0)).toUTCString()].join("")
}
function Sd(a, b, c, d) {
a = [a, "=", encodeURIComponent(b), "; domain=.", c, "; path=/"];
d && a.push("; expires=", (new Date(+new Date + 1E3 * d)).toUTCString());
document.cookie = a.join("")
}
function Td(a) {
var b = Nd || Od || Pd;
b !== a && (Nd = String(a) || "", w("Cookie", "Api public suffix set to: %s", Nd), kc(), Rd("optimizelySegments", b))
}
var Pd = "",
Nd = "",
Od = "",
Qd = [];
var X;
function Vb() {
function a() {
return X.K
}
X = X || tc();
Vb = a;
return a()
}
function Ud() {
function a() {
return X.L
}
X = X || tc();
Ud = a;
return a()
}
function Kc(a) {
if (!a) return "";
try {
return a.match(/:\/\/(?:www[0-9]?\.)?(.[^/:]+)/)[1]
} catch (b) {
return t("u2"), ""
}
}
function Fd() {
var a = H("optimizelyEndUserId");
a || (a = "oeu" + +new Date + "r" + Math.random(), I("optimizelyEndUserId", a, jc));
return a
}
function Xb() {
var a = "";
try {
a = window.optimizely.data.visitor.ip
} catch (b) {
t("u3")
}
return Y(a)
}
function Wb() {
var a = {};
try {
a = window.optimizely.data.visitor.location
} catch (b) {
t("u4")
}
a = a || {};
return {
city: Y(a.city),
continent: Y(a.continent),
country: Y(a.country),
region: Y(a.region)
}
}
function Y(a) {
if (!a) return "";
a = a.toUpperCase();
return "N/A" == a ? "" : a
}
function ac() {
function a() {
return X.aa
}
X = X || tc();
ac = a;
return a()
}
function Vd() {
return Wd ? "returning" : "new"
}
function bc() {
var a = navigator.appVersion || "",
b = ""; - 1 !== a.indexOf("Win") && (b = "Windows"); - 1 !== a.indexOf("Mac") && (b = "Mac"); - 1 !== a.indexOf("Linux") && (b = "Linux");
return b
}
function Xd(a) {
w("User", "Setting current URL to %s", a);
Yd = a
}
var Yd = i,
Wd = i;
function Zd() {}
cc(Zd.prototype, {
A: Vb,
Q: Ud,
D: ac,
z: function () {
return {
id: this.A(),
version: this.Q(),
mobileId: this.D()
}
},
B: H,
r: Xb,
q: function () {
var a = "";
try {
a = navigator.userLanguage || window.navigator.language, a = a.toLowerCase()
} catch (b) {
t("u1"), a = ""
}
return a
},
m: Wb,
l: function () {
return Yd || window.location.href
},
F: Vd,
P: Yb,
T: bc,
t: function () {
return H("optimizelyReferrer") || document.referrer || ""
},
U: function () {
return Kc(this.t())
},
G: Lc,
S: function () {
return document.referrer
},
f: function (a) {
a: {
for (var b = this.P(), b = b || Yb(), c = 0; c <
b.length; c++) {
var d = b[c];
if (d[0] === a) {
a = d[1];
break a
}
}
a = m
}
return a
},
R: function () {
return $a
},
C: function (a) {
var b = this.R();
return b ? b[a] : m
},
V: function () {
var a = H("optimizelyCustomEvents") || "{}";
try {
a = Ec(a)
} catch (b) {
a = {}
}
a = a[Fd()] || [];
return O(a) ? a : []
},
W: function (a) {
var b = this.G();
return Ta(b, a)
},
J: function (a) {
return Ta(this.V(), a)
}
});
var W = new Zd;
function Z(a, b) {
var c = n;
x(a, function (a) {
if (b(a)) return c = k
});
return c
}
function Ta(a, b) {
for (var c = 0; c < a.length; c++)
if (b == a[c]) return k;
return n
}
function nc(a) {
var b = a.length;
if (0 === b) return m;
if (1 === b) return 0;
for (var c = 0, d = 0; d < b; d++) c += a[d];
c *= Math.random();
for (d = 0; d < b; d++) {
if (c < a[d]) return d;
c -= a[d]
}
return Math.floor(Math.random() * b)
}
function $d(a, b) {
var c = Kb(arguments, 1);
return function () {
var b = Kb(arguments);
b.unshift.apply(b, c);
return a.apply(this, b)
}
}
function x(a, b) {
var c = m;
if (O(a))
for (var d = a.length, e = 0; e < d && !(c = b.call(i, a[e], e), F(c)); ++e);
else
for (d in a)
if (Object.prototype.hasOwnProperty.call(a, d) && (c = b.call(i, d, a[d]), F(c))) break; return c
}
function cc(a, b) {
x(b, function (b, d) {
a[b] = d
})
}
function ad(a, b) {
for (var c = [], d = 0, e = a.length; d < e; d++) {
var f = a[d];
b(f) && c.push(f)
}
return c
}
function ae(a, b) {
return x(b, function (b) {
if (b === a) return k
}) || n
}
function O(a) {
return a && "object" === typeof a && a.length && "number" === typeof a.length
}
function F(a) {
return "undefined" !== typeof a
}
function xa(a) {
return ("number" === typeof a || "string" === typeof a) && Number(a) == a
}
function R(a) {
R = Object.fa || function (a) {
var c = [];
x(a, function (a) {
c.push(a)
});
return c
};
return R.call(m, a)
}
function be(a) {
var b = document.head || document.getElementsByTagName("head")[0] || document.documentElement,
c = document.createElement("script");
c.src = a;
c.type = "text/javascript";
b.appendChild(c)
}
function w(a, b, c) {
var d = window.console;
if (U && d && d.log) {
var e = Kb(arguments, 1);
e[0] = "Optimizely / " + a + " / " + b;
Function.prototype.apply.call(d.log, d, e)
}
}
function Zb(a) {
try {
return decodeURIComponent(a)
} catch (b) {
return a
}
}
function Kb(a, b) {
return Array.prototype.slice.call(a, b || 0, a.length)
}
function Rc(a) {
return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g, "")
};
function ce() {
this.b = {};
this.d = {};
this.i = {}
}
ce.prototype.Y = function (a) {
if (!this.b.hasOwnProperty(a) || !this.i.hasOwnProperty(a)) try {
var b = this.b,
c = Id(a);
c || h(Error("Unable to find audience for id: " + a));
var d = de(this, c.conditions);
B("Visitor", "Checking if in audience " + a + ": " + d);
b[a] = d
} catch (e) {
B("Visitor", e.toString())
}
return this.b[a]
};
function ee(a, b, c, d, e) {
if (Id(b)) {
a.b[b] = c;
d ? a.i[b] = k : delete a.i[b];
if (b = Id(b))(b = b.segment_id) && (c ? ub(b, c) : Ob(b));
if (d && !e) {
var f = [];
x(a.i, o(function (a) {
this.b[a] && f.push(a)
}, a));
f.sort();
I("optimizelyAudiences", f.join(","), 31536E4)
}
} else B("Visitor", "Unable to find audience " + b)
}
ce.prototype.p = function (a, b) {
b = F(b) ? b : k;
ee(this, a, k, b)
};
ce.prototype.w = function (a, b) {
b = F(b) ? b : k;
ee(this, a, n, b)
};
ce.prototype.ba = function () {
x(this.b, o(function (a) {
this.w(a, !! this.i.hasOwnProperty(a))
}, this))
};
function fe(a, b, c) {
F(c) && c !== m && String(c) ? (c = Jc(String(c), n), a.d[b] = c) : delete a.d[b];
return a.d[b]
}
ce.prototype.n = function (a, b) {
if (Kd()[a]) {
var c = Kd()[a];
c && "custom_dimension" === Ld(a) ? (b = fe(this, a, b), (c = c.segment_id) && (b ? ub(c, b) : Ob(c)), B("Visitor", 'Set dimension "' + a + '" to "' + b + '"')) : B("Visitor", 'Unknown dimension "' + a + '"')
} else B("Visitor", "Unable to find dimension " + a)
};
var ge = {
browser: W.z,
cookies: W.B,
custom_tag: W.C,
event: W.J,
ip: W.r,
language: W.q,
location: W.m,
query: W.f,
referrer: W.t,
segment: W.W,
url: W.l,
visitor: W.F
}, Dc = new ce;
function eb(a) {
if (!A(a, "uses_geotargeting") && !Ub(a, "uses_geotargeting")) return k;
var b = W.m();
if (b.continent || b.country || b.region || b.city || W.r()) return k;
B("Condition", "Not ready to test (geotargeting): " + a);
return n
}
function gb(a, b) {
var c = b.manualMode === k,
d = b.objectType ? b.objectType : "experiment",
e = "experiment" === d,
f = b.enabledStatus,
g = b.visitor || Dc;
B("Condition", "Testing " + d + " " + a);
var f = e && (F(f) ? !! f : Ra(a)),
j = e && db(a),
l;
a: switch (d) {
case "experiment":
l = A(a, "conditions");
break a;
case "segment":
l = Ub(a, "add_condition") || [];
break a;
default:
l = []
}
if (e && !f) return B("Condition", "Failed for " + d + " " + a + " (paused)"), n;
if (e && !c && j) return B("Condition", " Failed for " + d + " " + a + " (manual activation mode)"), n;
if (l) {
var p = "experiment" ===
(d || "experiment"),
r = k;
x(l, function (b) {
var c = b.type;
if (p && b.only_first_time && Nc(a)) B("Condition", c + " condition passed because it only gets checked when bucketing", k);
else {
var d = !b.not,
b = (0, he[c])(b),
e = b !== d;
B("Condition", "Found that " + ("the visitor " + (b ? "passed" : "failed") + " a " + c + " targeting condition when it needed to " + (d ? "pass" : "fail")), !e);
if (e) return r = n
}
});
if (!r) return B("Condition", "Failed for " + d + " " + a + " (condition failed)"), n
} else {
a: {
c = [];
e = [];
if ("experiment" === d) c = A(a, "audiences") || [], e =
A(a, "urls") || [];
else if ("segment" === d)(f = (f = Ub(a, "audience_id")) ? Id(f) : m) && (c = [f]);
else {
B("Condition", "Not a valid objectType: " + d);
d = n;
break a
} if (0 < c.length && (B("Condition", "Testing audiences for " + d + " " + a + ": " + c), !Z(c, o(g.Y, g)))) {
B("Condition", "Failed to match any audiences for " + d + " " + a);
d = n;
break a
}
if (0 < e.length) {
B("Condition", "Testing URLs for " + d + " " + a);
var g = e,
v = W.l(),
E = [],
aa = [];
x(g, function (a) {
a.negate ? aa.push(a) : E.push(a)
});
g = function (a) {
return Z(a, function (a) {
return ie(v, a)
})
};
if (g(aa) || !(0 === E.length || g(E))) {
B("Condition", "Failed to match any URL for " + d + " " + a);
d = n;
break a
}
}
d = k
}
if (!d) return n
}
return k
}
function je(a, b) {
var c = b.value,
d = a.id,
e = a.version,
f = a.mobileId;
return f && "unknown" !== f ? (B("Condition", f, k), "mobile" === c || c === f) : 0 === c.indexOf(d) ? (c = c.substr(d.length), "" === c || c <= e && e < Number(c) + 1) : n
}
function ke(a, b) {
var c = b.value;
if (c === i) return k;
try {
return Boolean(eval(c))
} catch (d) {
return t("c1"), n
}
}
function le(a, b) {
var c = b.value;
return F(c) && "" !== Rc(c) ? c === a : a !== m && a !== i
}
function me(a, b) {
return !b.value && a !== m || b.value === a
}
function ne(a, b) {
var c = b.value;
switch (b.match) {
case "exact":
if (a == c && "" != a) return k;
break;
case "prefix":
if (0 == a.indexOf(c)) return k;
break;
case "regex":
try {
var d = RegExp(c)
} catch (e) {
t("c2");
break
}
if (d.test(a)) return k;
break;
case "cidr":
try {
var f;
a: {
var g = new oe(c),
j = pe(a);
j === m && h(Error("Invalid ip: " + a));
for (c = 0; 4 > c; c++)
if ((j[c] & g.u[c]) !== g.v[c]) {
f = n;
break a
}
f = k
}
return f
} catch (l) {
t("c3")
}
}
return n
}
function qe(a, b) {
var c = b.value;
return "any" === c || 0 === a.indexOf(c)
}
function re(a, b) {
var c = b.value.split("|"),
d = $.trim(c[0]),
e = $.trim(c[1]),
f = $.trim(c[2]),
g = $.trim(c[3]);
switch (c.length) {
case 1:
if (Y(a.country) === d) return k;
break;
case 2:
if (Y(a.region) === e && Y(a.country) === d) return k;
break;
case 3:
if (Y(a.city) === f && (Y(a.region) === e || "" === e) && Y(a.country) === d) return k;
break;
case 4:
if (Y(a.continent) === g) return k
}
return n
}
function se(a, b) {
var c = b.value || "";
return a !== m && (!c || c === a)
}
function ue(a, b) {
var c = b.value,
d = b.match;
B("Condition", "Testing referrer " + a + " against " + c + " (" + d + ")", k);
return ja(a, c, d)
}
function ve(a) {
return !!a
}
function cd(a) {
var b = W.l();
return Z(a.values, ea(ie, b))
}
function ie(a, b) {
var c = b.value,
d = b.match;
B("Condition", "Testing URL " + a + " against " + c + " (" + d + ")", k);
return ja(a, c, d)
}
function we(a, b) {
switch (b.value) {
case "new":
if ("returning" === a) return n;
break;
case "returning":
return "returning" === a
}
return k
}
function de(a, b) {
var c = {
and: function (b) {
var c = ea(de, a),
d = k;
x(b, function (a) {
if (!c(a)) return d = n
});
return d
},
or: function (b) {
return Z(b, ea(de, a))
},
not: function (b) {
return !de(a, b)
}
};
if (O(b)) {
if (b[0] in c) return c[b[0]](b.slice(1));
h(Error("Not an operator"))
}
var c = b.dimension_id,
d = Ld(c),
e = b.value;
d || h(Error("No dimension type for dimension: " + c));
var f = xe[d];
f || h(Error("Unknown dimension type: " + d));
d = i;
if (a.d.hasOwnProperty(c)) d = a.d[c];
else try {
var g = Kd()[c],
j, l;
g || h(Error("Unable to find dimension for id: " +
c));
"custom_dimension" === g.condition_type && h(Error("calculateDimensionValue called on custom dimension " + c));
ge[g.condition_type] && (l = o(ge[g.condition_type], W), j = l(g.name));
B("Visitor", "Got dimension value " + c + ": " + j);
d = j
} catch (p) {
B("Visitor", p.toString())
}
return f(d, {
value: e,
match: b.match || "exact"
})
}
var he = {
browser: function (a) {
var b = W.z();
return Z(a.values, function (a) {
return je(b, {
value: a
})
})
},
code: function (a) {
return ke(0, a)
},
cookies: function (a) {
for (var b = a.names || [], a = a.values || [], c, d = 0; d < b.length; d++)
if (c = b[d], le(W.B(c), {
value: a[d]
})) return k;
return n
},
custom_tag: function (a) {
return Z(a.values, function (a) {
return me(W.C(a.key), {
value: a.value
})
})
},
event: function (a) {
return Z(a.values, function (a) {
return W.J(a)
})
},
ip: function (a) {
var b = W.r();
return Z(a.values, ea(ne, b))
},
language: function (a) {
var b =
W.q();
return Z(a.values, function (a) {
return qe(b, {
value: a
})
})
},
location: function (a) {
var b = W.m();
return Z(a.values, function (a) {
return re(b, {
value: a
})
})
},
query: function (a) {
return 0 === a.values.length ? k : Z(a.values, function (a) {
return se(W.f(a.key), {
value: a.value
})
})
},
referrer: function (a) {
return Z(a.values, ea(ue, W.S()))
},
segment: function (a) {
var b = W.G();
return Z(a.values, function (a) {
return ve(ae(a, b))
})
},
url: cd,
visitor: function (a) {
var b = W.F();
return we(b, a)
}
}, xe = {
browser: je,
code: ke,
cookies: le,
custom_dimension: function (a,
b) {
var c = b.value;
return c === i || c === m ? a !== i && a !== m : c == a
},
custom_tag: me,
event: function (a) {
return a
},
ip: ne,
language: qe,
location: re,
query: se,
referrer: ue,
segment: ve,
url: ie,
visitor: we
};
var Ec, Gc;
(function () {
function a(a) {
d.lastIndex = 0;
return d.test(a) ? '"' + a.replace(d, function (a) {
var b = g[a];
return "string" === typeof b ? b : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4)
}) + '"' : '"' + a + '"'
}
function b(c, d) {
var g, v, E, aa, Ea = e,
P, C = d[c];
"function" === typeof j && (C = j.call(d, c, C));
switch (typeof C) {
case "string":
return a(C);
case "number":
return isFinite(C) ? String(C) : "null";
case "boolean":
case "null":
return String(C);
case "object":
if (!C) return "null";
e += f;
P = [];
if ("[object Array]" === Object.prototype.toString.apply(C)) {
aa = C.length;
for (g = 0; g < aa; g += 1) P[g] = b(g, C) || "null";
E = 0 === P.length ? "[]" : e ? "[\n" + e + P.join(",\n" + e) + "\n" + Ea + "]" : "[" + P.join(",") + "]";
e = Ea;
return E
}
if (j && "object" === typeof j) {
aa = j.length;
for (g = 0; g < aa; g += 1) "string" === typeof j[g] && (v = j[g], (E = b(v, C)) && P.push(a(v) + (e ? ": " : ":") + E))
} else
for (v in C) Object.prototype.hasOwnProperty.call(C, v) && (E = b(v, C)) && P.push(a(v) + (e ? ": " : ":") + E);
E = 0 === P.length ? "{}" : e ? "{\n" + e + P.join(",\n" + e) + "\n" + Ea + "}" : "{" + P.join(",") + "}";
e = Ea;
return E
}
}
var c = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
d = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
e, f, g = {
"\b": "\\b",
"\t": "\\t",
"\n": "\\n",
"\f": "\\f",
"\r": "\\r",
'"': '\\"',
"\\": "\\\\"
}, j;
Gc = function (a, c, d) {
var g;
f = e = "";
if ("number" === typeof d)
for (g = 0; g < d; g += 1) f += " ";
else "string" === typeof d && (f = d);
(j = c) && ("function" !== typeof c && ("object" !== typeof c || "number" !== typeof c.length)) && h(Error("JSON.stringify"));
return b("", {
"": a
})
};
Ec = function (a, b) {
function d(a, c) {
var e, f, g = a[c];
if (g && "object" === typeof g)
for (e in g) Object.prototype.hasOwnProperty.call(g, e) && (f = d(g, e), f !== i ? g[e] = f : delete g[e]);
return b.call(a, c, g)
}
var e, a = String(a);
c.lastIndex = 0;
c.test(a) && (a = a.replace(c, function (a) {
return "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4)
}));
if (/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]").replace(/(?:^|:|,)(?:\s*\[)+/g, ""))) return e = eval("(" + a + ")"), "function" ===
typeof b ? d({
"": e
}, "") : e;
h(new SyntaxError("JSON.parse"))
}
})();
function jd(a, b) {
var c;
c = $.trim(b);
var d = "";
if (window.optimizely && window.optimizely.data)
if (d = c.match(ye)) d = window.optimizely.data.visitor.params[d[1]], d === i && (d = "");
else {
for (var d = c.split("."), e = window.optimizely, f = 0, g = d.length; f < g; f++)
if (e = e[d[f]], e === i || e === m) {
e = "";
break
}
d = "" + e
}
B("Template", c + " evaluated to: '" + d + "'");
return d
}
var id = /\{\{ *optimizely\.([^\n\r{}<>]*)\}\}/g,
ye = /^data\.visitor\.params\.(.*)$/;
function ze(a) {
V = {};
Cc(a)
};
function oe(a) {
this.N = $.trim(a);
a = Ae(this.N);
a === m && h(Error("Invalid CIDR specification"));
this.v = a.v;
this.u = a.u
}
function Ae(a) {
a = a.split("/");
if (2 != a.length) return m;
var b = parseInt(a[1], 10);
if (isNaN(b) || 0 > b || 32 < b) return m;
a = pe(a[0]);
if (a === m) return m;
if (0 > b || 32 < b) b = m;
else {
for (var c = [], d = 0; 4 > d; d++) c[d] = 0;
for (var e = Math.floor(b / 8), d = 0; d < e; d++) c[d] = 255;
4 > e && (c[e] = Be[b % 8]);
b = c
}
for (c = 0; 4 > c; c++) a[c] &= b[c];
return {
v: a,
u: b
}
}
function pe(a) {
a = a.split(".");
if (4 != a.length) return m;
for (var b = [], c = 0; 4 > c; c++) {
var d;
d = a[c];
if (3 < d.length) d = m;
else {
var e = parseInt(d, 10);
d = isNaN(e) || d !== e.toString() || 0 > e || 255 < e ? m : e
} if (d === m) return m;
b[c] = d
}
return b
}
var Be = [0, 128, 192, 224, 240, 248, 252, 254, 255];
function B(a, b, c) {
Ce.push({
O: new Date,
M: a,
message: b,
H: c || n
});
De && Lb();
Ee(a, b)
}
function Fe() {
U = k
}
function Ge() {
Bc = U = k
}
function Lb() {
U && (x(Ce, function (a) {
if (!a.Z && (!a.H || a.H === Bc)) {
var b = +a.O;
w(a.M, a.message + (" [time " + (He ? b - He : 0) + " +" + (Ie ? b - Ie : 0) + "]"));
Ie = b;
He || (He = b);
a.Z = k
}
}), De = k)
}
var Ie = m,
He = m,
Ce = [],
De = n,
qb = ba,
pb = ba,
Ee = ba;
function Je(a) {
return function (b) {
if ("object" === typeof b && Ke()) {
var c = m,
d;
for (d in b) b.hasOwnProperty(d) && (c = a.call(this, d, b[d]));
return c
}
return a.apply(this, arguments)
}
}
function Ke() {
for (var a in {}) return k;
return n
};
function Le() {
var a = T,
b = document.createElement("a");
b.href = a;
for (var a = 0, c = Me.length; a < c; a++) {
var d = Me[a];
if (d.test(b.pathname)) return n
}
a = 0;
for (c = Ne.length; a < c; a++)
if (d = Ne[a], d.test(b.hostname)) return n;
return RegExp(Oe).test(b.hostname) || "" === b.hostname
}
var Ne = [/.*?\.?optimizelyedit\.(com|test)/, /.*\.?optimizelypreview\.(com|test)/, /(edit|preview)(-local)?(-hrd)?\.optimizely\.(com|test)/, /optimizelyedit(-hrd)?\.appspot\.com/, /cdn[^\.]*\.optimizely\.com/],
Me = [/^\/?api\/client/],
Oe = "(www\-devel\.optimizely\.com\$)|(www\-devel\.optimizely\.appspot\.com\$)|(www\-devel\-dot\-optimizely\.appspot\.com\$)|(\.optimizely\.com\$)|(\.optimizely\.at\$)|(\.optimizely\.be\$)|(\.optimizely\.bg\$)|(\.optimizely\.by\$)|(\.optimizely\.ch\$)|(\.optimizely\.cl\$)|(\.optimizely\.co\.il\$)|(\.optimizely\.co\.nz\$)|(\.optimizely\.co\.uk\$)|(\.optimizely\.com\.br\$)|(\.optimizely\.com\.hr\$)|(\.optimizely\.com\.mx\$)|(\.optimizely\.cz\$)|(\.optimizely\.de\$)|(\.optimizely\.es\$)|(\.optimizely\.dk\$)|(\.optimizely\.fr\$)|(\.optimizely\.gr\$)|(\.optimizely\.hk\$)|(\.optimizely\.ie\$)|(\.optimizely\.it\$)|(\.optimizely\.jp\$)|(\.optimizely\.lt\$)|(\.optimizely\.lu\$)|(\.optimizely\.lv\$)|(\.optimizely\.nl\$)|(\.optimizely\.mx\$)|(\.optimizely\.pl\$)|(\.optimizely\.pt\$)|(\.optimizely\.ro\$)|(\.optimizely\.ru\$)|(\.optimizely\.se\$)|(\.optimizely\.sg\$)|(\.optimisely\.com\$)|(\.optimisely\.at\$)|(\.optimisely\.be\$)|(\.optimisely\.bg\$)|(\.optimisely\.by\$)|(\.optimisely\.ch\$)|(\.optimisely\.cl\$)|(\.optimisely\.co\.il\$)|(\.optimisely\.co\.nz\$)|(\.optimisely\.co\.uk\$)|(\.optimisely\.com\.br\$)|(\.optimisely\.com\.hr\$)|(\.optimisely\.com\.mx\$)|(\.optimisely\.cz\$)|(\.optimisely\.de\$)|(\.optimisely\.es\$)|(\.optimisely\.dk\$)|(\.optimisely\.fr\$)|(\.optimisely\.gr\$)|(\.optimisely\.hk\$)|(\.optimisely\.ie\$)|(\.optimisely\.it\$)|(\.optimisely\.jp\$)|(\.optimisely\.lt\$)|(\.optimisely\.lu\$)|(\.optimisely\.lv\$)|(\.optimisely\.nl\$)|(\.optimisely\.mx\$)|(\.optimisely\.pl\$)|(\.optimisely\.pt\$)|(\.optimisely\.ro\$)|(\.optimisely\.ru\$)|(\.optimisely\.se\$)|(\.optimisely\.sg\$)|(\.optimizely\.test\$)|(\.optimizely\.appspot\.com\$)|(\.optimizely\-hrd\.appspot\.com\$)|(\-dot\-optimizely\.appspot\.com\$)|(\-dot\-optimizely\-hrd\.appspot\.com\$)";
function Pe() {
if (!wc) {
var a = $;
a.fn.attr = Je(a.fn.attr);
a.fn.css = Je(a.fn.css);
a.fn.extend = Je(a.fn.extend);
var b = a.each;
a.each = function (c, d, e) {
if (!(c.length === i || a.isFunction(c)) || !Ke()) b.apply(this, arguments);
else if (e)
for (var f in c) {
if (c.hasOwnProperty(f) && d.apply(c[f], e) === n) break
} else
for (f in c)
if (c.hasOwnProperty(f) && !d.call(c[f], f, c[f]) === n) break;
return c
};
var c = a.fn.X,
d = function (a, b, d) {
return new c(a, b, d)
}, e, f = document.getElementsByClassName;
if (!qc(f)) var f = (window.optimizely || {}).getElementsByClassName,
g = (window.optly || {}).getElementsByClassName, f = qc(f) ? f : qc(g) ? g : m;
e = f;
a.fn.X = function (b, c, f) {
var g = d,
j = document.getElementsByClassName;
!qc(j) && e && (g = function (a, b, c) {
document.getElementsByClassName = e;
a = d(a, b, c);
document.getElementsByClassName = j;
return a
});
if (!("string" === typeof b && c && "object" === a.type(c) && Ke())) return g(b, c, f);
b = g(b, i, f);
b.attr(c);
return b
}
}
qb("Client Evaluate");
B("Main", "Started, revision " + G("revision"));
var f = oc(),
g = n,
j;
for (j in f)
if (pc.exec(j)) {
g = k;
break
}("true" === f.opt_out || "false" ===
f.opt_out) && Cd("true" === f.opt_out);
K = "true" !== f.disable && "true" !== f.opt_out && "true" !== H("optimizelyOptOut");
zc = "true" === f.editor;
Ac = "true" === f.show_preview;
T = !Ac && f.load_script;
U = "true" === f.log;
Bc = "true" === f.verbose;
u = !(Ac || g) || "true" === f.force_tracking;
"false" === f.client && (K = n, T = "js/" + Dd() + ".js");
T && !Le() && (B("Query", "Blocked request to load unsafe script: " + T), T = "");
if (Ac) Pe.I();
else {
qb("client.Main#initialize");
fa = !! G("log_errors");
j = document.location.hostname;
var f = j.split("."),
g = j,
l = f[f.length -
1];
2 < f.length && "appspot" === f[f.length - 2] && "com" === l ? g = f[f.length - 3] + ".appspot.com" : 1 < f.length && ae(l, xc) && (g = f[f.length - 2] + "." + l);
Pd = g;
w("Cookie", "Guessed public suffix: %s", Pd);
Od = Md(j);
w("Cookie", "Public suffix (from data): %s", Od);
Nd && w("Cookie", "Api public suffix (from api): %s", Nd);
j = H("optimizelyBuckets");
Wd = j !== i && j !== m;
a: {
j = ["googlebot", "yahoo! slurp", "bingbot", "bingpreview", "msnbot"];
f = navigator.userAgent;
f = f.toLowerCase();
for (g = 0; g < j.length; g++)
if (-1 !== f.indexOf(j[g])) {
j = k;
break a
}
j = n
}
j &&
(u = n);
if (j = H("optimizelyBuckets")) {
try {
j = Ec(j)
} catch (p) {
t("p1"), j = {}
}
var r = {};
x(j, function (a, b) {
var b = String(b),
c = y(b);
if (wb(c).length > 1 && b.indexOf("_") === -1) {
r[c] = r[c] || {};
r[c][a] = b
} else b !== "0" ? Fb(b, "cookie") || (Oc[a] = b) : mc(a)
});
x(r, function (a, b) {
var c;
a: {
c = [];
for (var d = wb(a), e = 0; e < d.length; e++) {
var f = b[d[e]];
if (f === "0") {
c = "";
break a
}
c.push(f)
}
c = c.join("_")
}
c.length > 0 ? Fb(c, "cookie") : mc(a)
})
}
Cc();
Ua = (H("optimizelyRedirect") || "|").split("|")[0];
if ((j = H("optimizelyReferrer")) && 0 < j.length) sa = j, I("optimizelyReferrer",
"");
j = oc();
x(j, function (a, b) {
var c = pc.exec(a);
if (c) {
c = c[1];
bb(c, b, k);
gb(c, {}) || ab(c, {
force: k,
skipPageviewTracking: k
})
}
});
j = Dc;
(f = H("optimizelyAudiences")) && 0 < f.length && x(f.split(","), o(function (a) {
ee(this, a, k, k, k)
}, j));
x(Lc(), o(function (a) {
var b = tb()[a];
b && b.audience_id ? this.b[b.audience_id] = k : b && b.dimension_id && fe(this, b.dimension_id, V[a])
}, j));
L = Dc;
Za = n;
Fc.push(Ib);
Pc.push(Ib);
j = {
$: $,
activeExperiments: Pa || [],
allExperiments: dc(),
all_experiments: dc(),
allVariations: G("variations") || {},
data: S,
getElementsByClassName: document.getElementsByClassName,
revision: G("revision"),
variationIdsMap: Rb,
variation_map: Sb,
variationMap: Sb,
variationNamesMap: Tb
};
var f = {}, v = $d(Jb, f);
cc(f, {
activate: ab,
activateGeoDelayedExperiments: kb,
activateSiteCatalyst: pa,
activateUniversalAnalytics: Ia,
addToAudience: o(L.p, L),
addToSegment: rb,
bindTrackElement: Wc,
bucketUser: bb,
bucketVisitor: bb,
clickTaleRecord: La,
clickTalePlayback: Ja,
customTag: Mb,
delayDomReadyEval: ld,
delayPageviewTracking: ec,
disable: Gb,
log: Fe,
getAccountId: Ed,
getProjectId: Dd,
googleAnalyticsCustomVariableScope: va,
integrationPrefix: Ma,
optOut: Cd,
overrideUrl: Xd,
push: v,
removeFromAllAudiences: o(L.ba, L),
removeFromAllSegments: Pb,
removeFromAudience: o(L.w, L),
removeFromSegment: Nb,
sc_activate: pa,
sc_svar: Na,
setCookieDomain: Td,
skipPageTracking: lc,
optOutThirdPartyCookies: gc,
setCookieExpiration: ic,
setDimensionValue: o(L.n, L),
timeout: Gb,
trackEvent: nd,
verbose: Ge
});
cc(j, f);
f = window.optimizely;
O(f) && x(f, function (a) {
v(a)
});
window.optimizely = j;
window.optimizely.iapi = {
evaluateSegments: ea(ze, i)
};
pb("client.Main#initialize");
Pe.log();
T && be(T);
K && (x(cb(),
function (a) {
if (!ae(a, J))
if (eb(a)) {
if (gb(a, {
objectType: "experiment"
})) {
B("Distributor", "Going to distribute " + D(a));
if (hb(a)) {
J = J || [];
J.push(a)
}
}
} else db(a) || fb(a)
}), jb(), sd(), ob || (0 < fc ? setTimeout(function () {
try {
wd()
} catch (a) {
t("m1");
hd(a);
h(a)
}
}, fc) : wd()), rd(), za());
U && (x(xb, function (a) {
var b = A(a, "name") || "";
B("Plan", "Ignore experiment '" + b + "' (" + a + ")")
}), x(N, function (a) {
var b = y(a.id),
c = Sa(a.id);
B("Plan", D(b) + ' in variation "' + c + '" (' + a.id + ")")
}));
zc ? Hb() : K && (ib(), Hb(), Lb(), !G("installation_verified") &&
u && (j = "//" + G("www_host") + "/account/snippet_installed?project_id=" + Dd() + "&wxhr=true", B("Tracker", "Making snippet verification request."), Ga(j, m)));
setTimeout(function () {
window.optimizelyCode = {}
}, 0);
setTimeout(function () {
try {
window.optimizely.iapi.geoTimedOut = !(window.optimizely.data.visitor.location.city !== "" || window.optimizely.data.visitor.location.continent !== "" || window.optimizely.data.visitor.location.country !== "" || window.optimizely.data.visitor.location.region !== "");
window.optimizely.activateGeoDelayedExperiments =
i
} catch (a) {
t("m2")
}
}, 2E3);
$(function () {
G("badge_html") && $("body").append(G("badge_html"))
});
B("Main", "End of main")
}
}
Pe.log = function () {
B("Info", "Is enabled: " + K);
B("Info", "Script to load: " + (T || "none"));
B("Info", "Browser type: " + Vb());
B("Info", "Browser version: " + Ud());
var a = ac();
"unknown" !== a && B("Info", "Mobile browser type: " + a);
B("Info", "New vs returning: " + Vd());
B("Info", "Source type: " + Ic());
B("Info", "User ID: " + Fd())
};
Pe.I = function () {
0 === $("body").length ? setTimeout(Pe.I, 20) : (be(["//optimizely.s3.amazonaws.com/js/preview/", Dd(), ".js"].join("")), $("body").append('<div id="optimizely-loading" style="position:absolute;top:0;right:0;left:0;bottom:0;background-color:white;opacity:0.9;z-index: 3271000;"><h2 style="color:#9a9a9a;top:40%;position:absolute;font-size:2.25em;text-align:center;width:100%;font-family:\'Lucida Grande\',sans-serif;">Loading Preview<br><img src="//www.optimizely.com/static/img/loading-32.gif" style="padding-top:20px"></h2></div>'))
};
if (G("log_errors")) try {
Pe()
} catch (Qe) {
hd(Qe), h(Qe)
} else Pe();
optly.Cleanse.finish();
};
optimizelyCode();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment