Target: Cookie Contents

Use this target in web activities to target customers whose current session has a cookie from your site that contains certain values. You can personalize content in an e-Marketing Spot according to the customer's cookie values.

Cookies are pieces of text that consist of a name and value that your site can place on each customer's computer to store information about that customer. Your store's developers determine what type of cookies your store uses. Some cookies can store data that can prove useful in personalizing a customer's experience on your store.


You have an advertisement that you want to display on your home page, but only to customers who live in the city of Phoenix, Arizona. These customers have a ZIP code that begins with the numbers 850. Your site is configured to store ZIP codes in a cookie. For example, a customer from Phoenix, Arizona has a cookie that looks like this:

You can then set up the following web activity:

When a customer views the e-Marketing Spot on the home page: If the customer has a cookie that contains a ZIP code that begins with 850, then display the advertisement for customers who live in the city of Phoenix.

Example of Target: Cookie Contents

Prerequisites for using this target

  • Make sure that your site is configured to support the Management Center marketing features.
  • Make sure that your cookies are set on a previous request as they cannot be read if they are part of the current request processing.
  • Discuss with a store developer the following issues:
    1. Your site must use cookies that store the information that you want to use to target specific types of customers. In the previous ZIP code example, your site must gather customers' ZIP codes and store them in a cookie. It is up to your store's developers to determine how to gather your customers' information. To ensure that the Cookie Contents target can match a customer's cookie values, check with developers that the cookie values you want to target are URL encoded and follow these rules:
      • Cookie values cannot contain ampersands (&) or commas even if they are encoded. These characters are reserved for internal use by the marketing services.

        As a best practice, developers can use URL encoding to encode all other special characters in cookie values, that is, any characters that are not letters or numbers. For example, encode semi-colons as %3B, spaces as %20, and the percent sign (%) as %25.

      • Cookie values cannot contain leading or trailing spaces. In Management Center, when you enter the value to match, the software trims any leading or trailing spaces from your entry. Therefore, there is no way to match a cookie value with leading or trailing spaces.
    2. A store developer must add some lines of code to the JSP file for the e-Marketing Spot used in the web activity. The lines of code pass the specified cookie name and value to the marketing services for evaluation when a customer views the page that contains the e-Marketing Spot. The marketing services look for a matching cookie name and value to determine whether to display your targeted content. For instructions, see Modifying the e-Marketing Spot JSP file to support the Cookie Contents target.

Guidelines for using this target

When you are setting up this target:
  • You can specify only one cookie name to match, but you can specify one or more values.
  • You can specify that the server must match the exact cookie value, a portion of the value, or any value.
  • Alternatively, you can target customers who do not have the cookie criteria that you specify.