Created
October 26, 2016 21:45
-
-
Save mmoravec/f73d4a9abdfd36bdc7ce1aac0bf42039 to your computer and use it in GitHub Desktop.
This file contains hidden or 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['optimizely'] = window['optimizely'] || []; | |
if (window.jQuery("meta[name='section']").length > 0) { | |
window['optimizely'].push({ | |
type: "page", | |
pageName: "section_page", | |
tags: { | |
category: window.jQuery("meta[name='section']").attr('content'), | |
type: window.jQuery("meta[property='og:type']").attr('content') === 'website' ? 'section_front' : window.jQuery("meta[property='og:type']").attr('content'), | |
title: window.jQuery("meta[property='og:title']").attr('content') | |
} | |
}); | |
} | |
// Newsletter timing control (wait 15 seconds before firing newsletter activation calls) | |
var optlyNewsletterTimeout = setTimeout(function() { | |
window['optimizely'] = window['optimizely'] || []; | |
window['optimizely'].push({ | |
type: "page", | |
pageName: "newsletter" | |
}); | |
// Check whether we are on an article page and NOT on edition.cnn.com | |
// if (window.jQuery("meta[property='og:type']").attr('content') === "article" && !window.location.href.match('edition\.cnn\.com')) { | |
// if (window.jQuery("meta[name='section']").attr('content') !== "politics") { | |
// If on politics, push Five Things | |
// console.log("[Optly] activating five things"); | |
// } else if (window.jQuery("meta[name='section']").attr('content') === "politics") { // If not on politics, push Nightcap | |
//classic Optimizely nightcap desktop | |
// console.log("[Optly] activating nightcap"); | |
// } | |
// } | |
}, 15000); | |
window.optimizely.push({ | |
type: "addListener", | |
filter: { | |
type: "lifecycle", | |
name: "viewActivated" | |
}, | |
handler: function(data) { | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment