(Translated by https://www.hiragana.jp/)
Google Ads Developer Blog: mobile

One of the biggest cheers from the crowd at I/O '17 came in response to Stephanie Saad Cuthbertson's announcement that Kotlin would be an officially supported language for Android development starting with Android Studio 3.0. If you're an AdMob or Doubleclick publisher who's been eager to make the leap to a new language, we've got another announcement you might like: now that the new version of Android Studio has launched, we've released bunch of new mobile ads resources to support the Kotlin community.

One of the biggest cheers from the crowd at I/O '17 came in response to Stephanie Saad Cuthbertson's announcement that Kotlin would be an officially supported language for Android development starting with Android Studio 3.0. If you're an AdMob or Doubleclick publisher who's been eager to make the leap to a new language, we've got another announcement you might like: now that the new version of Android Studio has launched, we've released bunch of new mobile ads resources to support the Kotlin community.

If you haven't seen Kotlin yet, it's a statically typed language developed by JetBrains that compiles down to the same JVM bytecode that Java does, but includes a number of new features that can make Android development faster and easier. Things like dedicated data classes with less boilerplate, the Elvis operator, lambdas, SAM conversion, explicit nullability for references, and lots of other modern language features come built-in. For more information, see Introduction to Kotlin (also from I/O '17) in which Andrey Breslav and Hadi Hariri code up examples of the language's best features:

When you're done, you can see those same features in action in our new developer resources, which are now available to the AdMob and Doubleclick publisher community.

Samples

The Mobile Ads DevRel team maintains a GitHub repository of Android samples covering our API, and we've pushed Kotlin versions for each ad format. If you been wondering how Kotlin's Android extensions work with AdMob's banner ad layouts, for example, we've got a new sample app that'll show you. If you're curious how native ads work with all the new nullability stuff, we've got you covered with Kotlin samples for those formats as well.

In addition, we've included a new version of our API Demo app, which features a navigation drawer full of individual API demos for things like banner sizes, category exclusions, and more, all in Kotlin.

Implementation Guides

We've also updated our publisher guides with Kotlin snippets wherever code is shown. Similar to the mobile ads guides for iOS (which show either Swift or Objective-C syntax with a click of a tab), the Android guides now let developers easily switch back and forth between Java and Kotlin implementations.

Questions?

If you take a look at the Kotlin guides and samples and find you've got questions about the best way to implement something in Android's first ever new language, stop by our support forum. Our staff there will be happy to help.



Mobile now accounts for over half of all web traffic1, making performance on small screens more important than ever.

Despite this increase, a recent study by Google found that the average time it takes to load a mobile landing page is 22 seconds. When you consider that 53% of mobile site visitors will leave a site if it takes more than three seconds to load, it’s clear why conversion rates are consistently lower on mobile than desktop.

Website visitors now expect their mobile experience to be as flawless as desktop, and the majority of online businesses are failing to deliver.

With this in mind, we’re introducing the new Google Mobile Sites certification. Passing the Mobile Sites exam signals that you have a demonstrated ability to build and optimize high-quality sites, and allows you to promote yourself as a Google accredited mobile site developer.

Through codifying best practice in mobile site development, we hope to improve the general standard of mobile design and speed, and make it easier to find the best talent.

What the exam covers
To pass the exam, you’ll need to show proficiency across mobile site design, mobile UX best practice, mobile site speed optimization, and advanced web technologies. We’ve put together a study guide that covers everything you’ll need to know.

What are the benefits?
We know that a lot of web developers are doing great work on mobile sites - this certification is a way of promoting them to a wider audience. Being certified means being recognized by Google as an expert in mobile site optimization, which will make you more accessible and attractive to potential clients looking for a good match for those services.

The certification will display on your Partners profile, helping you stand out to businesses looking for mobile site development, and can also be shared across social media.

How to sign up
Check out our study guide to get started. Then, to take the exam, please click on the Mobile Sites certification link and log in to your Google Partners account. If you’re not signed up yet, you can create a Partners user profile by registering here.

The exam is open to all web developers globally in English and, once completed, the certification will remain valid for 12 months.

1 Google Analytics data, U.S., Q1 2016 from Find Out How You Stack Up to Industry Benchmarks for Mobile Page Speed

If you've created a Native Express ad unit recently, you may have noticed a new template format alongside App Install and Content: Video App Install. In the past few weeks, AdMob has rolled out support for video assets in Native Ads Express, giving publishers a new way to create more engaging presentations for their users.

If you've created a Native Express ad unit recently, you may have noticed a new template format alongside App Install and Content: Video App Install. In the past few weeks, AdMob has rolled out support for video assets in Native Ads Express, giving publishers a new way to create more engaging presentations for their users.

How to get started

Enabling video demand for a Native Express ad unit is easy. Just open the ad unit's settings in the AdMob console, and look for the Ad type checkboxes at the top of the editor:

Check the checkbox marked "Video app install," and save the change. In a short while, your ad unit will start serving video creatives alongside the other two formats, with no code changes to your app required. That means you can update your existing apps to display this new format without redeploying to the Play Store or App Store.

An important thing to note is that video creatives are only available for ad units using the Large template size. The video player needs a certain amount of space, and the Large template ensures that it's available.

Customizing the experience

While there's no mobile code required to take advantage of Native Express Video, AdMob has introduced some new features to the API that allow publishers to customize the user experience. In particular, a new video options class (VideoOptions on Android, and GADVideoOptions on iOS) gives publishers a way to influence how the ads behave.

For example, the following code will cause video ads appearing in an Android NativeExpressAdView to begin playing with their audio on:

mAdView = (NativeExpressAdView) findViewById(R.id.adView);
mAdView.setVideoOptions(new VideoOptions.Builder()
    .setStartMuted(false)
    .build());

Staying in the know

App publishers can retrieve information about the video assets in their ads through the use of a video controller object (VideoController on Android, GADVideoController on iOS). The ad view classes for native express have been updated to include video controller properties that apps can grab and query for info like whether a video is present in the ad, and what its aspect ratio is. Even if the ad doesn't contain an video asset (or no ad has been loaded at all), you'll always get a valid reference to the ad view's video controller.

For example, here's a Swift snippet that shows how to check if an ad that just loaded contains a video asset:

func nativeExpressAdViewDidReceiveAd(_ nativeExpressAdView: GADNativeExpressAdView)
{
  if nativeExpressAdView.videoController.hasVideoContent() {
    print("Received an ad with a video asset.")
  } else {
    print("Received an ad without a video asset.")
  }
}

More Info

Native Express is designed to make implementing native ads easy, but if you have questions about how to get up and running or how you can best put it to use in your apps, stop by our support forum. The Mobile Ads Garage recently released an episode covering Native Express Video as well, with feature details and screencasts for iOS and Android:

Ever wondered about the best ways to monetize with banner ads while maintaining a great user experience? If so, the Mobile Ads Garage is here to help. In the third episode, Andrew and Gary the Graphics Guy cover how to integrate banner ads into a mobile app's UX, with a little help from Aunt Betty, hairless cats, and discount moose repellent. You'll see detailed breakdowns of things to avoid, plus reliable best practices that you can take back to your own apps. As always, links to guides, samples, and other resources are included.

Ever wondered about the best ways to monetize with banner ads while maintaining a great user experience? If so, the Mobile Ads Garage is here to help. In the third episode, Andrew and Gary the Graphics Guy cover how to integrate banner ads into a mobile app's UX, with a little help from Aunt Betty, hairless cats, and discount moose repellent. You'll see detailed breakdowns of things to avoid, plus reliable best practices that you can take back to your own apps. As always, links to guides, samples, and other resources are included.


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.

Starting June 2015, AdWords will no longer support WAP mobile ads for devices without a full-featured browser, including feature phones. At that time, the AdWords API will no longer support creation of new MobileAds or MobileImageAds. Any remaining ads with these types will stop serving and be converted into DeprecatedAds with status REMOVED. These changes will be visible in all supported versions of the API, though the DeprecatedAd.type field may be UNKNOWN until it can be added to the WSDL in a subsequent API release.

Historical performance metrics for any removed ads will still be available for download via the API’s AD_PERFORMANCE_REPORT.

Next steps
To reach the broadest set of mobile users with your campaigns, we recommend that you:
  • Recreate your ad in a non-WAP mobile ad format: Once you've created your ad in one of our new mobile-specific formats, you can drive more mobile traffic to your ads by setting mobile-specific bid adjustments. If you'd like to keep a copy of your original WAP mobile ads and their performance metrics, we recommend that you download reports for your original WAP mobile ad groups before June 1, 2015.
  • For Display Network-only campaigns: You can create mobile-preferred ads to target specific mobile platforms and mobile carriers for a campaign.
Still have questions? Feel free to visit us on the AdWords API Forum or our Google+ page.

Update: Corrected enumeration value in the post to "CALLS".

Starting the week of September 29, 2014, we’re changing the way we report mobile click-to-call data in AdWords API reports.

Currently, when you download a CAMPAIGN_PERFORMANCE_REPORT or ADGROUP_PERFORMANCE_REPORT with ClickType segmentation, mobile click-to-call data is reported as two separate click types:
  • A row with ClickType = CALLS contains all the stats related to clicks, like Clicks, Impressions, Cost, etc.
  • A row with ClickType = MOBILE_CALL_TRACKING contains all the corresponding stats related to phone calls, like NumOfflineInteractions, NumOfflineImpressions etc, OfflineInteractionCost, etc.
Based on your feedback, we will combine these two click types into a single click type starting the week of September 29, 2014. The combined data will now show up on a single row: ClickType = CALLS. As a result, you’ll no longer receive data for ClickType = MOBILE_CALL_TRACKING. This change will impact existing mobile click-to-call data, including historical performance.

If your applications use these report types to process mobile click-to-call data, make sure they account for this new data format. If you have questions or comments, let us know on our developer forum. You can also follow our Google+ page for updates about the AdWords API.

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.

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.'

Editor's note: re post from Inside AdSense blog. --Stan Grinberg

As the holidays approach, you can expect an increase in smartphone usage, especially in activity with gaming apps. Each year around this time, millions of new mobile devices are activated and billions of apps are downloaded. A recent AdMob study* also revealed that downloading and playing gaming apps are users’ top priority when getting a new smartphone, which represents a special opportunity for developers.

A new strategy for game-app developers can help them make the most of this increase in usage. Game developer Izumi Artisan used this strategy to increase his revenue by 60%, and so today we’ll share the details on how he achieved these results.


Step 1) Create a strategy guide for your game and post it on your website
Game guides, strategy manuals, and walk-throughs have become commonplace for gamers looking to get the edge or just take the easy path through a tricky section of a game. As a result, numerous third party game-strategy sites have popped up, and are attracting users in mass numbers.

This represents a great opportunity for you as a game developer, as you can create your own strategy or walk-through guide and host it on your website. There are many examples of successful game guides on the Web that you can use as a model when creating your own. The guides will vary in structure and length depending on the format of the game, so we suggest browsing a few to find the most suitable format. If there are already third-party guides competing for your users’ attention, try releasing the “Official” guide to separate yourself from the rest of the pack.

Step 2) Monetize your new website with AdSense
Creating great content and putting it on the Web is an important step for those looking to generate income online. To start earning revenue from your online content you can use AdSense to show highly relevant ads on your website.

With AdSense, advertisers will bid against each other to show their ads next to your content. The ads that appear are highly targeted, so they’re likely to be interesting to your visitors. AdSense also offers a number of great features including customization options to control the appearance, placement and type of ads that will show up on your site, as well as the ability to restrict the subject matter of the ads.

If you’re not already an AdSense publisher, sign up for a free AdSense account.

Step 3) Use house ads in AdMob to drive users to your new website
One of the most difficult pieces of building a successful website is attracting visitors. As a game developer, you have the benefit of an existing and engaged audience -- your users. By taking advantage of this built-in audience you can quickly generate demand for your new web content...you just have to point them in the right direction.

You can do this by using AdMob’s house ad feature, which lets you display your own promotions to your users at no cost. By creating a “house ad” promotion for your new website and displaying it in an appropriate section of your game (i.e., on the home screen, or in-between game play, etc.), you can easily generate awareness for your web content while preserving a good experience for your users. The great part is, you won’t need to push a new version of your app since the house ad can be updated directly within the AdMob interface.


Sign up for an AdMob account here. It’s free.

Be sure to make the most of the app usage increase that comes with the holiday season by trying this strategy. Have these tips worked for you? Do you have other tips to share? Let us know in the comments!




*Mobile Apps Consumer Study, AdMob and Parks Associates, Oct 2013

