Created
August 9, 2018 05:41
-
-
Save MoonMoon85/ec4470338b96fc0f6a423506959e491b to your computer and use it in GitHub Desktop.
Optimizely - Viewed Page Audience
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 viewedPage = false; | |
var pageviews = optimizely.get("behavior").query({ | |
"version": "0.2", | |
"sort": [{ | |
"field": ["time"], | |
"direction": "descending" | |
}], | |
"filter": [{ | |
"field": ["type"], | |
"value": "pageview" | |
}] | |
}); | |
pageviews.forEach(function(pageview) { | |
// Add your Page Name between the single quotes | |
if (pageview.name == 'your page name here') { | |
viewedPage = true; | |
} | |
}); | |
viewedPage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment