In the v201111 release of the DoubleClick for Publishers (DFP) API, we're bringing you the ability to target your ad units and line items specifically for the mobile platform. The following walk-through based on the CreateMobileLineItem example of the client libraries describes how to create mobile-targeted line items.

Set your Target Platform

The first step is to set the new attribute targetPlatform to MOBILE to specify that the line item is targeted towards mobile platforms rather than the default web browser platform.  Please note that the target platform attribute has also been added to ad units and that attribute needs to be set to MOBILE as well for the targeting to work.

Set your Targeting

We've introduced four mobile targeting options to enable you to target the right platform:
  1. device manufacturer
  2. mobile carrier
  3. mobile device
  4. mobile device submodel

Here is how you set up your targeting to target just Google devices:
Technology manufacturer = new Technology();
// The ID for the Google device manufacturer was fetched from the 
// Device_Manufacturer PQL table.
manufacturer.setId(40100L); 

DeviceManufacturerTargeting manufacturerTargeting = 
    new DeviceManufacturerTargeting();
manufacturerTargeting.setDeviceManufacturers(
    new Technology[] {manufacturer});
manufacturerTargeting.setIsTargeted(true);

TechnologyTargeting technologyTargeting = new TechnologyTargeting();
technologyTargeting.setDeviceManufacturerTargeting(
    manufacturerTargeting);

Targeting targeting = new Targeting();
targeting.setTechnologyTargeting(technologyTargeting);

LineItem lineItem = new LineItem();
lineItem.setTargeting(targeting);

That's it! Your line item is now set to target just Google devices.

For mobile device targeting, you can specify two lists of devices: one that is targeted and one that is excluded.  This allows you to target a device manufacturer but exclude certain devices within that family.  However, if a device is part of a device targeting inclusion list, another device from the same manufacturer cannot be in the exclusion list.  For example, putting the Nexus S in the inclusion list and the Nexus One in the exclusion list will result in the following targeting error:

GenericTargetingError.CONFLICTING_INCLUSION_OR_EXCLUSION_OF_SIBLINGS @ targeting.deviceFamilyTargeting

Instead, we recommend targeting the Google device manufacturer and excluding the Nexus One with the device exclusion list.

As always, we value your feedback, so feel free to leave your questions or comments on our forum or join us at one of our upcoming developer Hangouts.