Personalization Example Using Cookies

In this guide you will learn how to create page personalization on the Zesty platform. We will be modifying the loader file and a view file to create the most basic form of personalization.

There are three key components to executing personalization. The URL, the Cookie, and the Business Logic. Let's start by looking at how to format the URL.


The url will contain the key to personalization, it is simply stored in a Get variable. A Get variable can be appended to the end of any URL. In our example, let's use ct, short for cookie test.

Note: when you setup links with advertisers, just append ?ct=developer or ?ct=marketeretc. and you can custom curate any experience you want to deliver.

Easy right? Now let's store that value to a cookie.

The Cookie

Cookies are small reference files stored on the visiting users computer. Cookies are set by the browser, and once set, can be accessed with scripting languages. Zesty provide a simple way to set and access cookies, which looks like @my_cookie = 'hello world'. In this example, we are going to store the Get variable passed by the URL to our cookie. To ensure we capture this on any page, we are going to put our code in the loader view. From the Code Editor in your Satellite, open the loader view file, and enter this line of code:

Open the loader view file and add:

Note: the name of the cookie doesn't matter, but it cannot have spaces or abnormal characters. Cookies can also be overwritten, so on a page for markets, you could overwrite the cookie to {{@my_cookie = 'marketers'}}, and then start targeting your language to marketers .

The Business Logic

In our URL we are passing the value developer and capturing that in the value into our cookie. With an if statement, we are going to check the cookie's value against our desired match developer. If it's a match, we will show one type of content, otherwise we will show our default content. It's quick to implement, let's take a look at the code.

It's that easy, have fun!