Android Google Ad Manager (GAM) Mediation Adapter supports all display.io ad units.
Google Ad Manager/ display.io ad units mapping:
display.io | GAM | ||
![]() |
Interscroller | Banner | |
![]() |
Headline Video | Banner | |
![]() |
Interstitial | Interstitial | |
![]() |
Infeed |
Banner | |
![]() |
Medium Rectangle | Banner | |
![]() |
Banner | Banner | |
To set it up:
1. Add the adapter to your project:
Edit your project's build.gradle file in order to declare our maven repository:
repositories {
google()
jcenter()
maven { url "https://maven.display.io/" }
}
Add the following dependencies to your app-module's build.gradle file:
implementation ‘com.brandio.ads:sdk:4.6.2’
implementation ‘com.brandio.ads:google-ads-adapter:4.6.1'
Follow guide to initialize DisplayIO SDK.
2. Create a new Yield Group (Banner) and add Third-Party Yield Partner (DisplayIO) to the Yield Group. If you require more instruction on this please consult the link below: https://support.google.com/admanager/answer/7390828
3. Define a Custom Banner Event using the following guide: https://developers.google.com/ad-manager/mobile-ads-sdk/android/custom-events#banner_custom_event
Update to the following settings:
For each ad unit use Class Name:
- Interstitial ad unit: com.brandio.ads.adapters.googleads.InterstitialAdapter
- Infeed ad unit: com.brandio.ads.adapters.googleads.InfeedAdapter
- Interscroller ad unit: com.brandio.ads.adapters.googleads.InterscrollerAdapter
- Banner ad unit: com.brandio.ads.adapters.googleads.BannerAdapter
- Medium Rectangle ad unit: com.brandio.ads.adapters.googleads.MediumRectangleAdapter
- HeadlineVideo ad unit: com.brandio.ads.adapters.googleads.HeadlineVideoAdapter
and Parameter <PLACEMENT_ID>, where PLACEMENT_ID is your placement ID on display.io platform (display.io Publisher Portal).
4. Create a new ad unit and specify the newly created network as a source. Disable auto-refreshing for banner.
5. Make sure that DisplayIO network has a higher priority than any other sources (usually Google adds its own source by default).
6. Use Banner or Interstitial tutorials to get ads from Google Ad Manager.
7. Infeed can be added in RecyclerView by passing it as adapter’s constructor argument:
RecyclerViewAdapter( ... , @NonNull AdView adView) {
...
this.adView = adView;
}
and can be shown in particular position with help of RecyclerView.ViewHolder subclass in RecyclerView.Adapter.onCreateViewHolder method:
...
static class AdHolder extends RecyclerView.ViewHolder {
AdHolder(View itemView) {
super(itemView);
}
}
...
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull final
ViewGroup parent, int viewType) {
...
return new AdHolder(adView);
}
...
9. Interscroller could be added in RecyclerView like Banner but it require additional step: Set up your placement with field to store reference to parent (RecyclerView object) Make sure you call it after DisplayIO SDK has beed initialized:
try {
InterscrollerPlacement placement = (InterscrollerPlacement) Controller
.getInstance().getPlacement(IS_PLACEMENT_ID);
placement.setParentRecyclerView(recyclerView);
} catch (DioSdkException e) {
e.printStackTrace();
}
Important:
Disabling auto impression tracking for Interscroller is strongly recommended to avoid discrepancies between Ad Manager and DisplayIO metrics.
PublisherAdRequest adRequest = new PublisherAdRequest.Builder()
.setManualImpressionsEnabled(true)
.build();
In order to count the impression you should listen onAdOpened() on your PublisherAdView:
@Override
public void onAdOpened() {
mPublisherAdView.recordManualImpression();
}
Comments
0 comments
Please sign in to leave a comment.