UP TO 35% OFF!


  • Home
  • Add and Remove Cookies Using Shortcodes

Add and Remove Cookies Using Shortcodes

If-So allows you to add, remove, or change a value of a cookie using simple shortcodes.

The action happens when the cookie shortcode is rendered. You can paste the shortcodes directly on a page or inside an If-So content version if you’d like to set the cookie based on a condition.

The Cookie Shortcode is useful together with our Cookie Condition, which allows you to display dynamic content based on a cookie name or cookie value.

The shortcode below will add a cookie to the user’s browser upon rendering

[ifso-add-cookie name='COOKIE_NAME' value='COOKIE_VALUE' time='3600']
  • Make sure to replace ‘COOKIE_NAME’ and ‘COOKIE_VALUE’ with a name and value of your choice.
  • The time parameter controls the cookie expiration time (in seconds, 3600 sec = 1 hour)

A cookie value will be replaced if a shortcode with a different cookie value will be rendered.

Upon rendering, the shortcode below will remove a cookie from the user’s browser

[ifso-remove-cookie name='COOKIE_NAME']

Ready to get started?
Try it on your website