Retargeting / Segment Targeting


Segment targeting is a form of user-level targeting that involves adding a user to a specific segment and then setting up campaigns that target just users from that segment. One of the major use cases of this is retargeting, where you target someone who has already visited another web property / webpage.

It can be done in one of two ways:

TypeSituationHow It Works
Ados.js MethodAdvertiser wants to target someone who has visited their site when that person is on YOUR siteAdvertiser drops a retargeting pixel on their site that updates the user's UserDB record if hit. Then you can target this segment
API MethodYou want to target users who have visited another of your web properties, a specific page, or some other reason for building different segmentsYou create a segment, then ping UserDB's API Endpoint to add a user to it when they undergo the action. Then you can target this segment


Users stay in their retargeting segment for approximately 90 days

Ados.js Instructions

With retargeting, advertisers place a pixel on THEIR site and then can target those users when they appear on YOUR website or app.

  1. First create the pixel (see below)
  2. Have the Advertiser put the pixel somewhere on their site. It could be on every page, just the homepage, a specific product page, checkout, etc. When a person lands on a page with the pixel, their UserDB record gets updated that they are in that segment
  3. Create a Flight/Ad targeting this segment


This method requires you to have a JavaScript Ados.js integration. If you use the Decision API, this form of retargeting will not be doable.

Manually Creating the Retargeting Pixel (Ados.js Method)

You'll want to give each advertiser their own pixel. Most will need only one, but you could provide multiple if needed.

The pixel template is: https://e-{networkId}{networkId}/rt/{advertiserID}/{segment}/i.gif.

This URL is composed of three sections you will need to fill-out.

This is your Network ID
This is the Advertiser's specific Advertiser ID
This is an integer you choose to denote the Retargeting segment. You could have multiple if you wanted to track multiple pages. That said, this is rare and most advertisers will just want a single pixel. In this case, you can just set segment to 1

Example pixel would be:

You'd then ask the advertiser to place this wherever they want. When a user visits that page, the pixel fires and updates their UserDB record.

API Instructions

You can also add a user directly to a segment using the Retargeting API Endpoint, which updates the user's UserDB record. This requires the user of a persistent userkey attached to that user.

Since this is tied to an Advertiser ID, you'll want to make sure you are set up as an advertiser in the system.

An alternative method is to use Interest Targeting. For instance, if you want to target people who have visited your shopping cart, you could:

  1. Create a retargeting segment of 1, and ping the Retargeting API Endpoint when they visit it
  2. Create an interest of cart, and ping the Interest API Endpoint when they visit it

Both can then be targeted using Custom Targeting and Reserved Keys.

One reason you may prefer (or not prefer) the retargeting segment is that users stay there approximately 90 days. So, if you like the idea of users eventually dropping out of the segment automatically, that may be a preferred path.

Targeting These Segments

When you create a Flight/Ad in the UI or Create Flight/Create Ads endpoints, you'll want to use Reserved Keys to build a segment around $user.retargetingSegments.

In the query, the string should look like this: $user.retargetingSegments.b42 = 1.

Here, b42 refers to the Advertiser ID. If the Advertiser's ID is "676", it would be $user.retargetingSegments.b676. "1" is the code of the retargeting segment.

For instance:

  "Name":"Retargeting - Homepage",
  "GoalType": 1,
  "CustomTargeting":"$user.retargetingSegments.b42 = 1"

Viewing Retargeting Segments

If you use the UserDB Read User Endpoint, you can pull and filter the resulting data by the retargetingSegments field to see all the Retargeting Segments you have created.


The system does not contain a friendly name for the segments, so you'll have to keep track that, say, Segment 1 refers to the shopping cart.