GAD / AdMob (iOS)
GAD (AdMob) Mediation
To use HyBid SDK directly in GAD (AdMob) Mediation you will need to integrate the Google Mobile Ads SDK and the HyBid SDK into your app.
Integrate Google Mobile Ads SDK
To integrate Google Mobile Ads SDK into your app you should follow the instructions on their website.
Integrate HyBid SDK
To integrate the HyBid SDK follow the instruction in the integration page.
Integrate The GAD (AdMob) Adapter
The Hybid iOS Google Mobile Ads Adapter enables you to deliver Hybid Ads through Google Mobile Ads using both:
- Header Bidding
- Mediation
If you want to display Hybid Ads into your iOS application via AdMob, follow these steps below.
Requirements
- iOS 12.0+
- Xcode 12.0+
Before installing the GAD (AdMob) Adapter, ensure:
- You have integrated the latest version of HyBid iOS SDK to your project using using Hybid Setup.
- If required, you have implemented the Google Mobile Ads iOS SDK for
- You have decided your integration approach:
- Header Bidding
- Mediation
- Or both
Note:When using dependency managers like CocoaPods or Swift Package Manager, required SDKs may be installed automatically if not already present.
Installation Methods
You can install the Hybid AdMob adapter using one of the following methods:
1. Drag & Drop Adapter Files
To use the GAD (AdMob) Adapter in your project:
- Ensure you have integrated the HyBid iOS SDK & Google Mobile Ads SDK (Refer the Requirements section).
- Download the latest release of Google Mobile Ads Hybid Adapter.
- Drag & drop the adapter files into your Xcode project.
- Proceed with AdMob dashboard setup below
Swift Integration
To use the GAD (AdMob) Adapter in your Swift project, ensure that you have a Bridging Header file in your project and the Objective-C Bridging Header build setting under Swift Compiler - Code Generation has a path to the header
2. Cocoapods
If your project is managing dependencies through CocoaPods, you just need to add this pod in your Podfile.
It will install HyBid Adapters, as well as HyBid iOS SDK and Google Mobile Ads iOS SDK (If not installed already).
- Add pod named
GoogleMobileAds-HyBid-Adaptersin your Podfile:
platform :ios, '12.0'
pod 'GoogleMobileAds-HyBid-Adapters', '3.7.1.1'
- Run
pod installto install the pod in your project.
3. Swift Package Manager
The Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies. It will install HyBid Adapters, as well as HyBid iOS SDK and Google Mobile Ads iOS SDK.
To integrate the GoogleMobileAds-HyBid-Adapters into your Xcode project using Swift Package Manager:
- Add it to the dependencies of your Package.swift:
dependencies: [
.package(url: "https://github.com/pubnative/googleMobileAds-hybid-adapters-ios", branch:"master")
]
- Enable the
-ObjCflag in Xcode- Click on your Project Settings.
- Go to Build Settings.
- Search for Other Linker Flags.
- Add the following flag::
-Obj C
Demo App
You can find a demo app with code samples for this type of integration here.
Set up the placements on GAD (AdMob) Dashboard
To set up the HyBid Adapters in the GAD (AdMob) mediation you need to follow a few steps.
If you already have an app and ad units created then you can skip these steps.
Create an App
Create a new app in the GAD (AdMob) Dashboard
If your app is published you can look it up using the package name from the App Store.
Otherwise just enter the basic information on the dialog.
Create Banner Ad Unit
Create a new ad unit and set up the format as Banner
In GAD (AdMob), Banner, Medium Rectangle and Leaderboard are all considered Banners. Therefore you use the same type of ad unit for all of them and you specify the size on the app following the GAD (AdMob) documentation instructions.
After this step, you will obtain an Ad Unit ID. Use this to request ads for this placement.
Create Interstitial Ad Unit
Create a new ad unit and set up the format as Interstitial
After this step, you will obtain an Ad Unit ID. Use this to request ads for this placement.
Set up Mediation for the app
Head over to the mediation section to set up the adapters for HyBid SDK.
Create Mediation Group
Create a mediation group for each placement format you want to use HyBid GAD (AdMob) adapter in.
Select Ad Units
On the Ad units section of the mediation group, click on the Add ad units button to start choosing which placements you want to include this mediation group.
Remove automatic eCPM (optional)
If you want to guarantee that your adapters are going to be called before the GAD (AdMob) network, you should remove the Real Time eCPM and set a price lower than the floor price of your adapters.
This is not recommended since GAD (AdMob) Network might have higher eCPMs in some cases
Create Custom Event
To create the custom events for the adapters in the mediation group, head over to the Ad Sources section and click on the Add Custom Event button
Choose a name for the custom event that easily identifies that it's a HyBid adapter.
On the class name, enter the full name of the adapter you want to use, including the package name.
In this example we are setting up the banner adapter. You can see below the full list of adapters per ad format.
On the parameter section, you should add the JSON you can find below the list of adapters. Make sure to use the proper App Token and Zone ID that will serve the specific ad size you will be requesting.
Insert for each format the following custom event names and params:
For Google Mobile Ads SDK Pre v:8.0.0;
- Custom event for Leaderboard:
HyBidAdMobMediationLeaderboardCustomEvent - Custom event for Banner:
HyBidAdMobMediationBannerCustomEvent - Custom event for MRect:
HyBidAdMobMediationMRectCustomEvent - Custom event for Interstitial:
HyBidAdMobMediationInterstitialCustomEvent - Custom event for Rewarded:
HyBidAdMobMediationRewardedCustomEvent
For Google Mobile Ads SDK v:8.0.0 and above;
- Custom event for Leaderboard:
HyBidGADLeaderboardCustomEvent - Custom event for Banner:
HyBidGADBannerCustomEvent - Custom event for MRect:
HyBidGADMRectCustomEvent - Custom event for Interstitial:
HyBidGADInterstitialCustomEvent - Custom event for Rewarded:
HyBidGADRewardedCustomEvent
Parameters to set up:
{
"pn_app_token": "<YOUR PUBNATIVE APP TOKEN>",
"pn_zone_id": "<YOUR PLACEMENT ZONE ID>"
}After setting up your ad sources, you should be able to see the waterfall order for the selected ad units
Request Ads
Ads should be requested using the regular GAD (AdMob) process using the generated Ad Unit IDs. You can find the instructions in the GAD (AdMob) developers page.
Initialization
Please note: to complete implementation, the HyBid SDK needs to be initialized. Follow the HyBid integration guide and complete this step.
Updated 4 days ago
