Setting Up Custom Targeting

Overview

To enable Custom Targeting, you'll want to tie queries written in our Zerkel Language to a Flight or Ad using the API or UI.

1084

🚧

When passing queries via CustomTargeting field in API, make sure quotation marks are escaped so they don't break JSON. For example:

name = "Adzerk" would become name = \"Adzerk\"

Flight Level with API

When creating flights via the Create Flight endpoint, include the string under the CustomTargeting parameter. You can also update CustomTargeting with the Update Flights endpoint.

Below is a request to create a flight targeting:

  1. Age > 25
  2. Gender = Male
{
  "CampaignId":1234,
  "PriorityId":1325,
  "Name":"Sportsball",
  "StartDateISO":"2017-05-01T00:00:00.00.0000000",
  "GoalType": 1,
  "CustomTargeting":"(age > 25 and gender = \"male\")"
}

Here is a request to create a flight targeting IPs that contain the string "74.125", using Reserved Keys:

{
  "CampaignId":1234,
  "PriorityId":1325,
  "Name":"Sportsball",
  "StartDateISO":"2017-05-01T00:00:00.00.0000000",
  "GoalType": 1,
  "CustomTargeting": "$ip like \"74.125.*\"" 
}

🚧

The max length of CustomTargeting for flights is 1000 characters.

Ad-Level with API

When creating ads via the Create Ads endpoint, include the string under the CustomTargeting parameter.

Below is a request to create an ad targeting:

  1. Age > 25
  2. Gender = Male
{
    "CampaignId":123,
    "Creative":{
    "Id":12345
  },
    "FlightId":1234,
    "IsActive":true,
    "CustomTargeting":"(age > 25 and gender = \"male\")"
}

Setting Up with UI

  • Flight-Level - Go to Flight Settings, click "Custom Targeting" on the left
  • Ad-Level - When creating/editing a Creative, put in details under "Delivery Settings"

Custom Targeting on Channels

You can also set custom targeting on channels to filter all ad requests to a channel by the custom targeting criteria. This is only useful if your network uses a multi-channel setup rather than a single channel like "All Sites".

For instance, your network may have three channels: "English", "Spanish", and "French". Your goal is to display ads to your users in the language set by their browser.

While you could add the custom targeting $acceptLanguage contains "en-us" to every flight in the "English" channel, it would simpler if you added it to the channel itself.

To do this:

  1. In the UI, navigate to Inventory > Channels.
  2. Click the name of the channel (or the pencil icon).
  3. Insert your custom targeting in the "Custom Targeting" box.
  4. Save the channel settings.