In a perfect world, every creative loads instantly and renders perfectly. Unfortunately, the real world is a little more complicated. Creative performance is a real concern - slow ads can hurt user trust. Thankfully you can utilize existing tools, such as the DFP API, to help test and validate a creative's performance before it serves.
As a starting point, let's call out a feature you may already be aware of: DFP Preview URLs . These allow you to preview a creative either on its own or in your site, before it starts serving.
Both types of preview URLs can be retrieved using the DFP API. Every creative has a previewUrl field , and you can generate in-site previews using the LineItemCreativeAssociationService's getPreviewURL method .
Using these, you can programmatically get a URL for every creative in your network and keep tabs on new or updated creatives by filtering with lastModifiedDateTime . You can test every new creative that comes into your network and make sure it's up to your standards - the files aren't too large, it renders properly, it loads quickly, and so on.
Here's what your application might look like:
As you can see, we're still missing a couple pieces of the puzzle. How do you programmatically load the preview URLs in a browser and get the measurements we want? What measurements do we want?
The first question has a straightforward answer: WebDriver . You can load the preview URL with the browser automation tool. It can take screenshots, click on elements, and extract information from a web page.
When it comes to what metrics you want to collect, it's entirely up to you. Modern browsers log a wealth of information about page performance and network timing. ChromeDriver even has an extension that sends these performance logs back to your WebDriver application in the form of logs. Using these logs you can get whatever metrics are important to you, including page load or network events.
If the performance logs are too granular, you can leverage existing tooling instead. The Google Publisher Console is great for investigating and debugging a creative's performance. Just append a URL parameter and you get access to a debugging console by pressing Ctrl+F10 (⌘+F10 on Mac).
Both of these can be done through WebDriver. Add the same URL parameter when you create an in-site preview URL (the one you create with the LineItemCreativeAssociationService ) and send the key presses through WebDriver.
Let's see it in action. To test this, create a blank test page and tag it. Then use the API to get any new creatives and associate them with a test line item. Finally, use the LineItemCreativeAssociation service to get a preview URL for WebDriver.
The implementation details are up to you, but when you mix the DFP API with a browser automation tool like WebDriver, it opens up a world of testing possibilities.
- Chris Seeley , DFP API Team