Skip to content

Instantly share code, notes, and snippets.

@gregberns
Last active February 7, 2018 17:57
Show Gist options
  • Save gregberns/b1daa4718a10fefceb4eb5075829a2fd to your computer and use it in GitHub Desktop.
Save gregberns/b1daa4718a10fefceb4eb5075829a2fd to your computer and use it in GitHub Desktop.
Optimizely - Remove Listener
var token = Number(new Date());
window["optimizely"] = window["optimizely"] || [];
window["optimizely"].push({
type: "addListener",
filter: {
type: "lifecycle",
name: "pageDeactivated"
},
token: token,
// Add the pageActivated function as a handler.
handler: function(data) {
//remove the listener
window["optimizely"].push({type: 'removeListener', token: token});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment