Test for cookie values on the Locations

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.

Need assistance? Start a conversation with our Support Team.
CONVERT MORE

Reliably Convert More Site Visitors, Even If Everything Else is Changing in Your Business.

START 15-DAY FREE TRIAL
✓ No Credit Card  ✓ Easy Set-Up  ✓ Access All Features

Comments