Google Mobile Ads
This guide shows you how to integrate our BlueStack mediation adapter of Google Mobile Ads SDK with your current Android app and set up additional request parameters.
Release notes can be found here
Supported ad formats
- Banners
- Interstitials
- Native Ads
- Rewarded Video
Requirements
- Use Xcode 13 or higher
- Target iOS 13.0 or higher
Google Ad Manager UI
The custom event must be defined in the Google Ad Manager UI.
1. Create a Yield groups
- Create an Ad Network
- Create a Company with Madvertise Ad-Network name
- Choose Appsfire network
- Allow mediation
2. Add a Yield Group
- Choose a name
- Choose a format (You must create a Yield Group by format)
- Choose at least one size according format
- Target a specific placement
3. Add A Yield Partner and Define a custom event
On your Google Ad Manager UI, create a custom event
- Select Madvertise Ad-Network created on Step 1
- Choose Custom Event for Integration type
- Choose your platform iOS or Android
- Set the following Label, class Name and Parameter according your format :
- Banner : Label= BlueStackCustomEvent, class Name= BlueStackDFPMediationAdapter.BlueStackCustomEvent and Parameter= /YOUR_APP_ID/PLACEMENT_ID_BANNER
- Interstitial : Label= BlueStackCustomEvent, class Name= BlueStackDFPMediationAdapter.BlueStackCustomEvent and Parameter= /YOUR_APP_ID/PLACEMENT_ID_INTER
- Native Ad : Label= BlueStackCustomEvent, class Name= BlueStackDFPMediationAdapter.BlueStackCustomEvent and Parameter= /YOUR_APP_ID/PLACEMENT_ID_NATIVEAD
- Square Ad : Label= BlueStackCustomEvent, class Name= BlueStackDFPMediationAdapter.BlueStackCustomEvent and Parameter= /YOUR_APP_ID/PLACEMENT_ID_SQUARE
- RewardVideo Ad : Label= BlueStackCustomEvent, class Name= BlueStackDFPMediationAdapter.BlueStackCustomEvent and Parameter= /YOUR_APP_ID/PLACEMENT_ID_REWARD_VIDEO
Integrate Bluestack DFP mediation adapter in your application project
1. Integration
Intergrate BlueStack SDK:
Check Using CocoaPods or Manual Install in order include Bluestack SDK on your application project.
Intergrate BlueStackDFPMediationAdapter SDK:
- Using Cocoapods
pod 'BlueStackDFPMediationAdapter'
- Using Swift Package Manager
Go to your project file --> Package Dependencies --> Add(+) --> Search for https://github.com/azerion/BlueStackDFPMediationAdapter
Import custom event classes in your source file:
- Objective-C
#import <BlueStackDFPMediationAdapter/BlueStackDFPMediationAdapter.h>
@import GoogleMobileAds;
- Swift
import BlueStackDFPMediationAdapter
import GoogleMobileAds
2. Initialize your ads
Note: You must initialize BlueStack SDK using your APP_ID before loading ads of any formats.
2.1 Ads formats:
You may now use BlueStack DFP Adapter to show ads the same way it's described in the DFP Documentation.The adapter code and the setup you did on your Google Ad Manager UI will allow BlueStack Ads to deliver ads.
Note: BlueStack v4.3.0 uses Google-Mobile-Ads-SDK v10. See Migrate from v9 to v10
-
Banner/Sqaure: BlueStackCustomEvent :
Before you can create custom events, you need to integrate the banner ad format into your app.
PS: You must Passed the ViewController to the GADBannerView:
Objective-C :
GADBannerView *bannerView;
......................
_bannerView.rootViewController = self;
Swift :
var bannerView: GAMBannerView!
bannerView.rootViewController = self
-
Interstitial: BlueStackCustomEvent :
Before you can create custom events, you need to integrate the Interstitial ad format into your app.
PS : In the Interstitial Ad inplementation you must Passed the ViewController to the Adapter:**
Objective-C :
[BlueStackCustomEvent setViewController:self];
Swift :
BlueStackCustomEvent.setViewController(self)
-
Native Ads: BlueStackCustomEvent :
Before you can create custom events, you need to integrate the Native ad format into your app.
PS: In the Native Ad inplementation you must Passed the ViewController to the BlueStackCustomEvent:**
Init BlueStackCustomEvent :
Objective-C :
[BlueStackCustomEvent setViewController:self];
Swift :
BlueStackCustomEvent.setViewController(self)
-
Rewarded video Ads: BlueStackCustomEvent :
Before you can create custom events, you need to integrate the Rewarded video ad format into your app.
PS: In the Rewarded video inplementation you must Passed the ViewController to the BlueStackCustomEvent:**
Init BlueStackCustomEvent :
Objective-C :
[BlueStackCustomEvent setViewController:self];
Swift :
BlueStackCustomEvent.setViewController(self)
3. Custom targeting / Keyword
If you need to send your custom key-value pairs. You can specify key-value-targeting and keywords information in the ad request as follows,and you must send your custom key-value pairs also as follows,add the extras to the registerAdNetworkExtras method as follows:
Objective-C
GAMRequest* request = [GAMRequest request];
BlueStackCustomEventMediationExtras *extras = [[BlueStackCustomEventMediationExtras alloc] initWithKeywords:@"target=mngadsdemo;version=4.0.0" customTargetingBlueStack:@{@"age" :@"25"}];
[request registerAdNetworkExtras:extras];
Swift
let request = GADRequest()
let extras = BlueStackCustomEventMediationExtras(keywords: "target=mngadsdemo;version=4.0.0", customTargetingBlueStack: ["age" :"25"])
request.register(extras)