Are you a student who loves to code or has a great idea for a mobile app? Maybe you’re building one right now. Imagine that one day your app could be seen by millions of users.

Are you a student who loves to code or has a great idea for a mobile app? Maybe you’re building one right now. Imagine that one day your app could be seen by millions of users.

You’re invited to take part in The AdMob Student App Challenge, a mobile app contest open exclusively to students around the world. The goal is to build a great app (either Android or iOS), create a revenue stream using AdMob's in-app advertising, and tell us about your experience in a written business report. You can either build the app on your own or form a team of up to five students.

To win the Challenge, you'll need a great app and a good business strategy that focuses on how you manage the project, gain users and leverage AdMob. In the next few weeks we’ll be announcing the respected app industry leaders who’ll be on the judging panel.

We’ve got some awesome prizes if you win: The winning team will receive:

  • A 7-night trip to San Francisco with spending money, including a trip to the Google headquarters in Mountain View.
  • The winning app will be featured on the Google Play store and on the Play Store's social channels (certain conditions apply).*
  • An opportunity to star in your own case study video to tell your story.
  • A Nexus 7 device for each team member.

As well as one overall winner, there'll be a winner from each of the four global regions (North America, Latin America, Europe, Middle East & Africa, and Asia Pacific), who'll receive computing devices and an honorary mention on the AdMob website.

The Challenge starts today and you have until March 31, 2014 to build a winning app. Visit the AdMob website to learn more and to register. The winners will be announced in May 2014.

Follow the AdMob G+ page for regular updates and announcements.

Posted by Mike Schipper, Product Marketing, AdMob

*Only apps made available through the Play Store will have an opportunity to be featured. See the Official Rules for more details.

The new Google Mobile Ads SDK for Android is now included as part of Google Play services 4.0.

As an Android developer, you’re probably familiar with Google Play services, a unified platform which makes it easy to integrate Google features into your Android apps, delivered through the Play Store and updated at regular intervals. Now that AdMob is part of the package, benefits include:

The new Google Mobile Ads SDK for Android is now included as part of Google Play services 4.0.

As an Android developer, you’re probably familiar with Google Play services, a unified platform which makes it easy to integrate Google features into your Android apps, delivered through the Play Store and updated at regular intervals. Now that AdMob is part of the package, benefits include:

  • Seamless auto-updates: Changes to the Google Mobile Ads SDK for Android get pushed seamlessly to users through Google Play services. For most SDK updates you don’t need to update your apps each time it changes, saving you development time.
  • Take advantage of Google services: Implement features easily into your apps, such as Google Maps, Google Wallet and the Location API.
  • Better for users: Android users are saved the hassle of managing updates to multiple apps, because improvements can be received automatically in the background.

This new version of Google Play services supports devices running Android 2.3 and higher. We recommend updating your apps right away to make ongoing maintenance of your apps easier. Even if you develop for Android devices that don’t receive Google Play services, the Google Mobile Ads SDK is still compatible with those devices, the difference is that users won’t receive automatic updates. Also, please note, the SDK doesn’t currently support DFP, Ad Exchange or Search Ads for Mobile Apps but support is coming soon.

You can find the new SDK in the SDK Manager; follow these instructions to get it, and find the release notes here. If you have questions about it please post to the forum or check out our G+ page.

Posted by Vishay Nihalani, Product Manager, AdMob

Today, we’re excited to announce the launch of a beta version of the AdMob SDK for Windows Phone 8 to help you monetize your Windows Phone 8 applications! The key features of this SDK include the ability to:
  • Create an AdMob banner view from code
  • Embed an AdMob banner directly in an XAML file
  • Show full-screen interstitial ads
  • Register for ad events such as succeeding or failing to receive an ad
This beta version of the SDK does not include the following features that are available on iOS and Android:
  • Ad Network Mediation
  • Support for DoubleClick for Publishers
  • Search Ads for Mobile Apps support
  • MRAID support
It should also be noted that Windows RT is not supported at this time.

You can get the Windows Phone 8 SDK from our downloads page, and check out the getting started guide for developer instructions. To register an ad unit, you’ll need to have upgraded to the new AdMob. Any questions can be directed to our developer forum, and be sure to stay tuned on the Google Ads Developers Plus page for news on all Google Ads developer products.

