We are constantly working to improve DFP to help our publishers serve ads in the best way possible. One recent improvement to DFP has been an update to the geography data used for targeting. This update also deprecates locations that may no longer exist, may be obsolete, or are no longer recognized. Any deprecated locations targeted by existing line items will be ignored, but still shown so you can update them appropriately.
Keeping our geography data up-to-date allows for more accurate ad targeting, which better helps publishers serve ads to their target audience. This update also lays the ground work for some further updates we have planned. These changes may affect how you use the API to integrate your product with DFP, so we wanted to give some tips to smooth out the transition.
- All deprecated locations can be found by using PublisherQueryLanguage.select on the geo tables with the following query:
"WHERE targetable = false"
- When creating or updating line items with geo targeting, ensure that you are using the base Location object instead of one of the Location subtypes.
- For developers who have cached any geo targeting tables, we recommend you update your local database of targetable locations. When doing so, ensure you examine the targetable field and mark it as deprecated or remove it from your local database so as not to use it in the future.
You may also notice some hierarchy changes in the new geo data. For example, some cities may no longer have a metro region. These changes are intentional as we work to better update and classify our geographic locations. If you have questions, please feel free to ask them on our
forum.
To tie this all together, we have written
an example that checks every line item in a network to see if it is targeting a deprecated location and needs to be updated. Doing this check will save you trouble later if you try to update a line item that is targeting a deprecated location as you will need to remove the deprecated location from targeting before DFP will allow you to make the update. A snippet of the example is as follows, and you can find the full example on the
PHP client library google code site.
// Find all untargetable locations.
$untargetableLocationIds = getAllUntargetableLocations($user);
printf("Found %d untargetable locations.\n",
count($untargetableLocationIds));
// Build a map of geo targets to the line items targeting them.
$geoTargetToLineItemsMap = buildGeoTargetToLineItemsMap($user);
// Find all the deprecated geo targets from that map.
$lineItemsToUpdate = findLineItemsToUpdate($geoTargetToLineItemsMap,
$untargetableLocationIds);
$i = 0;
// Print the line items that need to be updated.
foreach ($lineItemsToUpdate as $geoTargetId => $lineItemIds) {
printf("%d) The following line items are targeting deprecated location "
. "%d and need to be updated: %s\n", $i, $geoTargetId, implode(', ',
$lineItemIds));
$i++;
}
- Vincent Tsao, DFP API Team