The Mobile Ads Garage is a new series that covers how to use the Mobile Ads SDK to display ads from AdMob and Doubleclick For Publishers. Each episode will cover one aspect of the SDK, break down the feature, and show screencasts of real implementations on both Android and iOS – all in a friendly format.

With two episodes on banner ads on the books, the Mobile Ads Garage now turns its focus to interstitial ads.

Andrew and Gary the Graphics Guy are back this week with a detailed explanation of the interstitial ad lifecycle, how to load ads, and how to display at just the right time. Along the way you'll get screencasts of Android Studio and Xcode, plus links to guides, samples, and other resources.


If you like the video, save the Mobile Ads Garage playlist to your YouTube Playlist collection and you'll never miss an episode.

We’d love to hear which AdMob features you’d like to learn more about. The comment sections for the videos are open, and you're welcome to toss out ideas for new episodes and examples you'd like to see. If you have a technical question relating to something discussed in one of the episodes, you can bring it to our support forum.

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.

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.

If you like the video, save the Mobile Ads Garage playlist to your YouTube Playlist collection and you'll never miss an episode.

We’d love to hear which AdMob features you’d like to learn more about. The comment sections for the videos are open, and you're welcome to toss out ideas for new episodes and examples you'd like to see. If you have a technical question relating to something discussed in one of the episodes, you can bring it to our support forum.