We have updated our Privacy Policy and Privacy Options

Got It

Developer Download: How Do I Use Cookies to Target Custom Segments?


In my last post I went over how you can use JavaScript to create a test using the keyword entered into a search engine. In this post, I’m going to expand on the use of JavaScript and dive into using cookies to create smarter tests. Using a cookie to target a user group can be a valuable weapon in your testing arsenal.

Figure out what you want to test.
Let’s say we want to target visitors that have signed up for your newsletter. We want to present these users with content in place of the newsletter signup form since they don’t need to sign up twice. The content that we are using to replace the signup form will be a great test to see which performs better. What if we want to cross-sell a different area of your site? We’ll do an A/B test on two designs that drive the visitor to the same location; we then will track the clicks on the design in the new area and show the campaign only to users that have signed up for your newsletter.

The Cookie
The very first step will be to create a cookie that stores a parameter to a value once a user has signed up for your newsletter. You will need to create this cookie and logic outside of any testing platform. Here is a quick tutorial on how to setup a cookie with JavaScript. Once we have the cookie available on all pages after a visitor has signed up for your newsletter, we can setup Visual Website Optimizer to handle this test for us.

Visual Website Optimizer (VWO)
VWO makes this type of test fairly easy to accomplish. You will need to create a new A/B test and enter the URL of any page that has your newsletter signup form on it. From there you will be taken to the WYSIWYG editor. Then create two variations of your new creative files with a link on it to your new page. On each variation right click the new creative and click “Track Clicks.” This will create a goal for any clicks on that particular link. At this point you should have your control (default content) and two variations, with a goal of your visitors clicking the new link. Since the goal is already set we can continue on to step five.

If you have your signup form on multiple pages you will need to change “Run test on URL(s)” to a URL pattern that fits what pages you would like to test on. At this point we will also need to add a visitor condition to “Target test to a Segment.” The first dropdown we will change to “Cookie Value,” set the name to the name of your cookie. Keep the second dropdown on “Equals to (case insens.)” and in the fourth field set it to the value you set the cookie to when a user signs up for your newsletter.

Here is where VWO gets a little tricky. You will want to click “Create Your Test.” On this next screen make sure you click “Start Test Later” because there are still some things we need to change. When you click that button it will take you to a screen with tabs; click on the “View/Edit Test Details” tab. In the “Variations” section of this tab you will see the “Traffic Distribution” option, click “Edit.” You will now want to change your control traffic to 0% because we want all users that are in this campaign to see either variation one or two. Variation one and two traffic should then be divided 50% and 50%. We are now ready to run our campaign in VWO!

Creating a test that uses cookies is a great way to target custom segments. By targeting these segments you are providing more valuable content to the visitors of your site that have completed specific behaviors. Highly targeted content will help increase conversions!