SlideShare a Scribd company logo
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 1
GoogleAdMob Mediation Tutorial
AdMob Mediation is a feature that lets you serve ads to your apps from multiple sources, including the
AdMob Network, third-party ad networks, and house ad campaigns. AdMob Mediation helps maximize
your fill rate and increase your monetization by sending ad requests to multiple networks to ensure you
find the best available network to serve ads.
There are two types of mediation you can use, independently or simultaneously, in AdMob:
 Impression goal campaigns
 Ad sources ordered by eCPM
Some ad networks may allow SDK-less mediation.
Google AdMob Advantages
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 2
How GoogleAdMob mediation work:
AdMob currently supports SDK-less mediation for certain ad networks (Android, iOS). SDK-less
mediation allows you to access demand without needing to integrate individual ad network SDKs into
your apps. This means you can access additional networks for mediation without worrying about keeping
third-party SDKs up to date.
When we configure multiple ad networks in AdMob Mediation , you have to tell AdMob in what order to
request these networks by setting their respective CPM.
Ad Network Optimization (ANO) is a feature within AdMob Mediation that enables you to generate the
highest CPM from the ad netwroks in your mediation chain. AdMediation automates the process of
ordering your mediation chain and helps your maximize revenue with minimum effort.
Choosing your Mediation networks
Google mediation supports over 30 third-party ad networks. Integrating mediation requires
changes in these places:
1. Third-party ad network UI - Sign up for the third-party ad network and create a placement in
their frontend.
2. AdMob UI - Update your ad unit's mediation settings to include the ad network. It is also
recommended that you set up ad network optimization for ad networks that support it.
3. App code - Update your app to include the third-party ad network's SDK, and an adapter library
that communicates between Google and the third-party ad network to request and serve ads.
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 3
List of AdNetwork which support GoogleAdMediation:
*Those AdNetwroks are not listed here are added with the Custom Event.
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 4
Custom Events:
If you're looking for an ad network and don't see it on the list above, you can
use custom events to write your own integration with that ad network.
See Custom Events for more details on how to create a custom event.
Structure of GoogleAdMobMediation:
Each AdNetwork must had a Adapter and SDK for AdMobMediation.
How to setup AdMob mediation in Unity:
So we need to setup AdMob mediation in Unity for that we need to follow some step,
Step 1: Setup Your Dashboard for AdMob.
Step 2: SetUp your project for AdMob.
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 5
Setup 3: Setup your Dashboard for other Plugins.
Setup 4: Setup other Plugins in Unity Project.
Step 1: Setup Your Dashboard for AdMob:
Select the Monetize tab:
Fig .1.0
Click on New AD Unit:
Fig .1.1
Click on Reward Video:
Fig .1.2
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 6
Fill the Reward Amount you want , set the Reward Item and finally set the
Unit ID name.
Fig .1.3
To check the AdNetwrok added click on Medion Tab:
Fig .1.4
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 7
You can find all the AdNetwork List here :
Fig .1.5
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 8
Fig 1.6
Step 2: SetUp your project for AdMob:
We can download Google AdMob SDK from here:
https://developers.google.com/admob/unity/start
Download SDK here:
https://github.com/googleads/googleads-mobile-plugins/releases/latest
Requiremnts:
For Andriod:
To deploy on Android:
 Android SDK 3.2 or higher
 Google Play services 7.5 or higher
