BookmarkSubscribeRSS Feed

The SETTAG Directive

Started ‎03-22-2016 by
Modified ‎03-22-2016 by
Views 1,193

The SETTAG directive is used to set one or more cookies holding supplemental targeting tags. Once set, these cookies provide additional key/value pairs with every subsequent ad request, click, or action. Each cookie can be set to expire after an arbitrary time.


Some Uses of SETTAG

  • As an alternative to user reg. A publisher can call SETTAG after a visitor logs on and provide whatever tags/values are associated with that visitor. The tags and values thus set persist with the visitor's browser and are sent on every subsequent request. There is no need to store visitor data on the back end (a la user reg).
  • To achieve cookie targeting. A publisher could set tags via SETTAG when a visitor hits certain spots on their site, and then target ads against those values.
  • To set a visitor's latitude and longitude, eliminating need to supply them in every call.
  • To test a live page engaging with certain tags that cannot otherwise be provided. For example, calling SETTAG with GEO_COUNTRY=AUS causes subsequent ad calls to override the GEO_COUNTRY tag that was looked up from the visitor's IP address. (Note that setting GEO_IP using SETTAG does not cause a geo lookup to be done mid-session.)
  • To prevent counting impressions, clicks, and actions resulting from testing by SAS or a publisher. This is done by providing the NOLOG tag in the SETTAG call.


Syntax for SETTAG


  • cookieName is the name to give this set of tags. A cookie with this name, prefixed by "VT_" is set on the visitor. If absent, this directive is ignored.
  • secondsToLive is the time-to-live for this cookie, in seconds. For example, TTL=86400 sets the cookie to expire in one day. If absent, the cookie is set to expire at the same time as the visitor's guid/mid (one year by default).
  • urlEncodedTags is the set of tags and values to persist in this cookie. These must be URL-encoded and in pathinfo format; that is, using encoded forward slashes to separate tags. If absent, this cookie is deleted. Use %3D for "=" and %2F for "/".


sets a cookie named VT_BLYTHE that expresses GEO_COUNTRY=FRA. All ad requests, and so on, for the next hour override the visitor's natural GEO_COUNTRY lookup and instead provide FRA as that tag's value.
sets a cookie named VT_LOCATION that supplies the visitor's latitude or longitude in all requests for the next 15 minutes.
sets a cookie named VT_NOLOG that blocks counting all ad requests, and so on, for the next year.
sets a cookie named VT_SOMENETWORK that expresses three tags, NETTAG1, NETTAG2, and NETTAG3. In this example, these might be tags that are not needed by the Engine for targeting, but could be used as generic tokens (for example, %%NETTAG1%%) in a template making an ad call to a network.
clears the VT_BLYTHE cookie.

Multiple cookies can be set for a visitor by calling SETTAG multiple times, each time with a different cookie name. The combined contents of all such cookies are sent to the Engine as supplemental tags in the request. These tags override any tags held with the visitor within the Engine--that is, those produced from geo lookups, device lookups, and user reg. But tags that are explicitly sent in with an ad request override tags provided in these cookies.

If more than one cookie expresses the same tag, it is undefined which one takes precedence.

A tag=value pair included in an ad request URL's pathinfo string which matches the SETTAG name but has a different value will override the SETTAG value.


Multiple Values for a Single SETTAG

SETTAG supports multiple tag values for a single tag in the SETTAG. For example:

creates a cookie 'VT_MULTI=hockey,football'.The visitor would be assigned the tag/values of 'sports=hockey,football'.



Values for a tag can be appended in a single cookie using the following sequence:

  • /settag/tags=geo_country=usa
  • /settag/append=1/tags=geo_country=gbr

The visitor would first be assigned the tag/value of geo_country=usa, and then the following request with APPEND=1 specified would assign the visitor the tag/values of geo_country=usa,gbr. The APPEND option can be used in conjunction with the TTL option detailed above.


SETTAG persist

If the SETTAG request uses the "/name={cookieName}" directive, the visitor's values are stored with the cookie. Otherwise, the values are stored in the visitor's session and discarded after the session.

If not using "/name={cookieName}", adding "/persist=1" to the SETTAG request saves the values beyond the visitor's session. The values' lifespan is determined by the "/ttl={X seconds}" directive in the SETTAG request.


Read Usage Note 53759: The SETTAG Directive to check for any updates to the info above.

Version history
Last update:
‎03-22-2016 02:49 PM
Updated by:


Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.


Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags