Tag Archives: PQL

A day in the life of a mobile line item (part 1)

Imagine for a moment that you're a mobile line item. You've just been initialized locally, and all of a sudden you’re having an existential crisis -- what makes you, you? How are you different from all the other line items? Sure your associated creative might be a bit different from other line items and you might have a few extra impressions allotted to your goal, but what truly makes you... unique? In this series of posts, we'll take you on an incredible journey through a day in the life of a mobile line item -- from how to target mobile to the actual delivery on a device.

Adding mobile specific targeting

It all starts similarly enough: you need a name, an order ID, start and end dates, a goal, and all the usual suspects -- but wait, there's more! Instead of just having custom criteria, ad units, and geo-targeting, you find that you also have TechnologyTargeting fields specified, like:

  • DeviceCategoryTargeting
  • OperatingSystemTargeting
  • MobileCarrierTargeting

Now, say you're being created as a line item to advertise Android tablet cases. It doesn't make much sense for you to be delivered to an iPad or an iPhone, so we need to add technology specific targeting.

To do so using Java, we would first set the DeviceCategory object with the targeting ID of the 'Tablet' category and the OperatingSystem object with the targeting ID of 'Android', both of which we'd pull from the PublisherQueryLanguage service:

    DeviceCategory deviceCategory = new DeviceCategory();
OperatingSystem operatingSystem = new OperatingSystem();

deviceCategory.setId(30002L);
operatingSystem.setId(501013L);

These would then be set on the DeviceCategoryTargeting and OperatingSystemTargeting objects:

    DeviceCategoryTargeting deviceCategoryTargeting = new DeviceCategoryTargeting();
OperatingSystemTargeting operatingSystemTargeting = new OperatingSystemTargeting();

deviceCategoryTargeting.setTargetedDeviceCategories(new DeviceCategory[] {deviceCategory});
operatingSystemTargeting.setOperatingSystems(new OperatingSystem[] {operatingSystem});

Finally, the Targeting object will have a TechnologyTargeting object set for DeviceCategoryTargeting and also OperatingSystemTargeting:

    TechnologyTargeting techTargeting = new TechnologyTargeting();
technologyTargeting.setDeviceCategoryTargeting(deviceCategoryTargeting);
technologyTargeting.setOperatingSystemTargeting(operatingSystemTargeting);

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

Now what happens? You're a line item that has a bit of technology targeting specified, but where are you off to next? Stay tuned for what happens next in - 'A day in the life of a mobile line item, part 2.'