For IOS:
To deploy on iOS
 Xcode 7.0 or higher
 Google Mobile Ads SDK 7.7.0 or higher
 Unity 4 or higher
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 9
Import the SDK in your Game
Select Assets > Import Package > Custom Package and find the
GoogleMobileAdsPlugin.unitypackage file you downloaded.
2. Make sure all the files are selected and click Import.
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 10
Run your project
1. If you are running Unity 4 you need to make the following changes:
2.
Import the Google Mobile Ads SDK into your project.
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 11
Once these steps are complete, see the Unity plugin API section for more information
on how to request banner and interstitial ads using the plugin.
Unity plugin API
Basic banner request
using GoogleMobileAds.Api;
…
private void RequestBanner()
{
#if UNITY_EDITOR
string adUnitId = "unused";
#elif UNITY_ANDROID
string adUnitId = "INSERT_ANDROID_BANNER_AD_UNIT_ID_HERE";
#elif UNITY_IPHONE
string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE";
#else
string adUnitId = "unexpected_platform";
#endif
// Create a 320x50 banner at the top of the screen.
BannerView bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Top);
// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the banner with the request.
bannerView.LoadAd(request);
}
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 12
Basic interstitial request
using GoogleMobileAds.Api;
…
private void RequestInterstitial()
{
#if UNITY_ANDROID
string adUnitId = "INSERT_ANDROID_INTERSTITIAL_AD_UNIT_ID_HERE";
#elif UNITY_IPHONE
string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
#else
string adUnitId = "unexpected_platform";
#endif
// Initialize an InterstitialAd.
InterstitialAd interstitial = new InterstitialAd(adUnitId);
// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the interstitial with the request.
interstitial.LoadAd(request);
}
Ad events
private void RequestBanner()
{
BannerView bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Top);
// Called when an ad request has successfully loaded.
bannerView.OnAdLoaded += HandleOnAdLoaded;
// Called when an ad request failed to load.
bannerView.OnAdFailedToLoad += HandleOnAdFailedToLoad;
// Called when an ad is clicked.
bannerView.OnAdOpened += HandleOnAdOpened;
// Called when the user returned from the app after an ad click.
bannerView.OnAdClosed += HandleOnAdClosed;
// Called when the ad click caused the user to leave the application.
bannerView.OnAdLeavingApplication += HandleOnAdLeavingApplication;
}
public void HandleOnAdLoaded(object sender, EventArgs args)
{
print("OnAdLoaded event received.");
// Handle the ad loaded event.
}
Rewarded Video
Rewarded video ads allow publishers to offer the user something of value in exchange for
engaging with advertising content.
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 13
Basic rewarded video ad request
private void RequestRewardBasedVideo()
{
#if UNITY_EDITOR
string adUnitId = "unused";
#elif UNITY_ANDROID
string adUnitId = "ca-app-pub-3940256099942544/5224354917";
#elif UNITY_IPHONE
string adUnitId = "ca-app-pub-3940256099942544/1712485313";
#else
string adUnitId = "unexpected_platform";
#endif
RewardBasedVideoAd rewardBasedVideo = RewardBasedVideoAd.Instance;
AdRequest request = new AdRequest.Builder().Build();
rewardBasedVideo.LoadAd(request, adUnitId);
}
Rewarded video ad events
RewardBasedVideoAd provides ad events to notify you about an ad's lifecycle. These events are of type
EventHandler. This example demonstrates how to register for ad events on a rewarded video ad:
// Reward based video instance is a singleton. Register handlers once to
// avoid duplicate events.
if (!rewardBasedEventHandlersSet)
{
// Ad event fired when the rewarded video ad
// has been received.
rewardBasedVideo.OnAdLoaded += HandleRewardBasedVideoLoaded;
// has failed to load.
rewardBasedVideo.OnAdFailedToLoad += HandleRewardBasedVideoFailedToLoad;
// is opened.
rewardBasedVideo.OnAdOpening += HandleRewardBasedVideoOpened;
// has started playing.
rewardBasedVideo.OnAdStarted += HandleRewardBasedVideoStarted;
// has rewarded the user.
rewardBasedVideo.OnAdRewarded += HandleRewardBasedVideoRewarded;
// is closed.
rewardBasedVideo.OnAdClosed += HandleRewardBasedVideoClosed;
// is leaving the application.
rewardBasedVideo.OnAdLeavingApplication += HandleRewardBasedVideoLeftApplication;
rewardBasedEventHandlersSet = true;
}
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 14
Settitng 3rd Paty AdNetworks:
 Chartboost
 Vungle
 UnityAds
 InMovi
 Mobvista
 Zappr
 Pokkt