Editor's note: repost from the DoubleClick Publisher Blog --Stan Grinberg

With every new plot planted and zombie zapped to bits, the online games industry is changing the way we interact with entertainment. Online games publishers work with us to grow their gaming empires across all screens, from distribution and downloads through to in-game advertising. We’ve also recognized a growing advertiser demand to reach highly engaged games audiences. So we were especially excited to announce two launches at Europe’s Game Developer Conference: we’re launching the TrueView video ad format across our games monetization platforms, and opening up the DoubleClick Ad Exchange to monetize desktop games.

TrueView creates a better ad experience for gamers, and higher monetization for publishers

We all know how important it is to create a gamer-friendly ad experience, which is why we’re bringing one of our most successful ad formats to games: the skippable video ad. TrueView Instream skippable video ads drive a lot of advertiser demand on YouTube, the Ad Exchange, and AdSense for video. Following on Susan Wojcicki’s beta announcement earlier this year, we’re now making TrueView video ads available to all games publishers on AdX, AdSense for games, and select mobile publishers on AdMob. During the beta, we found that TrueView video ads contributed to lower abandonment rates and greater monetization compared to normal instream video ads.

The Ad Exchange posts a new high score with desktop in-game ads

Programmatic channels have revolutionized the way we buy and sell online advertising - and now the launch of in-game ads on the Ad Exchange gives developers the same sophisticated platform to accelerate their monetization efforts. Publishers who have desktop Flash and HTML5 games can now access the global advertiser demand, top-performing ad formats, and finely-tuned controls offered by the Ad Exchange. Advertisers can now specifically target online games’ highly engaged audiences with wide range of gamer-friendly ad formats. These include image and text overlays and interstitials, right through to standard video ads and the skippable TrueView video ad format.

We think that opening the programmatic channel and the rise of gamer-friendly ad formats like TrueView will drive even better monetization for games - which is great news for game publishers, but perhaps not for the zombies.

Unity is a game development framework that makes it very easy to develop games for mobile platforms. Today we're releasing a plugin to help developers show AdMob banner ads in Unity games developed for iOS and Android. This plugin is packaged as a Unity Package so integration with a Unity project should be very easy. The included README has a step-by-step walkthrough on getting started.

We remind developers to follow AdMob best practices when integrating ads into their games. In particular, we advise that you put ads on screens only where they won’t cause a dip in your app’s frame rate.

You can check out the AdMob Unity plugin on our samples page (Android | iOS). Please direct any questions or general feedback to our forum. You can also follow our Google+ page to stay up to date on all of Google's ads products.


We have just released version 6.4.1 of the Google AdMob SDK for both Android and iOS. The Android release includes:

  • The ability to resize a DfpAdView using dfpAdView.resize(AdSize)
  • A fix for the ANR errors seen in v6.3

We have just released version 6.4.1 of the Google AdMob SDK for both Android and iOS. The Android release includes:

  • The ability to resize a DfpAdView using dfpAdView.resize(AdSize)
  • A fix for the ANR errors seen in v6.3

The iOS release fixes a crash that occurs if the Advertising Identifier is nil.

You can get the latest SDKs from our downloads page. Find us on the forum if have questions about the new Google AdMob SDKs. You can also check out our Google+ page for ads-related updates.

Ad networks take into account a variety of signals when targeting ads to your users. Generally speaking, the more information you provide to an ad network, the more accurately that network can target its ads, and the better those ads perform.

Ad networks take into account a variety of signals when targeting ads to your users. Generally speaking, the more information you provide to an ad network, the more accurately that network can target its ads, and the better those ads perform.

Many parameters, such as age, gender, and location, are commonly used by most ad networks. AdMob Mediation supports passing those parameters directly in the AdRequest; these parameters will be passed to the networks you’re mediating:

AdRequest adRequest = new AdRequest();
adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
adRequest.setBirthday(new Date(2000, 1, 1));
adRequest.setGender(AdRequest.Gender.MALE);
adRequest.setLocation(location);

AdMob Mediation also supports passing specialized parameters to specific networks. Any custom parameters used by a specific ad network can be passed to an instance of that network adapter’s NetworkExtras object, which is then set on the AdRequest. Here is how you can customize the background and text colors for AdMob text ads, and set education level and number of children for a hypothetical Example ad network:

