Native Ads

Before you begin native ad integration, you may wish to review the Native Ad Design Guidelines. The guidelines are intended to help you build engaging ad experiences while protecting the integrity of your advertisers’ brand assets. You need to adhere to these guidelines when implementing Yahoo Gemini native ads in your apps.

For a quick view of the native ads in an app, you can build and run the Flurry sample Android app that serves the native ads. The sample Yodel app shows a vertical and horizontal stream of Tumblr blogs with native ads blended in. The sample is available on Github.

To integrate Flurry Native Ads into your app, you need to use Flurry Android SDK 5.x and above. To integrate Flurry Native Video Ads into your app, you need to use the Flurry Android SDK 5.6 and above.

Step 1. Configuration

To work with Flurry Android Native ads, follow these required configuration steps:

Before you can integrate the code into your application, you will need to configure the ad unit that your code references on the Flurry dev portal (http://dev.flurry.com). For native ads, the ad unit is configured as the “Stream” ad placement. For detailed instructions on how to configure Stream ad units, see Creating Gemini Native Stream Ad Spaces.

The current version of native ads supports static (image) and video ads. The video ads are mixed in with the static ads. To enable native video ads for your ad units, send a request to Flurry Support.

For all other ad unit placements, follow these detailed instructions on how to configure an ad unit: Basic Ad Space Setup.

Note

Once you create a Stream ad unit on the dev portal, it takes about one hour for the ad unit to start serving ads and for the ad unit to become active.

For each Activity where Native ads are served, use a single ad unit. This ad unit can be referenced multiple times in multiple locations within the Activity. For example, if the native ad is placed in multiple cells of a table view, it would be referencing the same ad unit name. This ad unit can serve both image and video ads.

Step 2. Fetch Ad Assets & Display Ad in Custom View

Integrating code for native displays requires fetching the ad assets and displaying the ad in a custom view that matches the application layout.

Create the ad view to contain the ad assets. Place this view within another view of your app.

Step 3. Initialize the Native Ad

Initialize the native ad, assign the FlurryAdNativeListener and request the ad from Flurry:

You can create multiple native ad objects at the same time. The SDK keeps track of the fetch requests the app makes and adds the returned assets to their corresponding ad objects as they are made ready. The app can destroy the native objects as it sees fit using the destroy() method of the ad object. Otherwise, they will be destroyed with the context that created them.

Note

f your application supports the device rotation, use the application context when creating the native ad objects to prevent the object from being destroyed with the Activity.

Step 4. Implement the FlurryAdNativeListener

In your app code, implement the FlurryAdNativeListener to receive the callbacks related to the ad’s lifecycle events. You will need to implement the following callback methods:

Step 5. Enable Native Ad Tracking

To enable impression and click tracking, call setTrackingView() on the ad view created in the earlier step.

If you plan to re-use the view to show different ads, call removeTrackingView() before setting the new ad tracking view.

Step 6. Parse the received assets and compose the view to display the ad

The following code snippet demonstrates the process:

For the static ads, Yahoo requires you, as the Publisher, to display the headline, advertiser name, one image and the branding logo. You can pick the image best suited for your requirements and crop the image to match your aspect ratio.

For the video ads, Yahoo requires you, as the Publisher, to display the headline, advertiser name, video and the branding logo. We recommend the placeholder for video to be of the card size at least. We advise against placing the video into the pencil sized ads.

The potential assets and their key names are shown in the table below.

Name Type Description
summary STRING The call to action summary of the advertisement
headline STRING The Ad headline, typically a single line
source STRING The advertiser name
secBrandingLogo IMAGE The square image always present, size: 20 x 20px
secHqBrandingLogo IMAGE The square high-quality image of the sponsored logo. Currently, it is a starburst.png, always present, size: 40 x 40px
secOrigImg IMAGE The secured original image, size: 627px x 627px. Optional asset, not present for the video ads.
secHqImage IMAGE The secured high quality image, size: 1200px x 627px. Optional asset, not present for the video ads.
secImage IMAGE The secured image, size: 82px x 82px. Optional asset, not present for the video ads.
appCategory STRING The app category. Optional asset, present only for the app install ads and some video ads.
appRating STRING The app rating, expressed as 80/100 for the 4 star rating or 100/100 for the 5 star rating of the app. Optional asset, present only for the app install ads and some video ads.
secRatingImg IMAGE The secured image representing the number of the stars the app is rated with. Optional asset, present only for the app install ads and some video ads.
secHqRatingImg IMAGE The secured high-quality image representing the number of the stars the app is rated with. Optional asset, present only for the app install ads and some video ads.
showRating STRING True or false value recommending whether to show the star rating of the app or not. Optional asset, present only for the app install ads.
callToAction STRING The Call to Action string. Optional asset, present only for the video ads.
collapseImg IMAGE The secured image representing the collapse button used for composing the expandable ads.
expandImg IMAGE The secured image representing the expand button used for composing the expandable ads.

Video Ads

Video ads do not have an explicit asset name and the video url is not exposed. Rather, the video ads are identified with the isVideoAd property of the native ad object set to true.

Yahoo currently provides the short Call To Action (CTA) string only for the video ads. For the install ads, you can create your own CTA string. For an ad that contains app install specific assets like appCategory or appRating, the CTA could be ‘Install Now’.

For an ad that does not contain app specific assets, the CTA could be ‘Read More’.

For all the assets whose type is Image, the value for the asset is a url string that links to the image. Note that the url points to either the local or remote resource:

  • Caching is enabled for the ad unit - default setting: The SDK caches the assets onto the device before it declares the ad ready. The asset’s url in FlurryAdNativeAsset points to the local file (url contains the locator in the form file:// ) where the asset resides.
  • Caching is not enabled for the ad unit: The assets are available via https url. Calling loadAssetIntoView or getAssetView on the FlurryAdNativeAsset object loads the assets directly from the network and does not cache the assets.

If you wish to use the memory cache, Flurry recommends you load the images directly instead of using the loadAssetIntoView method of FlurryAdNativeAsset object.

The Video ads are cached on the device by the default.

Important

For the ad units that are configured to receive video ads, each native video request allows for either video or static native ads to be returned. Other than rendering a native video ad, the integration steps for native video ads are the same as for native static ads.

To render a native video ad, you must use FlurryAdNativeAsset#loadAssetIntoView().

Expandable Ads

Starting with the Android SDK version 6.2.0, Flurry enables newer display format for native ads. You can choose to show the condensed ad view (also called Pencil ad format) with elements like title and summary.

On tapping the ad, the ad view can be expanded to an elaborate view. This feature can be implemented by making use of the updated FlurryAdNative API and its updated FlurryAdNativeListener callbacks.

Two methods are added to help set the tracking view in the collapsed as well as in the expanded display state.

Normally, native ads need to set the tracking view to the view that contains the ad’s assets.

For the expandable display, there are two methods provided to set the tracking view referencing the expand button and the CTA button. When the ad is in the collapsed view, this view contains the expand button. Setting the setPencilViewToTrack on the collapsed ad allows the SDK to monitor for the user’s click on the expand button.

Similarly, when the ad is in the collapsed view, it contains the CTA button. Setting the setExpandedViewToTrack on the expanded view, allows the SDK to monitor for the user’s click on the CTA button.

If you start from the condensed view:

Or, if you start from the expanded view:

Note

The CTA view can’t be null. The CTA view in the condensed view can be used to launch the landing page, or it can be an invisible view to disable the feature. By providing the CTA view, the end user can open the landing page without expanding the ad.

Note

The Collapse button in the expand view can be used to collapse the view. The Collapse button can be null. In such a case, collapsing back to the condensed view will be disabled.

Setting the condensed view or expanded view using the APIs will not require you to set tracking view separately.

Flurry SDK provides a delegate callback to notify when the display state is changed by either tapping on the condensed view or tapping the collapse button.

The FlurryAdNativeListener can implement this callback and respond appropriately as follows:

Step 7. Build & Run the Sample Code App

If you build and run the sample app, the native ad integrated into the app looks like this:

native ad sample

If you are not seeing any ads, check the Troubleshooting section in FAQs for Android.

Learn More

For detailed information on the Java classes and methods available in the SDK, check out the API Reference documentation for Android.