Configure Mediation Settings for your AdMob Ad Unit
You need to add ThirdParty Ads Network to the mediation configuration for your ad unit. First
sign in to your AdMob account.
Navigate to the Monetize tab and select your app from the list of All apps on the left-hand side. Click the
link in the mediation column for the ad unit you want to mediate to Third Party Ads Network.
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 15
Click + NEW AD NETWORK.
Select Any Third Party Ad Netwrok (eg. Chartboost) from the list of networks provided and enter the
App ID and the App Signature obtained in the previous section. Also, enter an Ad Location (e.g. "Game
Over Screen") that uniquely identifies this placement in your app.
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 16
Next, add the User ID and the User Signature obtained in the previous section to set up ANO
for Third Party Ads Network.
Click Continue at the bottom of the page to complete adding the network. Enter an eCPM value
for Third Party Ads Network and click Save.
Using Rewarded Video Ads
In the settings for your rewarded video ad unit, check the Override reward settings from third-
party ad networks when using AdMob mediation so that you provide the same reward to the
user no matter which ad network is served.
If you don't override the reward, the Third Party Ads Network adapter passes back the reward
specified in the Third Party Ads Network UI.
For more information on setting reward values for AdMob ad units, see Create an ad unit.
Chartboost:
Download the latest version of the Chartboost SDK. Find the chartboost.jar file under lib/ folder
and add it to your project's libs folder (create a libs folder and add the jar file if you don't have one).
Step1: SetUp Chartboost
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 17
Sign up for a Chartboost account and log in once your account is verified. Click the + APP button on the
left sidebar. Fill out the form and click save to add your app to Chartboost.
Create a new campaign to enable ads for your app. To create a new campaign navigate to Campaigns >
Publishing from the left-side menu and click Add a Campaign (or + Add Campaign at the top right
corner of your dashboard if you already have other campaigns) and choose Network Publishing when
prompted.
Enter a Name for your publishing campaign, select the Ad Type (AdMob supports Interstitials and
Rewarded video ad formats for Chartboost mediation), select Google Play as the Platform and then add
your app to the Apps Publishing this Campaign. Click save to finish adding the campaign.
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 18
You will now obtain all the parameters that will be used in setting up the AdMob ad unit ID in the next
section. In your Chartboost dashboard for your app, navigate to App Settings > Basic Settings to locate
your App ID and App Signature.
AdMob also requires the Chartboost User ID and User Signature for setting up your AdMob Ad Unit
ID. You can find these parameters on your Chartboost dashboard by navigating to Tools > API Explorer.
Your User ID and User Signature are located under the Authentication section.
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 19
Step2:Modify your Android Manifest
Mandatory Permissions
Add the following permission to your AndriodManifest.xml
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Required by Chartboost, and AdMob Ad Network -->
<uses-permission android:name="android.permission.INTERNET" />
Activities
Add the following Activities to your AndriodManifest.xml
<!-- Chartboost -->
<activity android:name="com.chartboost.sdk.CBImpressionActivity"
android:excludeFromRecents="true"
android:hardwareAccelerated="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
android:configChanges="keyboardHidden|orientation|screenSize" />
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 20
InMovi:
Download the InMobi SDK and adapter from the links above.
Step1:Modify your Android Manifest
Mandatory Permissions
Add the following permission to your AndriodManifest.xml
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Required by AdMob Ad Network, and InMobi -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Required by InMobi -->
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
Activities
Add the following Activities to your AndriodManifest.xml
<!-- InMobi -->
<activity android:name="com.inmobi.rendering.InMobiAdActivity"
android:configChanges="keyboardHidden|orientation|keyboard|smallestScreenSize|screenSize"
android:theme="@android:style/Theme.Translucent.NoTitleBar" android:hardwareAccelerated="true" />
<receiver android:name="com.inmobi.commons.core.utilities.uid.ImIdShareBroadCastReceiver"
android:enabled="true" android:exported="true" >
<intent-filter>
<action android:name="com.inmobi.share.id" />
</intent-filter>
</receiver>
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 21
<service android:name="com.inmobi.signals.activityrecognition.ActivityRecognitionManager"
android:enabled="true" />
Vungle:
Download the Vungle SDK and adapter from the links above.
Step1:Modify your Android Manifest
Mandatory Permissions
Add the following permission to your AndriodManifest.xml
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Required by AdMob Ad Network, and Vungle -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Required by Vungle -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Activities
Add the following Activities to your AndriodManifest.xml
<!-- Vungle -->
<activity android:name="com.vungle.publisher.VideoFullScreenAdActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
<activity android:name="com.vungle.publisher.MraidFullScreenAdActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 22
UnityAds:
Download the UnityAds SDK and add the .jar to your project.
Step1: Set up Unity ads
Create and login to your Unity ID. Navigate to your Unity Ads Dashboard and add your project to Unity
dashboard by clicking the Add new project button.
Fill out the form and click Continue at the bottom of the page to add your project to Unity Dashboard.
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 23
Once your project is created, Unity will display instructions on how to integrate. You can skip these
instructions but take a note of the Game ID for Google Play Store and click the OK, Got it! button at the
bottom of the page.
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 24
Now create a new placement to be used with AdMob mediation. We recommend creating a new
placement for mediation with AdMob even if you have a placement already. To create a new placement,
select your project under the Projects tab in your Unity Ads Dashboard. Go to your Android app by
selecting Google Play Store under the Platforms tab of your project.
For additional instructions on creating an ad placement, select the tab corresponding to your preferred ad
format.
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 25
Once the ad placement is created, you can locate your Placement ID under the Ad placements tab.
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 26
In addition to the Game ID and the Placement ID you will also need Unity Ads API Key for setting up
your AdMob Ad Unit ID. Navigate to the API keys tab in your Unity Ads Dashboard to get your API
Key.
Step2:Modify your Android Manifest
Mandatory Permissions
Add the following permission to your AndriodManifest.xml
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Required by Heyzap Ad Network, and UnityAds -->
<uses-permission android:name="android.permission.INTERNET" />
Activities
Add the following Activities to your AndriodManifest.xml
<!-- UnityAds -->
<activity android:name="com.unity3d.ads.adunit.AdUnitActivity"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLay
out|screenSize|smallestScreenSize|uiMode|touchscreen" android:hardwareAccelerated="true"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 27
<activity android:name="com.unity3d.ads.adunit.AdUnitSoftwareActivity"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLay
out|screenSize|smallestScreenSize|uiMode|touchscreen" android:hardwareAccelerated="false"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
References:
https://developers.google.com/admob/android/quick-start