AdMobAdapterExtras adMobExtras = new AdMobAdapterExtras();
adMobExtras.addExtra("color_bg", "00FFFF");
adMobExtras.addExtra("color_text", "FF0000");
adRequest.setNetworkExtras(adMobExtras);

ExampleAdapterExtras exampleExtras = new ExampleAdapterExtras();
exampleExtras.setEducation(Education.BACHELORS);
exampleExtras.setNumberOfChildren(2);
adRequest.setNetworkExtras(exampleExtras);

AdMob Mediation will pass an adapter only the NetworkExtras object specific to that network. So in this case, the AdMob adapter will be provided with the AdMobAdapterExtras object, and the Example adapter will be provided with the ExampleAdapterExtras object. You can find the class name for each ad network’s NetworkExtras object in their respective adapter jar file.

Custom Events

You can also use CustomEventExtras to pass special parameters to any custom events that your app implements. Keep in mind that you can call AdRequest.setNetworkExtras() with only one instance of CustomEventExtras for all custom events that you implement. To make sure your custom event doesn’t access parameters meant for other custom events, we recommend you create a HashMap for each custom event, and pass in any necessary key-value pairs related to that custom event in that map.

CustomEventExtras customEventExtras = new CustomEventExtras();
HashMap customExtras1 = new HashMap();
customExtras1.put("key1", "value1");
customExtras1.put("key2", "value2");
customEventExtras.addExtra("customEvent1", customExtras1);
HashMap customExtras2 = new HashMap();
customExtras1.put("key1", "othervalue1");
customExtras1.put("key2", "othervalue2");
customEventExtras.addExtra("customEvent2", customExtras2);

Your custom event implementation just needs to check CustomEventExtras for the HashMap at whatever key that was designated for it - in this case customEvent1. You’ll use these parameters to construct your custom event.

HashMap extras =
    (HashMap) customEventExtras.getExtra("customEvent1");

Load the Ad

Once you’re done setting all targeting options, make sure to call loadAd with that request.

// This snippet assumes you have an AdView object named "adView".
adView.loadAd(adRequest);

If you have any questions or comments about AdMob, mediation, custom events, or targeting, we can field them in the forum. Also follow us on our Google+ page for ads-related updates.

Smartphones and tablets can be great creative canvases for brand advertisers, and many agencies are helping brands go big on mobile. But it’s hard for agencies and advertisers to experience the full interactivity of mobile rich media -- mobile video and HTML5 ads --  through static images alone. Last night at our annual Creative Sandbox event in New York, we unveiled the new Mobile Ads Showcase App, which lets you experience mobile ads exactly as your users will.

The app lets you explore what best-in-class advertisers are doing with mobile rich media, and learn about all that’s possible with Google Mobile Ads. Additionally, agencies can use the app as their mobile portfolio by coding, testing and uploading their HTML5 ad examples to the MRAID-compliant “My Ads” screen. The app is now available for Android smartphones and tablets through the Google Play Store.

See the app in action and learn more about how it works on the Creative Sandbox site.



There are a number of ways interstitials can be incorporated into applications that play video. One common integration we’ve seen is displaying the interstitial right before a video is played. This blog post will show you how to do this on iOS.

There are a number of ways interstitials can be incorporated into applications that play video. One common integration we’ve seen is displaying the interstitial right before a video is played. This blog post will show you how to do this on iOS.


Set Up Your Video Player

For this specific example, we’re going to use MPMoviePlayerController. This class makes it easy to integrate video playback into your iOS application. However, make sure not to use MPMoviePlayerViewController as we want to have control over our own view controller.

- (void)viewDidLoad {
  [super viewDidLoad];
  NSURL *bundleURL = [[NSBundle mainBundle] bundleURL];
  NSURL *movieURL = [bundleURL URLByAppendingPathComponent:@"Video_Name_Here.mp4"];
  player_ = [[MPMoviePlayerController alloc] initWithContentURL: movieURL];
  //  Don’t add the player_ into the view hierarchy yet
  [player_.view setFrame:self.view.bounds];  // player's frame must match parent's
  player_.controlStyle = MPMovieControlStyleFullscreen;
  [[NSNotificationCenter defaultCenter]
    addObserver:self
    selector:@selector(moviePlayerPlaybackDidFinish:)
    name:MPMoviePlayerPlaybackDidFinishNotification
    object:player_];
}

