Mediate via DFP on Android

The Flurry AdMob and DFP mediation adapter lets you integrate ads from the Flurry network, via the Flurry Advertising SDKs, into the Google Mobile Ads mediation platform.

To start the mediation integration, ensure that you have access to the following:


Note that this section describes mediation of Flurry through DFP. For AdMob mediation of Flurry inventory, follow these Integration instructions.

Get Started Mediating Flurry via DFP

To integrate Flurry as the mediated Network in DFP ad serving, you perform the following tasks:

  1. Integrate the Flurry SDK and Flurry adapter for DFP and AdMob code into your app.

  2. Configure Flurry’s Ad Unit(s).

  3. Configure DFP to mediate Flurry.

  4. Request ads in your app.

Integrate Flurry SDK and Flurry Adapter Into Your App

Follow these steps:

  1. If your app is not currently tracked by Flurry, create a new application on Flurry’s developer portal.

  2. Keep a reference to the API Key for the new application after it has been created. Flurry requires each application to have its own unique API key to identify your app in the Flurry system. The Flurry API key is also used when configuring mediation on the AdMob/DFP dashboard.

  3. Add the latest Flurry Android SDK into your app.

  4. To integrate the Flurry adapter into your application code, add the adapter as a dependency in your project (available here).


Flurry requires you add the Google Play Services SDK to your project. (If you haven’t already done so as required for Google Ads SDK, see the detailed Google instructions on AdMob integration that cover this step: AdMob Integration.)

  1. Modify your project’s manifest file to include FlurryFullscreenTakeoverActivity.


<activity
    android:name="com.flurry.android.FlurryFullscreenTakeoverActivity"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize">
</activity>
  1. If using ProGuard, update your ProGuard configuration to include the following:


keep class com.flurry.** { *; }
­dontwarn com.flurry.**
­keepattributes *Annotation*,EnclosingMethod ­keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int); }
# Preserve Flurry mediation classes for DFP/AdMob Ads ­keep public class com.google.ads.mediation.flurry.**
# Google Play Services library
­keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents(); }

­keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL; }
­keepnames @com.google.android.gms.common.annotation.KeepName class * ­keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *; }
­keepnames class * implements android.os.Parcelable { public static final ** CREATOR;
}

Further instructions for including mediation into your DFP ad serving flow are available at Mediation: Publishers Quick Start.

Configure Flurry’s Ad Unit(s)

Follow these steps:

  1. For each DFP ad unit that you want to mediate Flurry through, create a matching ad unit on the Flurry developer portal.

  2. Log into the developer portal and navigate to the Monetization tab. On the left navigation bar select, Applications & Ad Units.

  3. You may see a list of previously created ad units. To set up a new one, click the Ad Unit button in the upper-left corner. Depending on the type of Ad Unit you are creating, the Ad Unit setup screen has three to four modules. The Basic Setup section includes fields required to define the name, application, dimensions, placement and orientation of the ad unit.

Flurry ad unit creation screen
  1. You only need the basic setup to start. Click Save.


For additional ad unit configuration, see Basic ad unit setup instructions and Advanced ad space setup instructions.

You are required to create your ad space on the dev portal before retrieving ads through mediation.

Mediating Flurry through DFP requires no additional Flurry-related code in your application. The Flurry ad Unit invocation code is already incorporated in the adapter adapter code.

If you are integrating banner ads, Flurry recommends that you turn off banner refresh in Flurry and let DFP refresh the ads. Set the refresh rate for the ad space to an unusually high number, like 9999 (instead of the default 30 seconds). This setting is found in the Advanced Options section of the Ad Unit setup.

Configure DFP to Mediate Flurry

Follow these steps:

  1. On the DFP site, create one or more ad units with SDK mediation creatives. Each ad unit created on the DFP site should have a corresponding ad space created on Flurry’s developer portal (detailed instructions are provided below) View instructions for adding a new creative.

  2. Create the SDK Mediation creative to include Flurry impressions into the ad serving flow created following these Instructions.


To enable mediation of Flurry inventory:

  1. Click the Inventory tab.

  2. Select the ad unit for which you are extending with Flurry mediation. This unit’s ad ind (found under Generate Tags) is used in the code to reference it.

  3. Target a line item to mobile device. Instructions.

  4. Create SDK Mediation creative, select Flurry from the list of available ad networks. Provide the Flurry API key in the corresponding field (iOS or Android) and Ad space name as created in the earlier step.

See the Detailed Google instructions.

admob mediation

Request Ads in Your App

Follow the same instructions used for integrating DFP ads into your application. To integrate non-interstitial ads (banner size, leaderboard size, and so on), follow the DFP instructions for banner ads from Google. To integrate interstitial ads (full-screen ads that take over the screen), follow the DFP instructions for interstitial ads from Google.

To integrate native ads, follow the instructions for DFP from Google for native ads. The Google Ads SDK allows the mediation of two system-defined native ad formats: Content and App-install ad formats. Publishers mediating Flurry can request for both formats.

Note: Ad requests for only app-install ads will not work during Flurry mediation. We recommend that publishers request for both formats if mediating Flurry.

Examples

Configuring the AdMob ad request with extra configuration options from Flurry:

Bundle flurryExtras = new Bundle(1);
// Set an extra to enable Flurry SDK debug logs
flurryExtras.putBoolean(FlurryAdapter.SERVER_PARAM_LOG_ENABLED, true);

PublisherAdRequest.Builder builder = new PublisherAdRequest.Builder()
        .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
        .addNetworkExtrasBundle(FlurryAdapter.class, flurryExtras);

PublisherAdRequest adRequest = builder.build();

AdMob ad request for banner or interstitial ads:

// Create the banner ad view
PublisherAdView bannerAdView = new PublisherAdView(mActivityContext);

// Add the bannerAdView to your layout hierarchy
// ..

// Load the banner ad with the previously created ad request
bannerAdView.setAdUnitId(ADMOB_MEDIATED_AD_UNIT);
bannerAdView.setAdListener(this);
bannerAdView.loadAd(adRequest);

// Create and load the interstitial ad
PublisherInterstitialAd interstitialAd = new PublisherInterstitialAd(mActivityContext);
interstitialAd.setAdUnitId(ADMOB_MEDIATED_AD_UNIT);
interstitialAd.setAdListener(this);
interstitialAd.loadAd(adRequest);

//..

// After the ad has been loaded, show it on screen
interstitialAd.show();

To learn about making DFP native ad requests, follow the instructions provided by Google. After completing a successful native ad request, you can get Flurry-specific assets in the following way:

/*
 Get the native ad's branding logo URL. This asset is also available
 for app-install ads.
 */
String brandingLogoUrl = ((NativeContentAd) nativeAd).getExtras()
            .getString(FlurryAdapter.EXTRA_BRANDING_LOGO);

// Get the native app-install ad's app category
String appCategory = ((NativeAppInstallAd) nativeAd).getExtras()
            .getString(FlurryAdapter.EXTRA_APP_CATEGORY);