More Related Content

PDF
DJI Live Stream Case Study
PDF
Workshop: Integrating Amazon APIs in Unity
DOCX
PICS QUIZ - INTEGRATION
PPTX
TargetSummit Moscow 2016 | Fighting Ads Fraud in the Mobile Apps, David Mail
PDF
Google中国admob战略合作总监赵旭昱_网易科技五道口沙龙
PDF
How to build a mobile business
PDF
Things to Consider When Choosing An Ad Network for your App
PDF
Introduction to mobile app monetization with ads
DJI Live Stream Case Study
Workshop: Integrating Amazon APIs in Unity
PICS QUIZ - INTEGRATION
TargetSummit Moscow 2016 | Fighting Ads Fraud in the Mobile Apps, David Mail
Google中国admob战略合作总监赵旭昱_网易科技五道口沙龙
How to build a mobile business
Things to Consider When Choosing An Ad Network for your App
Introduction to mobile app monetization with ads

Similar to Google admob mediation tutorial (20)

PPTX
Ad mediation - How Ad mediation work and the benefit of the Ad mediation.
PDF
App developers journey in monetization
PDF
OGDC 2014_User segmentation and Monetization_Mr. Phat hoang
PPTX
Mobile Game Asia 2015 Bangkok: Monetization Trends and Challenges in 2015
PDF
Ads in Mobile Games and Apps 101
PPTX
Ad network mediation guideline
PPTX
The Developer Tour - Hanoi
PPTX
Presentation vadim rogovskiy
PDF
Brand new look at mobile apps ad monetization
PDF
Grow your game with Google ad monetisation / Bogdina Buvaeva (Google)
PDF
Ad monetization 101
PDF
Mobile Acquisition Strategy for New IPs
PDF
Advertsing Monetization Strategy
PDF
Making money with android applications
PPTX
Rich Media Mobile Ads - BlrDroid
PDF
Earn More Revenue With Firebase and AdMob
PPTX
Mobile Ad Monetization for Games | Christian Calderon
PPTX
Mobile Advertising Glossary
PPTX
Mobile Marketing Study and Recommendations
PDF
Epom Ad Server For Networks
Ad mediation - How Ad mediation work and the benefit of the Ad mediation.
App developers journey in monetization
OGDC 2014_User segmentation and Monetization_Mr. Phat hoang
Mobile Game Asia 2015 Bangkok: Monetization Trends and Challenges in 2015
Ads in Mobile Games and Apps 101
Ad network mediation guideline
The Developer Tour - Hanoi
Presentation vadim rogovskiy
Brand new look at mobile apps ad monetization
Grow your game with Google ad monetisation / Bogdina Buvaeva (Google)
Ad monetization 101
Mobile Acquisition Strategy for New IPs
Advertsing Monetization Strategy
Making money with android applications
Rich Media Mobile Ads - BlrDroid
Earn More Revenue With Firebase and AdMob
Mobile Ad Monetization for Games | Christian Calderon
Mobile Advertising Glossary
Mobile Marketing Study and Recommendations
Epom Ad Server For Networks
Ad

