This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function () { | |
var shipping_value = document.querySelectorAll("span.right.ng-binding")[document.querySelectorAll("span.right.ng-binding").length - 2]; | |
var cart_total = document.querySelectorAll("span.right.ng-binding")[document.querySelectorAll("span.right.ng-binding").length - 1]; | |
var bucket = false; | |
for (var i=0; i<window.dataLayer.length; i++) { | |
if (window.dataLayer[i].subProgramName === "Fall Individuals") { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sample JavaScript Condition | |
* This function is called after the page is triggered. It should return true | |
* when the page is ready to activate. | |
*/ | |
function () { | |
var bucket = false; | |
for (var i=0; i<window.dataLayer.length; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install --save @optimizely/optimizely-sdk request request-promise prompt-input | |
const userId = process.argv[2] || 'anonymous123'; | |
const url = 'https://cdn.optimizely.com/datafiles/Pex4GNxQnzDErs3TJZ7cc3.json'; | |
const rp = require('request-promise'); | |
const Input = require('prompt-input'); | |
const options = {uri: url, json: true}; | |
const optimizelySDK = require('@optimizely/optimizely-sdk'); | |
const dimColor = '[2m%s[0m'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var url = window.location.href; | |
if (url.indexOf('thank-you') > -1) { | |
var plan = url.split('/')[5]; | |
if (plan == "M") { | |
window["optimizely"] = window["optimizely"] || []; | |
window["optimizely"].push({ | |
type: "user", | |
attributes: { | |
"plan": "monthly" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(_pushState) { | |
var pushState = history.pushState; | |
history.pushState = function(state) { | |
if (typeof history.onpushstate == "function") { | |
history.onpushstate({ | |
state: state | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"account_id": "your_account_id", | |
"visitors": | |
[ | |
{ | |
"visitor_id": e.optimizely_dna__Visitor_Id__c, | |
"attributes": [{ | |
"entity_id": "19213743593", | |
"key": "example_key", | |
"type": "custom", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place this clode below the Optimizely snippet | |
var first_session = window.optimizely.get('visitor').first_session | |
if (first_session == true) { | |
first_session = "true"; | |
} else if (first_session == false) { | |
first_session = "false"; | |
} | |
window.optimizely = window.optimizely || []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var segments = document.querySelector('#root > div.wrap.position--relative > div > div > div > div > div > div.flex--1.js-popover-scroll-area.results-col.overflow-y--auto > div.toolbar > div > div.toolbar__left > div.lego-dropdown-group.is-active > ul > li.hard--sides.lego-dropdown__item > ul > div:nth-child(3) > div').children | |
function segmentSelect(search) { | |
for (var i=0; i<segments.length; i++) { | |
if(segments[i].innerText.indexOf(search) > -1) { | |
segments[i].firstChild.firstChild.firstChild.click() | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This snippet runs everytime a "campaign decision" is made. */ | |
var decisionObject = window.optimizely.get('state').getDecisionObject({ | |
campaignId: campaignId, | |
shouldCleanString: true | |
}); | |
//Check to see if a decision has been made. This will be null if the user is part of the holdback group | |
if (decisionObject) { | |
var experimentId = decisionObject.experiment.split(' ')[1].replace(/[()]/g, ''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var variationMap = window.optimizely.get('state').getVariationMap(); | |
typeof(variationMap[23243453455]) === "undefined" && typeof(variationMap[23423434752]) === "undefined"; | |
OlderNewer