We add an observer at this point to tell us when the movie is done playing. This is typically when our view controller will transition away from the MPMoviePlayerController’s view.


Set Up Your Interstitial

Set up a GADInterstitial object as you normally would and and call loadRequest: at an appropriate time in your application flow. Present the interstitial once it comes back.

- (IBAction)showMovieInterstitial:(id)sender {
  self.interstitial = [[[GADInterstitial alloc] init] autorelease];
  self.interstitial.delegate = self;
  self.interstitial.adUnitID = @”YOUR_IDENTIFIER_HERE”;
  [self.interstitial loadRequest: [GADRequest request]];
}

- (void)interstitialDidReceiveAd:(GADInterstitial *)interstitial {
  [interstitial presentFromRootViewController:self];
}

The trick here is that after you receive and present your interstitial, you’re going to have to add your MPMoviePlayerController’s view into your view hierarchy. You want to make this look seamless so that as the interstitial is dismissed, the movie player looks as though it is in the background. This means making the view hierarchy change in interstitialWillDismissScreen: (called before the interstitial is dismissed).

- (void)interstitialWillDismissScreen:(GADInterstitial *)interstitial {
  [self.view addSubview:player_.view];
}

If you’re auto-playing the video, you don’t want to start playing in interstitialWillDismissScreen: as the user will miss a part of the video when the dismissal transition happens. Instead, you can play the movie in interstitialDidDismissScreen:.

- (void)interstitialDidDismissScreen:(GADInterstitial *)interstitial {
    [player_ play];
}

Remember that you have to unregister for notifications when you are cleaning up your MPMoviePlayerController as well.

- (void)dealloc {
  if (player_) {
   [[NSNotificationCenter defaultCenter]
     removeObserver:self
     name:MPMoviePlayerPlaybackDidFinishNotification
     object:player_];
    [player_.view removeFromSuperview];
    [player_ release];
    player_ = nil;
  }
  interstitial_.delegate = nil;
  [interstitial_ release];
  [super dealloc];
}

Let us know on the forum if you have any questions about interstitials specifically or the Google AdMob SDK in general. You can also follow us on our plus page for AdMob-related updates.



App Events, a feature introduced in v6.1.0 of the AdMob SDK, provides DFP developers the ability to create ads that can send messages to their application code. The application can listen for and react to these messages by executing custom code.

App Events, a feature introduced in v6.1.0 of the AdMob SDK, provides DFP developers the ability to create ads that can send messages to their application code. The application can listen for and react to these messages by executing custom code.

This powerful feature lets you do some pretty cool things, such as sending the entire creative code to the app, or telling the app what ad is running. In this example, we’ll show how the app can change background colors when it receives an app event.

The first step is to set up your creative in DFP. The sample below is a 320x50 creative which sends a color=red event when the ad is first displayed, and a color=green event when the ad is clicked.

<html>
<head>
  <script src="//media.admob.com/api/v1/google_mobile_app_ads.js"></script>
  <script>
    // Send a color=red event when ad loads.
    admob.events.dispatchAppEvent("color", "red");
    
    handleClick = function() {
      // Send a color=green event when ad is clicked.
      admob.events.dispatchAppEvent("color", "green");
    };
  </script>
  <style>
    #ad {
      width: 320px;
      height: 50px;
      top: 0px;
      left: 0px;
      font-size: 24pt;
      font-weight: bold;
      position: absolute;
      background: green;
      color: red;
      text-align: center;
    }
  </style>
</head>
<body>
  <div id="ad" onClick="handleClick()">Happy Holidays!</div>
</body>
</html>

The creative above references the AdMob API for Ads JavaScript, and calls admob.events.dispatchAppEvent to send app events. You can check out an example of the creative below, and view the developer console to see logging statements when the app events are being fired.

Recently, we started cautioning publishers against using GADInterstitial’s loadAndDisplayRequest:usingWindow:initialImage: method with mediation. We saw some odd behavior occurring when publishers used that method. This blog post outlines a way to implement the functionality of this method while avoiding the problems that had been associated with it.