Recently uploaded (20)

PDF
An introduction to the IFRS (ISSB) Stndards.pdf
PDF
Paper PDF World Game (s) Great Redesign.pdf
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PPTX
Funds Management Learning Material for Beg
PPTX
Internet___Basics___Styled_ presentation
PPTX
PptxGenJS_Demo_Chart_20250317130215833.pptx
PDF
Testing WebRTC applications at scale.pdf
PDF
Decoding a Decade: 10 Years of Applied CTI Discipline
PPTX
QR Codes Qr codecodecodecodecocodedecodecode
PPTX
Introuction about ICD -10 and ICD-11 PPT.pptx
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PDF
Sims 4 Historia para lo sims 4 para jugar
PDF
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
PPTX
innovation process that make everything different.pptx
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PDF
Unit-1 introduction to cyber security discuss about how to secure a system
PPTX
Introduction to Information and Communication Technology
PPTX
SAP Ariba Sourcing PPT for learning material
An introduction to the IFRS (ISSB) Stndards.pdf
Paper PDF World Game (s) Great Redesign.pdf
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
Funds Management Learning Material for Beg
Internet___Basics___Styled_ presentation
PptxGenJS_Demo_Chart_20250317130215833.pptx
Testing WebRTC applications at scale.pdf
Decoding a Decade: 10 Years of Applied CTI Discipline
QR Codes Qr codecodecodecodecocodedecodecode
Introuction about ICD -10 and ICD-11 PPT.pptx
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
The New Creative Director: How AI Tools for Social Media Content Creation Are...
Sims 4 Historia para lo sims 4 para jugar
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
innovation process that make everything different.pptx
Tenda Login Guide: Access Your Router in 5 Easy Steps
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
Unit-1 introduction to cyber security discuss about how to secure a system
Introduction to Information and Communication Technology
SAP Ariba Sourcing PPT for learning material
Ad

