The Conditions

The Cookie Condition

In this article: About the cookie condition| Types of cookie-based content | How to set up cookie-based content using If-So

The cookie condition allows you to display dynamic content to users visiting your site based on a cookie name, cookie value, or both.

This option was created to allow site admins and developers to create dynamic content based on cookies that are already in use by the website, whether they are created by a 3rd-party plugin or using a custom code. It can be used to interact with users based on previous interactions they have had with your site and allows you to give your visitors a more personalized experience.

With If-So you can easily display dynamic content based on a cookie name, a cookie value, or both. 

Cookie Name:  Fill in the cookie name field and leave the cookie value field blank. The dynamic content will be displayed if a cookie with the exact name exists in the user’s browser, regardless of its value.

Cookie Value:  Fill in the cookie value field and leave the name field blank. The dynamic content will be displayed if a cookie with the exact value exists in the user’s browser, regardless of its name

Cookie Name and Cookie Value:  Fill in both the cookie name and the cookie value. The dynamic version will be displayed only if the cookie in the user’s browser matches both the name and value you have set.

  1. On your WordPress dashboard, go to “If-So → Add New Trigger”
  2. Click on “Select a condition” and select “Cookie“.
  3. Type in the Cookie Name and/or Cookie Value
  4. In the content field, set the content to be displayed if the cookie condition you have set is met.
  5. In the default content field, set content to be displayed if the condition is not met (optional, can be left blank).
  6. Press “Publish” and paste the shortcode generated by If-So wherever you want it to go.

Screenshots

FAQs

  • Will this work with server and WordPress caching solutions?

    Yes.

    Whether you are using a caching plugin or server caching, you can navigate to the plugin settings and enable the "Page Caching Compatibility" option. With the option enabled, dynamic triggers will be rendered in a separate request that will take place after the loading of the cached version.

    Learn more about Page Caching Compatibility.

  • Can I redirect users to a different page based on conditions?
    Yes. You can redirect users based on each one of the conditions by pasting a simple JavaScript code in the dynamic version content field. Click here for a step by step guide.
  • Was this Helpful ?
  • YesNo
Ready to get started?
Try it on your website