Setting up an advertiser with insertion orders, line items, and targeting can seem complicated. This guide is here to walk you through the process. Just follow along and you'll have advertisers and line items up and running in no time.
Before you work with the API you should read the API Getting Started section of this documentation. This section provides information on testing environments, usage constraints, API semantics (running commands, filtering, sorting, etc.) and best practices.
Order of Operations
When you set up your buy-side objects, the process will be much simpler if you set those objects up in the correct order. If you don't go in the correct order you'll get partway through something and realize "Oops, I should have created <abc> first." You can always go back and update anything you've already set up, but if you follow this order of operations and you'll make things much easier on yourself.
Also, by following the order we've set out here you're less likely to miss important settings along the way. For example, you can create a line item and campaign without a profile, but that's rarely, if ever, a good idea. The profile determines your targeting, and if you activate a campaign without a profile you'll be bidding on any available impression, possibly missing everyone in your target audience and exhausting your budget very quickly. If you methodically go in order, you're much less likely to forget something.
Here is the order of operations for setting up your buy-side objects:
At the top of the order is the advertiser. Creating the advertiser is always the first step. You can have multiple advertisers within your network, and each advertiser can have many insertion orders and line items.
- Non-Spending Objects
The next step encompasses several sub-steps. All the sub-steps within this step can be created in any order. If you want to create a segment pixel before a creative or a creative before a segment pixel, that's entirely up to you. But - and here's the important part - you should create all the Step 2 objects before you move on to Step 3 because you'll most likely be using some of the Step 2 objects in Step 3. (Note that there are more options in this step than are shown here. The objects we create in this set are an example of the non-spending objects you can create.)
Next comes the profile. Profiles define all the ways you can target users and inventory in your line items or campaigns. If you don't create your profiles before you move on to the next steps, you'll have to update everything later with the profile information.
- Insertion Order
In this step you create your insertion orders. The insertion order contains information such as the total budget an advertiser allocates for a period of time, or which third-party verification the advertiser utilizes. Insertion orders also allow you to group line items and campaigns. You can create multiple insertion orders under an advertiser.
- Line Item
In Step 5 we create the line item. The line item contains information such as how much the advertiser has budgeted toward an offering, or which targeting the advertiser requires. (This is where you can add the profiles created in Step 3.) You can create multiple line items under an advertiser or insertion order.
In the final step we create the campaign. The campaign is where you get more granular in defining how you will meet the advertiser's goals. You can attach a profile to a campaign.
Now that you understand the pieces of the buy-side puzzle and how to place them in order, let's walk through the creation of your buy-side implementation. These examples will take you through a very simple setup. There are many more fields and settings available for each service than what is shown here. See the Reference section for details on each service.
Step 1: Advertiser
We begin, of course, with the advertiser. We create a JSON file containing the name of the advertiser and their status. We've left most of the advertisers fields as their default values. However, in Step 4 we're going to create an insertion order. To include insertion orders, you need to set use_insertion_orders to true on your advertiser. See Advertiser Service for more information.
Note that we've set the advertiser state to active. You might prefer to initially set the state of all objects to inactive to ensure you don't begin spending before your advertiser is ready.
Now we do a POST call to the advertiser service, passing it our JSON file.
We've now created an advertiser named Advertiser1. The preceding command will return a message showing your new advertiser, including the advertiser ID. Make a note of this ID; you'll be using it in subsequent commands.
Step 2: Non-Spending Objects
The objects you'll create in this step are "non-spending" objects, meaning there are no monetary amounts associated with them. They are all independent of one another and can be used across different line items and campaigns. You can create these objects in any order. Our diagram shows four types of objects, but there are many more, including third-party pixels, batch segments, and IP range lists. We'll show just a few examples here.
Here is the command that calls the creative service:
Notice that we've passed the advertiser_id in our query string. This allows us to associate the creative with the advertiser we just created.
The contents of the creative.json file depend on the type of creative. There are numerous options; too many to go over here. See the Creative Service to find out more about the types of creatives and how to build a JSON file to create them.
The pixel service generates an ID that can be used to create conversion pixels. These pixels can be placed on advertiser pages to track both view- and click-based conversions. Here is the process for creating a conversion pixel:
Notice that we once again pass the advertiser_id in the query string to associate this pixel with a particular advertiser.
Use the segment service to generate an ID to create segment pixels, which are placed on inventory pages to enable segment targeting. Segment targeting gives you the ability to target users based on the segments they belong to. Users are generally added to segments based on an action, such as clicking on a creative.
Be sure to make note of the ID that's returned, you'll need to add this ID in the next step when you create a profile.
If you forget to keep track of your ID, you can always make another call to the segment service to look it up. Keep in mind, however, that you do have rate limits, so you'll want to be sure you're being efficient in your API calls.
Domain lists allow you to create whitelists or blacklists. Whitelists contain domains that you want to include in your campaign targeting, and blacklists contain domains that you want to exclude.
Notice that the domain list is created by using the domains array. If you need to update a domain list, remember to use the append flag with your PUT command. For example, let's say you want to add domain-d.com and domain-e.com to the list we just created. You would create a new JSON file like this:
To add these fields to the existing list, run this command:
This will append the new domains and your list will now look like this:
If you leave off the append=true flag in your query string, your current list will be replaced by the list in your update. For example, the same PUT command we just ran without append=true would produce this domain list:
Domains you upload must generally conform to the URI spec to be accepted by our API. In practical terms, you probably don't need to worry about this requirement unless you're trying to upload Internationalized Domain Names, in which case you should ensure that any domains that include non-ASCII characters are encoded with Punycode before upload.
Step 3: Profile
After creating the non-spending objects, the next step is to create a profile. The profile is also a non-spending object, but this one must be created after the objects in step 2 because you can use some of those objects in your profile. A profile is a set of targeting parameters, such as gender, age, geography, and frequency. It can be created with several objects in the system, including segment pixels.
In our example, we've used the segment pixel (Segment Pixel 1) that we created in Step 2. This profile will target users based on that segment, and also target domains that are not in the list of excluded domains specified here (competitorURL.com and badURL.com). We could also have used our domain list that we created in Step 2 by using the domain_list_action and domain_list_targets fields.
We'll associate this profile with a line item in Step 5: Line Items. So again, keep track of the returned ID.
Step 4: Insertion Orders
Now it's time to create an insertion order. This is the first of the "spending" objects. These are the objects that determine how much money will be spent over what period of time and on which advertising campaigns. There are two types of insertion orders: seamless and non-seamless. See Insertion Order Service for a detailed description of the difference. Because seamless insertion orders are the preferred model, that's what we're going to create here.
In our next step we're going to create a line item that we'll associate with this insertion order, so once again, keep track of the ID for the insertion order we just created. You'll also need to keep track of the budget interval IDs. You'll use these IDs to associate the budget interval information with the line item.
Step 5: Line Items
As with insertion orders, line items can be seamless or non-seamless. See Line Item Service for details. You can't mix seamless and non-seamless, so we'll be creating a seamless line item to go with our seamless insertion order from Step 4. You can create multiple line items under a single insertion order. We'll also be attaching the profile we created in step 3 to this line item by assigning the profile ID to the profile_id field.
Note the ID from your new line item and we'll continue on to the next step.
Step 6: Campaigns
Last but not least, it's time to create the campaign. You can associated a profile to a campaign rather than to a line item. You can create multiple campaigns for each line item.
And that's it.
There are many more options on each of these services. We've shown you a very basic setup in this walkthrough; you'll most likely want to add much more information as you create your objects. But hopefully this walkthrough has given you a good starting point.
Follow the Order of Operations
- Everything is associated with an advertiser, so if you haven't created the advertiser, do that first.
- Create your non-spending objects (creatives, segments, etc.) in any order ...
- ... except profiles. A profile is a non-spending object, but it needs to be the last non-spending object created. It may depend on some of the other non-spending objects, such as segments.
- Create spending objects in order: insertion order, line item, campaign (if necessary).
Follow these General Guidelines
- Include a budget and flight dates on your spending objects. If an object higher in the the order already has these, lower objects will inherit them unless explicitly changed. Budget and flight dates of lower objects must be within budgets and flight dates for higher objects. (In other words, if your insertion order has a budget interval starting April 2, 2017 and ending April 30, 2017, you can't create a line item under that insertion order with a budget interval of April 20, 2017 - May 5, 2017.)
- Attach a profile to your line item (or campaign). You could have serious targeting and spending issues if you don't attach a profile.
- Set the state field on all spending objects to active when you're ready to start spending on the specified start dates. (If you do not want your objects to start spending on their start dates, set the state to inactive.)