Example Use Case
Sometimes we may need to check for a specific condition to occur on every page visit, but that condition might be related to the options offered in the Locations.
A common need is to verify a cookie value for a user to be bucketed into the test, but if this cookie value changes the experience should no longer be shown to the visitor. For example, we might want to show a coupon only one time; or, the opposite.
What we would need is a JavaScript Condition that checks for the cookie value and the URL value at the same time.
Code
Place the following code in the Locations as a JavaScript condition. Make sure you modify the code with the correct values to check the cookie and the cookie name as specified in the cookie comments.
See the Pen Check For Cookie on Site Area by Convert.com (@gcrewe) on CodePen.
Comments