Google admob mediation tutorial

  • 1. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 1 GoogleAdMob Mediation Tutorial AdMob Mediation is a feature that lets you serve ads to your apps from multiple sources, including the AdMob Network, third-party ad networks, and house ad campaigns. AdMob Mediation helps maximize your fill rate and increase your monetization by sending ad requests to multiple networks to ensure you find the best available network to serve ads. There are two types of mediation you can use, independently or simultaneously, in AdMob:  Impression goal campaigns  Ad sources ordered by eCPM Some ad networks may allow SDK-less mediation. Google AdMob Advantages
  • 2. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 2 How GoogleAdMob mediation work: AdMob currently supports SDK-less mediation for certain ad networks (Android, iOS). SDK-less mediation allows you to access demand without needing to integrate individual ad network SDKs into your apps. This means you can access additional networks for mediation without worrying about keeping third-party SDKs up to date. When we configure multiple ad networks in AdMob Mediation , you have to tell AdMob in what order to request these networks by setting their respective CPM. Ad Network Optimization (ANO) is a feature within AdMob Mediation that enables you to generate the highest CPM from the ad netwroks in your mediation chain. AdMediation automates the process of ordering your mediation chain and helps your maximize revenue with minimum effort. Choosing your Mediation networks Google mediation supports over 30 third-party ad networks. Integrating mediation requires changes in these places: 1. Third-party ad network UI - Sign up for the third-party ad network and create a placement in their frontend. 2. AdMob UI - Update your ad unit's mediation settings to include the ad network. It is also recommended that you set up ad network optimization for ad networks that support it. 3. App code - Update your app to include the third-party ad network's SDK, and an adapter library that communicates between Google and the third-party ad network to request and serve ads.
  • 3. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 3 List of AdNetwork which support GoogleAdMediation: *Those AdNetwroks are not listed here are added with the Custom Event.
  • 4. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 4 Custom Events: If you're looking for an ad network and don't see it on the list above, you can use custom events to write your own integration with that ad network. See Custom Events for more details on how to create a custom event. Structure of GoogleAdMobMediation: Each AdNetwork must had a Adapter and SDK for AdMobMediation. How to setup AdMob mediation in Unity: So we need to setup AdMob mediation in Unity for that we need to follow some step, Step 1: Setup Your Dashboard for AdMob. Step 2: SetUp your project for AdMob.
  • 5. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 5 Setup 3: Setup your Dashboard for other Plugins. Setup 4: Setup other Plugins in Unity Project. Step 1: Setup Your Dashboard for AdMob: Select the Monetize tab: Fig .1.0 Click on New AD Unit: Fig .1.1 Click on Reward Video: Fig .1.2
  • 6. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 6 Fill the Reward Amount you want , set the Reward Item and finally set the Unit ID name. Fig .1.3 To check the AdNetwrok added click on Medion Tab: Fig .1.4
  • 7. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 7 You can find all the AdNetwork List here : Fig .1.5
  • 8. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 8 Fig 1.6 Step 2: SetUp your project for AdMob: We can download Google AdMob SDK from here: https://developers.google.com/admob/unity/start Download SDK here: https://github.com/googleads/googleads-mobile-plugins/releases/latest Requiremnts: For Andriod: To deploy on Android:  Android SDK 3.2 or higher  Google Play services 7.5 or higher For IOS: To deploy on iOS  Xcode 7.0 or higher  Google Mobile Ads SDK 7.7.0 or higher  Unity 4 or higher
  • 9. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 9 Import the SDK in your Game Select Assets > Import Package > Custom Package and find the GoogleMobileAdsPlugin.unitypackage file you downloaded. 2. Make sure all the files are selected and click Import.
  • 10. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 10 Run your project 1. If you are running Unity 4 you need to make the following changes: 2. Import the Google Mobile Ads SDK into your project.
  • 11. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 11 Once these steps are complete, see the Unity plugin API section for more information on how to request banner and interstitial ads using the plugin. Unity plugin API Basic banner request using GoogleMobileAds.Api; … private void RequestBanner() { #if UNITY_EDITOR string adUnitId = "unused"; #elif UNITY_ANDROID string adUnitId = "INSERT_ANDROID_BANNER_AD_UNIT_ID_HERE"; #elif UNITY_IPHONE string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE"; #else string adUnitId = "unexpected_platform"; #endif // Create a 320x50 banner at the top of the screen. BannerView bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Top); // Create an empty ad request. AdRequest request = new AdRequest.Builder().Build(); // Load the banner with the request. bannerView.LoadAd(request); }
  • 12. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 12 Basic interstitial request using GoogleMobileAds.Api; … private void RequestInterstitial() { #if UNITY_ANDROID string adUnitId = "INSERT_ANDROID_INTERSTITIAL_AD_UNIT_ID_HERE"; #elif UNITY_IPHONE string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE"; #else string adUnitId = "unexpected_platform"; #endif // Initialize an InterstitialAd. InterstitialAd interstitial = new InterstitialAd(adUnitId); // Create an empty ad request. AdRequest request = new AdRequest.Builder().Build(); // Load the interstitial with the request. interstitial.LoadAd(request); } Ad events private void RequestBanner() { BannerView bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Top); // Called when an ad request has successfully loaded. bannerView.OnAdLoaded += HandleOnAdLoaded; // Called when an ad request failed to load. bannerView.OnAdFailedToLoad += HandleOnAdFailedToLoad; // Called when an ad is clicked. bannerView.OnAdOpened += HandleOnAdOpened; // Called when the user returned from the app after an ad click. bannerView.OnAdClosed += HandleOnAdClosed; // Called when the ad click caused the user to leave the application. bannerView.OnAdLeavingApplication += HandleOnAdLeavingApplication; } public void HandleOnAdLoaded(object sender, EventArgs args) { print("OnAdLoaded event received."); // Handle the ad loaded event. } Rewarded Video Rewarded video ads allow publishers to offer the user something of value in exchange for engaging with advertising content.
  • 13. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 13 Basic rewarded video ad request private void RequestRewardBasedVideo() { #if UNITY_EDITOR string adUnitId = "unused"; #elif UNITY_ANDROID string adUnitId = "ca-app-pub-3940256099942544/5224354917"; #elif UNITY_IPHONE string adUnitId = "ca-app-pub-3940256099942544/1712485313"; #else string adUnitId = "unexpected_platform"; #endif RewardBasedVideoAd rewardBasedVideo = RewardBasedVideoAd.Instance; AdRequest request = new AdRequest.Builder().Build(); rewardBasedVideo.LoadAd(request, adUnitId); } Rewarded video ad events RewardBasedVideoAd provides ad events to notify you about an ad's lifecycle. These events are of type EventHandler. This example demonstrates how to register for ad events on a rewarded video ad: // Reward based video instance is a singleton. Register handlers once to // avoid duplicate events. if (!rewardBasedEventHandlersSet) { // Ad event fired when the rewarded video ad // has been received. rewardBasedVideo.OnAdLoaded += HandleRewardBasedVideoLoaded; // has failed to load. rewardBasedVideo.OnAdFailedToLoad += HandleRewardBasedVideoFailedToLoad; // is opened. rewardBasedVideo.OnAdOpening += HandleRewardBasedVideoOpened; // has started playing. rewardBasedVideo.OnAdStarted += HandleRewardBasedVideoStarted; // has rewarded the user. rewardBasedVideo.OnAdRewarded += HandleRewardBasedVideoRewarded; // is closed. rewardBasedVideo.OnAdClosed += HandleRewardBasedVideoClosed; // is leaving the application. rewardBasedVideo.OnAdLeavingApplication += HandleRewardBasedVideoLeftApplication; rewardBasedEventHandlersSet = true; }
  • 14. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 14 Settitng 3rd Paty AdNetworks:  Chartboost  Vungle  UnityAds  InMovi  Mobvista  Zappr  Pokkt Configure Mediation Settings for your AdMob Ad Unit You need to add ThirdParty Ads Network to the mediation configuration for your ad unit. First sign in to your AdMob account. Navigate to the Monetize tab and select your app from the list of All apps on the left-hand side. Click the link in the mediation column for the ad unit you want to mediate to Third Party Ads Network.
  • 15. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 15 Click + NEW AD NETWORK. Select Any Third Party Ad Netwrok (eg. Chartboost) from the list of networks provided and enter the App ID and the App Signature obtained in the previous section. Also, enter an Ad Location (e.g. "Game Over Screen") that uniquely identifies this placement in your app.
  • 16. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 16 Next, add the User ID and the User Signature obtained in the previous section to set up ANO for Third Party Ads Network. Click Continue at the bottom of the page to complete adding the network. Enter an eCPM value for Third Party Ads Network and click Save. Using Rewarded Video Ads In the settings for your rewarded video ad unit, check the Override reward settings from third- party ad networks when using AdMob mediation so that you provide the same reward to the user no matter which ad network is served. If you don't override the reward, the Third Party Ads Network adapter passes back the reward specified in the Third Party Ads Network UI. For more information on setting reward values for AdMob ad units, see Create an ad unit. Chartboost: Download the latest version of the Chartboost SDK. Find the chartboost.jar file under lib/ folder and add it to your project's libs folder (create a libs folder and add the jar file if you don't have one). Step1: SetUp Chartboost
  • 17. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 17 Sign up for a Chartboost account and log in once your account is verified. Click the + APP button on the left sidebar. Fill out the form and click save to add your app to Chartboost. Create a new campaign to enable ads for your app. To create a new campaign navigate to Campaigns > Publishing from the left-side menu and click Add a Campaign (or + Add Campaign at the top right corner of your dashboard if you already have other campaigns) and choose Network Publishing when prompted. Enter a Name for your publishing campaign, select the Ad Type (AdMob supports Interstitials and Rewarded video ad formats for Chartboost mediation), select Google Play as the Platform and then add your app to the Apps Publishing this Campaign. Click save to finish adding the campaign.
  • 18. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 18 You will now obtain all the parameters that will be used in setting up the AdMob ad unit ID in the next section. In your Chartboost dashboard for your app, navigate to App Settings > Basic Settings to locate your App ID and App Signature. AdMob also requires the Chartboost User ID and User Signature for setting up your AdMob Ad Unit ID. You can find these parameters on your Chartboost dashboard by navigating to Tools > API Explorer. Your User ID and User Signature are located under the Authentication section.
  • 19. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 19 Step2:Modify your Android Manifest Mandatory Permissions Add the following permission to your AndriodManifest.xml <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- Required by Chartboost, and AdMob Ad Network --> <uses-permission android:name="android.permission.INTERNET" /> Activities Add the following Activities to your AndriodManifest.xml <!-- Chartboost --> <activity android:name="com.chartboost.sdk.CBImpressionActivity" android:excludeFromRecents="true" android:hardwareAccelerated="true" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" android:configChanges="keyboardHidden|orientation|screenSize" />
  • 20. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 20 InMovi: Download the InMobi SDK and adapter from the links above. Step1:Modify your Android Manifest Mandatory Permissions Add the following permission to your AndriodManifest.xml <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- Required by AdMob Ad Network, and InMobi --> <uses-permission android:name="android.permission.INTERNET" /> <!-- Required by InMobi --> <uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" /> Activities Add the following Activities to your AndriodManifest.xml <!-- InMobi --> <activity android:name="com.inmobi.rendering.InMobiAdActivity" android:configChanges="keyboardHidden|orientation|keyboard|smallestScreenSize|screenSize" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:hardwareAccelerated="true" /> <receiver android:name="com.inmobi.commons.core.utilities.uid.ImIdShareBroadCastReceiver" android:enabled="true" android:exported="true" > <intent-filter> <action android:name="com.inmobi.share.id" /> </intent-filter> </receiver>
  • 21. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 21 <service android:name="com.inmobi.signals.activityrecognition.ActivityRecognitionManager" android:enabled="true" /> Vungle: Download the Vungle SDK and adapter from the links above. Step1:Modify your Android Manifest Mandatory Permissions Add the following permission to your AndriodManifest.xml <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- Required by AdMob Ad Network, and Vungle --> <uses-permission android:name="android.permission.INTERNET" /> <!-- Required by Vungle --> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> Activities Add the following Activities to your AndriodManifest.xml <!-- Vungle --> <activity android:name="com.vungle.publisher.VideoFullScreenAdActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" /> <activity android:name="com.vungle.publisher.MraidFullScreenAdActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
  • 22. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 22 UnityAds: Download the UnityAds SDK and add the .jar to your project. Step1: Set up Unity ads Create and login to your Unity ID. Navigate to your Unity Ads Dashboard and add your project to Unity dashboard by clicking the Add new project button. Fill out the form and click Continue at the bottom of the page to add your project to Unity Dashboard.
  • 23. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 23 Once your project is created, Unity will display instructions on how to integrate. You can skip these instructions but take a note of the Game ID for Google Play Store and click the OK, Got it! button at the bottom of the page.
  • 24. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 24 Now create a new placement to be used with AdMob mediation. We recommend creating a new placement for mediation with AdMob even if you have a placement already. To create a new placement, select your project under the Projects tab in your Unity Ads Dashboard. Go to your Android app by selecting Google Play Store under the Platforms tab of your project. For additional instructions on creating an ad placement, select the tab corresponding to your preferred ad format.
  • 25. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 25 Once the ad placement is created, you can locate your Placement ID under the Ad placements tab.
  • 26. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 26 In addition to the Game ID and the Placement ID you will also need Unity Ads API Key for setting up your AdMob Ad Unit ID. Navigate to the API keys tab in your Unity Ads Dashboard to get your API Key. Step2:Modify your Android Manifest Mandatory Permissions Add the following permission to your AndriodManifest.xml <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- Required by Heyzap Ad Network, and UnityAds --> <uses-permission android:name="android.permission.INTERNET" /> Activities Add the following Activities to your AndriodManifest.xml <!-- UnityAds --> <activity android:name="com.unity3d.ads.adunit.AdUnitActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLay out|screenSize|smallestScreenSize|uiMode|touchscreen" android:hardwareAccelerated="true" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
  • 27. B y - R a k e s h P a r i h a r [ h t t p : / / r a k e s h p a r i h a r . w e e b l y . c o m ] Page 27 <activity android:name="com.unity3d.ads.adunit.AdUnitSoftwareActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLay out|screenSize|smallestScreenSize|uiMode|touchscreen" android:hardwareAccelerated="false" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" /> References: https://developers.google.com/admob/android/quick-start