-
Notifications
You must be signed in to change notification settings - Fork 6
Adform Native Mediation Adapter
This guide explains how to integrate the Adform Native Mediation Adapter into your Android project, using OpenRTB for loading native ads via Google Mobile Ads mediation.
Android API level 21+ Google Mobile Ads SDK (v21+ recommended) Mediation Adapter integrated in the mediation waterfall
Maven/Gradle:
repositories { maven { url "https://github.com/adform/adform-android-sdk/raw/master/releases/" } }
implementation 'com.adform:adform-header-bidding-sdk:2.21.0'
For a full guide on how to set up mediation in AdMob, refer to the official documentation:
You would need to set up Custom Events manually in your mediation configuration, use the fully qualified class name of the adapter:
com.adform.sdk.network.nativead.AdformNativeAdapter
In the AdMob mediation network UI, configure the parameter value with:
id=<request_id>,tagid=<tag_id>
For example: id=1234,tagid=567890
Here is a guide how to implement AdMob native ads: Native AdMob ads setup in android
If you want to customize which native assets are requested or how they are mapped, you can subclass AdformNativeAdapter and override key methods:
- Subclass the Adapter
public class CustomAdformNativeAdapter extends AdformNativeAdapter {
@Override
protected OpenRTBRequest.Native createNativeAdRequest() {
// Create your custom native ad request with different assets or requirements
OpenRTBRequest.Native nativeAd = new OpenRTBRequest.Native();
OpenRTBRequest.NativeRequest nativeRequest = new OpenRTBRequest.NativeRequest();
// Example: request only title and main image
OpenRTBRequest.NativeRequestAsset assetTitle = new OpenRTBRequest.NativeRequestAsset();
assetTitle.id = 1;
assetTitle.required = 1;
assetTitle.title = new OpenRTBRequest.RequestTitleAsset();
assetTitle.title.len = 100;
OpenRTBRequest.NativeRequestAsset assetMainImage = new OpenRTBRequest.NativeRequestAsset();
assetMainImage.id = 0;
assetMainImage.required = 1;
assetMainImage.img = new OpenRTBRequest.RequestImgAsset();
assetMainImage.img.hmin = 200;
assetMainImage.img.wmin = 300;
assetMainImage.img.type = 3;
nativeRequest.assets = new ArrayList<>();
nativeRequest.assets.add(assetTitle);
nativeRequest.assets.add(assetMainImage);
nativeAd.request = nativeRequest;
return nativeAd;
}
}
- Register your custom adapter class name in mediation configuration or custom event:
Please use com.yourpackage.CustomAdformNativeAdapter instead of com.adform.sdk.network.nativead.AdformNativeAdapter
Basic integrations
- Integrating Inline Ad
- Integrating Full Screen Overlay Ad
- Integrating Interstitial Ad
- Integrating Adhesion Ad
- Video Ad Integration
Advanced integrations
- Advanced integration of Inline Ad
- Advanced integration of Full Screen Overlay Ad
- Advanced integration of Interstitial Ad
- Advanced integration of Adhesion Ad
- Advanced integration of AdInline ListView
- Advanced integration of AdInline RecyclerView
- Instream video ads integration
Other
- Adding Custom Values
- Adding Keywords
- Adding Key Value Pairs
- Adding Search Words
- Location
- Security
- Ad Tags
- Header Bidding
- Changing ADX domain
- Specifying banner loading behaviour
- GDPR
- Logs
Plugins