This guide is intended for publishers who want to use the Google Mobile Ads SDK to load and display ads from Unity Ads via mediation. It covers how to add Unity Ads to an ad unit's mediation configuration, how to set up Automatic data collection, and how to integrate the Unity Ads SDK and adapter into an iOS app.
Supported ad formats and features
The DFP mediation adapter for Unity Ads has the following capabilities:
|Native Ads - Custom Rendering|
|Automatic data collection|
- Xcode 6.0 or higher
- iOS Deployment target of 7.0 or higher
- Minimum required Google Mobile Ads SDK 7.10.1 or higher
Step 1: Set up Unity ads
Fill out the form and click Continue at the bottom of the page to add your project to Unity Dashboard.
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 Apple App Store and click the OK, Got it! button at the bottom of the page.
Now create a new placement to be used with DFP mediation. We recommend creating a new placement for mediation with DFP 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 iOS app by selecting Apple App 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.
Choose Skippable Video as the type. Enter the placement's Name and Unity Ads will generate your Placement ID based on the name.
Choose whether or not to mute audio for your ads and enter a time in seconds after which the user is allowed to skip the ad. Click Save to create your Placement.
Choose Rewarded Video as the type. Enter the placement's Name and Unity Ads will generate your Placement ID based on the name.
Choose whether or not to mute audio for your ads and click Save to create your Placement.
Once the ad placement is created, you can locate your Placement ID under the Ad placements tab.
In addition to the Game ID and the Placement ID you will also need Unity Ads API Key for setting up your DFP ad unit ID. Navigate to the API keys tab in your Unity Ads Dashboard to get your API Key.
Step 2: Configure Mediation Settings for your DFP Ad Unit
Sign into your DFP account. Navigate to Delivery > Yield Groups and click the Create Yield Group button.
Enter a Yield Group Name, select your Ad Format, and set the Environment to Mobile App. Under the Targeting section, select the Ad Unit ID to which you want to add mediation.
Next, click the + Add Another Yield Partner button.
If you already have a Yield Partner for Unity Ads, you can simply select it. Otherwise, select Create a new Yield Partner.
Select UnityAds as the Yield partner and enter a unique Name. Check the checkbox for Enable automatic data collection of estimated CPM to optimize Mediation to enable ANO, and enter the API Key obtained in the previous section. Click Save when done.
Once the Yield partner is chosen, select Mobile SDK mediation as the Integration type and iOS as the Operating system. Enter the Game ID and the Placement ID obtained in the previous section. Enter a Default CPM value.
Click Save and Activate at the bottom of the page when done.
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 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 Unity adapter defaults to a reward of type "" (empty string) with value 1. The Unity Ads SDK does not provide specific reward values for its rewarded video ads.
Step 3: Import the Unity Ads SDK and adapter
Using CocoaPods (recommended)
Add the following line to your project's Podfile:
From the command line run:
pod install --repo-update
Download the latest version of the Unity Ads SDK, and link UnityAds.framework in your project.
Download the latest version of the Unity adapter and link UnityAdapter.framework in your project.
Step 4: Additional code required
No Additional code is required for Unity ads integration.
Step 5: Test your implementation
Test ads can be enabled from the Unity Ads dashboard by going to your project's platform specific settings. Under the TEST MODE section, toggle the override client test mode switch to on and choose the Force test mode ON to enable test ads.
That's it! You now have a working mediation integration with Unity Ads.