Recently, we started cautioning publishers against using GADInterstitial’s loadAndDisplayRequest:usingWindow:initialImage: method with mediation. We saw some odd behavior occurring when publishers used that method. This blog post outlines a way to implement the functionality of this method while avoiding the problems that had been associated with it.

The original method replaced the rootViewController of the window temporarily while the splash image was being shown. Since you have control of your view controllers as the publisher, this step is unnecessary. Assuming you want to show the splash image on app startup, you can place your interstitial code in your rootViewController’s viewDidLoad: method. This method is called after the view hierarchy is loaded into memory.

On a high level, all you need to do is initialize a UIImageView and add it into your view hierarchy in the viewDidLoad: method. To be extra careful, you may also want to hide the status bar while your splash image is being shown.

- (void)viewDidLoad {
  [super viewDidLoad];

  interstitial_ = [[GADInterstitial alloc] init];
  interstitial_.adUnitID = @"MY_INTERSTITIAL_ID";
  interstitial_.delegate = self;

  // Remember whether the status bar was hidden or not.
  hideStatusBar_ = [UIApplication sharedApplication].statusBarHidden;
  [UIApplication sharedApplication].statusBarHidden = YES;
  
  GADRequest *request = [GADRequest request];
  request.testing = YES;
  [interstitial_ loadRequest:request];

  // Initialize your splash image and add it to the view.
  imageView_ = [[UIImageView alloc] initWithImage:[UIImage  imageNamed:@"InitialImage"]];
  [self.view addSubview:imageView_];
}

If you only want to show the splash image and interstitial the first time the app is loaded, you can write a boolean into NSUserDefaults and check that boolean before you present the interstitial in viewDidLoad:.

As a final step, you must remove the imageView_ from the view hierarchy once the interstitial comes in. Remember that you also need to remove it if the interstitial fails. To reduce code duplication, you can put this logic into it’s own method.

- (void)restoreController {
  [imageView_ removeFromSuperview];
  // Restore status bar to state it was before hiding.
  [UIApplication sharedApplication].statusBarHidden = hideStatusBar_;
}

#pragma mark GADInterstitialDelegate

- (void)interstitialDidReceiveAd:(GADInterstitial *)ad {
  NSLog(@"Received ad successfully");
  [interstitial_ presentFromRootViewController:self];
}

- (void)interstitial:(GADInterstitial *)ad
didFailToReceiveAdWithError:(GADRequestError *)error {
  NSLog(@"Failed to receive ad with error: %@", [error localizedFailureReason]);
  [self restoreController];
}

- (void)interstitialWillDismissScreen:(GADInterstitial *)ad {
  // Remove the imageView_ once the interstitial is dismissed.
  [self restoreController];
}

If you have any questions about the AdMob SDK, reach out to us on the forum or join us for our upcoming AdMob office hours. You can also follow us on the Google Ads Developer plus page.


Editor’s note: "reposting from Google Mobile Ads Blog post by Morgan Hallmon." -- Stan Grinberg, Ads Developer Relations Team

Apps are a powerful way to keep your most loyal users engaged, and can also be a real driver of revenue for marketers big and small. When advertising apps, the key is to know what’s working and what’s not. While advertisers have already been able to measure their Android app downloads within AdWords, we’ve now launched the ability to track iOS downloads that were driven by in-app display ad campaigns.

To set up iOS conversion tracking, advertisers need to create a single code snippet in their AdWords account and install it in their app. This snippet is accessible in the AdWords interface in the same place where advertisers have been able to codelessly track Android downloads. With iOS conversion tracking, marketers can better understand which campaigns are most effective at driving app downloads. These enhanced insights help marketers iterate on app promotion strategies to reach their return on investment goals, with the help of features like the Conversion Optimizer for apps.

Figuring out what ads are working is key for marketers like Sho Masuda, Vice President of Player Marketing for GREE, a leading mobile social game app developer. GREE has used click to download and in-app advertising solutions with AdWords to promote their app, and Masuda says, "Google’s host of tracking and optimization tools help us quickly iterate and maximize ROI across our app promotion campaigns. iOS conversion tracking will help us gain even deeper insights into our Google app promotion efforts for our iOS apps.

If you’d like to learn more about how to track value beyond the app download, you can watch a recording of our Learn with Google webinar “Understanding your App Users with Google Analytics” here.