Contact support

Set up cookie targeting

Overview

Equativ's cookie targeting lets you target data stored and updated in cookies. For example, you can store profile data about a user in a cookie and target an insertion to this profile data.

Target cookie data

In ad requests, data passed from cookies and data passed as keywords or key-value pairs are processed the same way. Therefore, to target data stored in cookies, use the usual keyword targeting options. For more information, see Set keyword targeting.

Cookie targeting string

The targeting string contains the data to be stored in the cookie. It is a sequence of key-value pairs in the following format:

  • Multiple key-value pairs must be separated by semicolons, for example key1=value1;key2=value2.
  • The key part must not contain the characters ; or =.
  • The value part must not contain the character ;.
  • All other Unicode characters are allowed​

Cookie request and response

The cookie request is a call to Equativ containing the cookie targeting string to be stored as well as information about the time to live of the cookie. Equativ responds to a cookie request with a cookie containing the requested key-value pairs and the specified time to live.

The status code returned by Equativ is always HTTP 200 OK. There is no notification in case of bad requests, such as missing parameters or inaccurate formatting. 

Store data in a partner cookie

With the partner cookie, you can store different sets of data in separate cookies. Typically, each partner cookie represents a partner such as a behavioral targeting vendor or a retargeting vendor. The partner name provided in the cookie request is included in the cookie name, formatted as a hash.

Each cookie request fully overrides any existing data in the cookie. Removing or adding individual key-value pairs is not supported in partner cookies.

A partner cookie request must follow this pattern: 

(http|https)://<equativDomain>/diffx/track/partner?partnername=<partnerName>&value=<targetingString>&expdate=<daysTillExpiry>
  • Replace http by https for a secure call.  
  • Replace  <equativDomain> by the specific subdomain of your network in EMP.

The cookie stored in response to a partner cookie request is named partner-<hash>, where <hash> is the hashed partner name.

The following table describes the parameters to store a partner cookie: 

Name Mandatory Description Default value
expdate no The time to live in days to be assigned to the partner cookie. 30
partnername yes The partner name. n/a
value yes The targeting string—containing the key-value pairs—to be stored for the partner. n/a

The following is an example of a partner cookie request:

http://diff.smartadserver.com/diffx/track/partner?partnername=mypartnercookie&value=mykey=myvalue

Store, clear and update data in the comp cookie

With the comp cookie, you store all the data in one single cookie, called comp. You can clear all key-value pairs or update individual key-value pairs.

The comp cookie is named comp-<networkId>

The request to store data in the comp cookie fully overrides any previously stored data. It must follow this pattern:

http://<equativDomain>/profile/write?nwid=<networkId>&value=<targetingString>&ttl=<timeToLive>&tu=<timeUnit>
  • Replace <equativDomain> by the specific subdomain of your network in EMP.

The following table describes the parameters to store comp cookie data: 

Name Mandatory Description Default value
nwid yes The network ID. n/a
ttl no The time to live to be assigned to the cookie (max. 30 days). 30
tu no The time unit to be used for the time to live, if ttl is specified. Values: seconds, minutes, hours, days. days
value yes The targeting string—containing the key-value pairs—to be stored. n/a

The following is an example of a request to store comp cookie data:

http://diff.smartadserver.com/profile/write?nwid=73&value=mykey=myvalue&ttl=10&tu=days

The request to clear any data in the comp cookie must follow this pattern:

http://<equativDomain>/profile/clear?nwid=<networkId>
  • Replace <equativDomain> by the specific subdomain of your network in EMP.

The following table describes the parameters to clear any comp cookie data: 

Name Mandatory Description Default value
nwid yes The network ID. n/a

The following is an example of a request which clears any data in the comp cookie:

http://diff.smartadserver.com/profile/clear?nwid=73

The request to update data in the comp cookie removes and stores data in the comp cookie. It must follow this pattern:

http://<equativDomain>/profile/update?nwid=<networkId>&set=<by tghe>&delete=<keys>&ttl=<timeToLive>&tu=<timeUnit>
  • Replace <equativDomain> by the specific subdomain of your network in EMP.
  • Do not use duplicate keys. When the request is processed, the delete operation is always applied before the set operation. Therefore, if a key is specified in both the set and the delete parameter, only the data of the set parameter will be ultimately stored in the cookie.

The following table describes the parameters to update comp cookie data: 

Name Mandatory Description Default value
delete no

The list of keys to be removed from the previous targeting string, separated by semicolons. The operation removes the keys and their respective values.

For example, if the currently stored targeting string is name=bob;color=green;car=big and  if the delete parameter is name;color, the remaining stored targeting string is car=big.

At least one of the set and delete parameters must be specified for the request to be valid.

n/a
nwid yes The network ID. n/a
set no

The targeting string containing the key-value pairs to be added to the existing data in the comp cookie.

At least one of the set and delete parameters must be specified for the request to be valid.

n/a
ttl no The time to live to be assigned to the cookie (max. 30 days). 30
tu no The time unit to be used for the time to live, if ttl is specified. Values: seconds, minutes, hours, days. days

The following is an example of a request which adds name=bob;color=green;car=big to the comp cookie:

http://diff.smartadserver.com/profile/update?nwid=73&set=name=bob;color=green;car=big&ttl=10&tu=days

The following is an example of a request which deletes the keys name and color with their respective values from the comp cookie:

http://diff.smartadserver.com/profile/update?nwid=73&delete=name;color