The management of resource targeting is a central feature of the Display & Video 360 API. Targeting can be assigned to multiple resource types and utilizes a number of other resources and ID spaces. This page details limitations to note and best practices to implement in your adoption of the Display & Video 360 API Assigned Targeting Options services.

Utilize targeting inheritance

Targeting assigned to some resources can be inherited by their child resources. Targeting options inherited by a child resource are retrievable but not editable on the child resource level. This enables brand safety settings and other targeting to be enforced across the entirety of a partner or advertiser.

The path of inheritance can be seen in the diagram below:

Targeting inheritance diagram

As specified in the diagram, some targeting levels only support a subset of targeting types. This means that some targeting options cannot be set at higher levels and inherited, but instead need to be set at a lower level.

Be aware of targeting assigned at line item creation

Other than inherited targeting options, most targeting can only be assigned after a line item is created. However, there are a few targeting types that have a default subset of values assigned to line items at line item creation. Those targeting types are:

Attempting to create existing or delete non-existing assigned targeting options returns an error, so we recommend that you be aware of the full targeting suite that is assigned to your line items upon creation. If you need to retrieve the targeting assigned to a line item across targeting types, use advertisers.lineItems.bulkListLineItemAssignedTargetingOptions.

Do not expect automatic "default targeting"

In Display & Video 360, targeting set at the campaign or insertion order level is not immediately passed to their child line items. This targeting is known as "default targeting" and is used as a targeting template that is applied to line items subsequently created in the UI.

In the Display & Video 360 API, default targeting is not automatically applied to newly created line items. Basic line item creation does not copy over any campaign or insertion order level targeting. In this case, desired targeting must be applied to line items separately through assigned targeting option create or bulk edit methods.

Special methods can be an exception. For example, line items created through advertisers.lineItems.generateDefault inherit settings from their parent insertion order, which includes assigned targeting.

Assign audience targeting with a single option

Targeting options for most targeting types are assigned individually. Audience group targeting does not follow this modular convention, but instead is assigned in a single, configurable audience group targeting details object that lists the IDs of audiences to include and exclude when serving ads. The assignedTargetingOptionId for this audience group option, once assigned, is always "audienceGroup".

This design means that any change to audience group targeting must be done by first deleting the existing audience group assigned targeting option and then creating a new audience group targeting option with the desired changes. This can be done in a single request using advertisers.lineItems.bulkEditLineItemAssignedTargetingOptions.

The following code is an example of how to update audience targeting in order to positively target additional Google audiences:


long advertiserId = advertiser-id;
long lineItemId = line-item-id
List<Long> addedGoogleAudienceIds =

// Build Google audience targeting settings objects to add to audience
// targeting.
ArrayList<GoogleAudienceTargetingSetting> newGoogleAudienceSettings =
    new ArrayList<GoogleAudienceTargetingSetting>();

