Learn how to segment visitors based on their cookies to personalize for logged-in users, affiliate traffic, on-site actions, and more.
Do you want to personalize for logged-in users? Maybe you identify affiliate traffic using cookies. Or maybe you fire cookies when visitor perform certain actions. In this guide, you will learn how to segment visitors based on existing cookies and how to set up your own cookies to create behavior-based audiences (note: this article is an addition to our main article about behavior-based audiences.).
A cookie is a small piece of data sent from a website and stored on the user's computer by the web browser. Cookies help your website remember information (e.g. items added to shopping cart, information entered in a form field,...) or record the user's browsing activity (e.g. clicking a button).
For security and performance reasons, your website doesn't send cookies to Unless by default. So, to create an audience based on a cookie, you need to whitelist the cookie you want to send us in your account settings. Also, bear in mind that the browser cookie can’t be set to httpOnly since we won’t be able to read the cookie or send it to our servers.
Generally, you have two options - target based on the existence of a cookie or the value of a cookie.
When setting up your target audience, choose: behavior > cookie > is set > nameofyourcookie
Here, we target users for whom the cookie "isLoggedIn" is set.
If you want to display a variation based on a specific value of a cookie, you'll have to enter both, the name of the cookie and its value → nameofyourcookie=value
Use the advanced editor to add a cookie following this naming structure: Txt.setCookie(name, value, days)
Now, use the cookie to define your target audience. Choose: behavior > cookie > is set > nameofyourcookie=value
For the "Startup" audience, we use the cookie as a targeting condition. Now, we can personalize for all visitors who initially arrived on the Startup landing page.