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
window.jQuery(document).ajaxComplete(function(event, xhr, settings) { | |
if (settings && settings.url.indexOf('homepage3-zone-1') !== -1) { | |
console.log('Zone 3 back'); | |
window.jQuery("#homepage3-zone-1 > div.l-container.zn__background--content-relative > div").before('<div class="OB_HOP_70"><div class="OUTBRAIN" data-src="http://www.cnn.com/" data-widget-id="HOP_70" data-ob-template="cnn" ></div></div>'); | |
var pollForElement = function() { | |
if (window.OBR) { | |
window.OBR.extern.researchWidget(); | |
} | |
else { | |
setTimeout(pollForElement, 50); |
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 state = optimizely.get('state'); | |
var string = state.getDecisionString({"campaignId":campaignId}); | |
if (string) { | |
window.optimizelyMoat = window.optimizelyMoat || []; | |
window.optimizelyMoat.push(string); | |
} |
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
SELECT | |
experiment_id, | |
variation_id, | |
COUNT(DISTINCT end_user_id) AS unique_users, | |
COUNT(DISTINCT CASE WHEN is_converted = 1 | |
THEN end_user_id END) AS unique_users_converted | |
FROM ( | |
SELECT | |
sessions.end_user_id, | |
sessions.experiment_id, |
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
--Create a table indicating the first decision event for each user. | |
CREATE TABLE first_seen (userId varchar(64), first_seen DateTime); | |
CREATE INDEX first_seen_index ON first_seen (userId(64)); | |
--Create index containing the relevant data. | |
CREATE INDEX pricing_index ON pricing (end_user_id(64), timestamp, event_name(100)); | |
--Setup date parameters | |
SET @start_time = "2017-05-02 00:00:00"; | |
SET @end_time = "2017-05-03 00:00:00"; |
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
{ | |
"experiment": { | |
"project_id": 2723621000, | |
"variations": [ | |
{ | |
"archived": false, | |
"key": "original", | |
"name": "Original", | |
"weight": 3333 | |
}, |
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
//const Integration = require('@segment/integration-sdk') | |
const optimizely = require('@optimizely/optimizely-sdk'); | |
var defaultLogger = require('@optimizely/optimizely-sdk').logging; | |
var LOG_LEVEL = require('@optimizely/optimizely-sdk').enums.LOG_LEVEL; | |
var optimizelyClientInstance = optimizely.createInstance({ | |
sdkKey: '15gywErrhRhKGHaTJCBw9Z', | |
logger: defaultLogger.createLogger({ | |
logLevel: LOG_LEVEL.DEBUG | |
}) // Provide the sdkKey of your desired environment here | |
}); |
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 impression_count = 0; | |
var count_impressions = function(logEvent){ | |
var visitors = logEvent.params.visitors; | |
visitors.forEach(function(visitor){ | |
console.log(visitor) | |
var snapshots = visitor.snapshots; | |
snapshots.forEach(function(snapshot){ | |
var events = snapshot.events | |
events.forEach(function(event){ | |
if(event.key == "campaign_activated"){ |
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 heapDecision = function(decision) { | |
var type = decision.type | |
if (type == "feature") { | |
var info = decision.decisionInfo; | |
var featureKeyString = "[Optimizely Feature] " + info.featureKey; | |
var enabled = info.featureEnabled; | |
heap.addUserProperties( | |
{featureKeyString:enabled} | |
); | |
if (info.source == "feature-test") { |