// Convert list of Google Audience IDs into list of settings.
for (Long googleAudienceId : addedGoogleAudienceIds) {
  newGoogleAudienceSettings.add(new GoogleAudienceTargetingSetting()

// Create relevant bulk edit request objects.
BulkEditLineItemAssignedTargetingOptionsRequest requestContent =
    new BulkEditLineItemAssignedTargetingOptionsRequest();
AudienceGroupAssignedTargetingOptionDetails updatedAudienceGroupDetails;
ArrayList<DeleteAssignedTargetingOptionsRequest> audienceGroupDeleteRequests =
    new ArrayList<DeleteAssignedTargetingOptionsRequest>();

try {
  // Retrieve existing audience group targeting.
  AssignedTargetingOption existingAudienceGroupTargetingOption =

  // Extract existing audience group targeting details.
  updatedAudienceGroupDetails =

  // Build and add delete request for existing audience group targeting.
  ArrayList<String> deleteAudienceGroupAssignedTargetingIds =
      new ArrayList<String>();

      .add(new DeleteAssignedTargetingOptionsRequest()
catch (GoogleJsonResponseException e) {
  updatedAudienceGroupDetails =
      new AudienceGroupAssignedTargetingOptionDetails();

// Set delete requests in edit request.

// Construct new group of Google Audiences to include in targeting.
GoogleAudienceGroup updatedIncludedGoogleAudienceGroup =
if (updatedIncludedGoogleAudienceGroup != null) {
  List<GoogleAudienceTargetingSetting> updatedGoogleAudienceSettings =
} else {
  updatedIncludedGoogleAudienceGroup = new GoogleAudienceGroup();

// Add new Google Audience group to audience group targeting details.

// Create new targeting option to assign.
AssignedTargetingOption newAudienceGroupTargeting =
    new AssignedTargetingOption();

// Build audience group targeting create request and add to list of create
// requests.
ArrayList<AssignedTargetingOption> createAudienceGroupAssignedTargetingOptions =
    new ArrayList<AssignedTargetingOption>();
ArrayList<CreateAssignedTargetingOptionsRequest> targetingCreateRequests =
    new ArrayList<CreateAssignedTargetingOptionsRequest>();
targetingCreateRequests.add(new CreateAssignedTargetingOptionsRequest()

// Set create requests in edit request.

// Configure and execute the bulk list request.
BulkEditLineItemAssignedTargetingOptionsResponse response =


advertiser_id = advertiser-id
line_item_id = line-item-id
added_google_audiences = [google-audience-id-to-add,...]

# Build Google audience targeting settings objects to create.
new_google_audience_targeting_settings = []
for google_audience_id in added_google_audiences:
     {'googleAudienceId': google_audience_id}

# Retrieve any existing line item audience targeting.
retrieved_audience_targeting = service.advertisers().lineItems(

updated_audience_group_details = {}

# Copy over any existing audience targeting.
if 'audienceGroupDetails' in retrieved_audience_targeting:
 updated_audience_group_details = retrieved_audience_targeting[

# Append the new Google audience IDs to any existing positive Google
# audience targeting.
if 'includedGoogleAudienceGroup' in updated_audience_group_details:
 updated_audience_group_details['includedGoogleAudienceGroup'] = {
     'settings': new_google_audience_targeting_settings

# Build bulk edit request.
bulk_edit_request = {
   'deleteRequests': [
         'targetingType': "TARGETING_TYPE_AUDIENCE_GROUP",
         'assignedTargetingOptionIds': [
   'createRequests': [
           'targetingType': "TARGETING_TYPE_AUDIENCE_GROUP",
           'assignedTargetingOptions': [
               {'audienceGroupDetails': updated_audience_group_details}

# Update the audience targeting
updated_audience_targeting = service.advertisers().lineItems(


$advertiserId = advertiser-id;
$lineItemId = line-item-id;
$addedGoogleAudienceIds = array(google-audience-id-to-add,...);

// Convert list of Google Audience IDs into list of Google audience
// settings.
$newGoogleAudienceSettings = array();
foreach ($addedGoogleAudienceIds as $googleAudienceId) {
    $newSetting =
        new Google_Service_DisplayVideo_GoogleAudienceTargetingSetting();
    $newGoogleAudienceSettings[] = $newSetting;

// Create a bulk edit request.
$requestBody =
    new Google_Service_DisplayVideo_BulkEditLineItemAssignedTargetingOptionsRequest();

$audienceGroupDeleteRequests = array();

try {
    // Retrieve existing audience group targeting.
    $existingAudienceGroupTargetingOption = $this

    // Extract existing audience group targeting details.
    $updatedAudienceGroupDetails =

    // Build and add delete request for existing audience group
    // targeting.
    $deleteAudienceGroupAssignedTargetingIds = array();
    $deleteAudienceGroupAssignedTargetingIds[] = "audienceGroup";

    $audienceGroupDeleteRequest =
        new Google_Service_DisplayVideo_DeleteAssignedTargetingOptionsRequest();
    $audienceGroupDeleteRequests[] = $audienceGroupDeleteRequest;
} catch (\Exception $e) {
    $updatedAudienceGroupDetails =
        new Google_Service_DisplayVideo_AudienceGroupAssignedTargetingOptionDetails();

// Set delete requests in edit request.

// Construct new group of Google audiences to include in targeting.
$updatedIncludedGoogleAudienceGroup = $updatedAudienceGroupDetails

if (!empty($updatedIncludedGoogleAudienceGroup)) {
    // Get existing settings.
    $updatedGoogleAudienceSettings =

    // Add new Google audiences to existing list.
    $updatedGoogleAudienceSettings = array_merge(

    // Set updated Google audience list.
} else {
    // Create new Google audience group.
    $updatedIncludedGoogleAudienceGroup =
        new Google_Service_DisplayVideo_GoogleAudienceGroup();

    // Set list of new Google audiences for targeting.

// Add new Google Audience group to audience group targeting details.

// Create new targeting option to assign.
$newAudienceGroupTargeting =
    new Google_Service_DisplayVideo_AssignedTargetingOption();

// Build audience group targeting create request and add to list of
// create requests.
$createAudienceGroupAssignedTargetingOptions = array();
$createAudienceGroupAssignedTargetingOptions[] =
$createAudienceGroupTargetingRequest =
    new Google_Service_DisplayVideo_CreateAssignedTargetingOptionsRequest();
$createRequests[] = $createAudienceGroupTargetingRequest;

// Set create requests in edit request.

// Call the API, editing the assigned targeting options for the
// identified line item.
$response = $this

Be prepared for targeting options to be deprecated

Targeting options are not static, and a small number may be deprecated from time to time. Targeting options, once deprecated, do not affect a line item’s ad serving. After deprecation, these options will be unassigned from existing line items and requests that attempt to retrieve or assign these options will result in errors. In order to avoid these errors, we recommend that you do the following:

  • Regularly check stored targeting option IDs. In order to conserve quota, we recommend that you cache regularly-used IDs. However, storing IDs means that you may not realize a targeting option has been deprecated. For this reason, you should regularly use targetingOptions.targetingTypes.get to retrieve all stored targeting option IDs to confirm that they are still supported by Display & Video 360.
  • Check line items for relevant non-blocking warnings. When a line item is targeting a deprecated geographical region targeting option, a TARGETING_DEPRECATED_GEO_TARGET non-blocking warning is added to the line item’s warningMessages field. Regularly checking line items for this warning will keep you aware of whether a targeting option you are using has been deprecated.

Do not make concurrent requests updating the same line item

Attempting to update the settings or assigned targeting for a single line item using multiple concurrent requests will return an error. Applicable requests include:

If you need to add or remove multiple assigned targeting options for a single line item at the same time, you should use a single advertisers.lineItems.bulkEditLineItemAssignedTargetingOptions request. If you want to update a line item's settings and targeting, queue the advertisers.lineItems.patch request and relevant targeting request to ensure the second request isn't sent until the first returns a response.