שילוב מודעות Unity עם תהליך בחירת הרשת (Mediation)

This guide shows you how to use the Google Mobile Ads SDK to load and display ads from Unity Ads using mediation, covering waterfall integrations. It covers how to add Unity Ads to an ad unit's mediation configuration, and how to integrate the Unity Ads SDK and adapter into an app.

Supported integrations and ad formats

The mediation adapter for Unity Ads has the following capabilities:

Integration
Bidding
Waterfall
Formats
Banner
Interstitial
Rewarded
Native

Requirements

  • iOS deployment target of 12.0 or higher

Step 1: Set up configurations in Unity Ads UI

נרשמים או מתחברים ל-Unity Ads.

יוצרים פרויקט

ב-Unity Ads Dashboard, נכנסים לקטע Projects ולוחצים על Create Project.

ממלאים את הטופס ולוחצים על Create Project כדי להוסיף את הפרויקט.

עוברים אל מונטיזציה > שנתחיל?, ואז לוחצים על שנתחיל?.

בחלון Project Setup (הגדרת פרויקט), בוחרים באפשרות I plan to use Mediation (אני רוצה להשתמש בתהליך בחירת הרשת (Mediation)) וב-Google Admob בקטע Mediation Partner (שותף בתהליך בחירת הרשת) ולוחצים על Next.

בוחרים את הגדרות המודעות ולוחצים על הבא.

ממלאים את הטופס ולוחצים על הוספת פרויקט.

מזינים את מזהה המשחק.

יצירה של יחידת מודעות

עוברים אל מונטיזציה > יחידות מודעות ולוחצים על הוספה של יחידת מודעות.

מזינים שם של יחידת מודעות ובוחרים את הפלטפורמה ואת פורמט המודעה.

Android

iOS

לסיום, לוחצים על יצירה כדי לשמור את יחידת המודעות.

הוספת מיקום

לאחר יצירת הפרויקט, עוברים אל מונטיזציה > מיקומי מודעות. כדי ליצור מיקום מודעה חדש, לוחצים על Add Placement ליחידת המודעות.

ממלאים את הפרטים הנדרשים ולוחצים על הוספת מיקום.

חשוב לשים לב למזהה מיקום המודעה.

איתור מפתח Unity Ads Reporting API

בידינג

לא צריך לבצע את השלב הזה בשילוב של בידינג.

מפל

בנוסף למזהה המשחק ולמזהה המיקום, צריך גם את מפתח ה-API של Unity Ads ואת מזהה הליבה של הארגון כדי להגדיר אתAd Manager המזהה של יחידת המודעות.

עוברים אל מונטיזציה > Setup (הגדרה) > API Management (ניהול API) ושימו לב למפתח הגישה של ה-API של מונטיזציה (מונטיזציה).

לאחר מכן עוברים אל מונטיזציה > Organization Settings (הגדרות הארגון) ורושמים לעצמכם את Organization Core ID.

הפעלת מצב בדיקה

אפשר להפעיל את מצב הבדיקה במרכז הבקרה של Unity Ads. בהגדרות הפרויקט, לוחצים על הכרטיסייה Testing.

כדי לאלץ את מצב הבדיקה של האפליקציה, לוחצים על לחצן העריכה בכל פלטפורמה, מסמנים את האפשרות Override client check mode (שינוי מצב הבדיקה של הלקוח) ובוחרים באפשרות אילוץ מצב בדיקה (כלומר, שימוש במודעות בדיקה) בכל המכשירים.

Android

iOS

לחלופין, אפשר להפעיל את מצב הבדיקה במכשירים ספציפיים בלחיצה על הלחצן Add Test Device (הוספת מכשיר בדיקה).

ממלאים את הטופס ולוחצים על שמירה.

Step 2: Set up Unity Ads demand in Ad Manager UI

קביעת הגדרות של תהליך בחירת הרשת (Mediation) ביחידת המודעות

Android

לקבלת הוראות, עיינו בשלב 2 במדריך עבור Android.

iOS

לקבלת הוראות, עיינו בשלב 2 במדריך iOS.

Add Unity Ads to GDPR and US state regulations ad partners list

פועלים לפי השלבים המפורטים בקטע הגדרות GDPR וגם הגדרות של תקנות במדינות בארה"ב כדי להוסיף את Unity Ads לרשימת שותפי הפרסום לתקנות GDPR ומדינות בארה"ב בממשק המשתמש Ad Manager .

Step 3: Import the Unity Ads SDK and adapter

  • Add the following line to your project's Podfile:

    pod 'GoogleMobileAdsMediationUnity'
    
  • From the command line run:

    pod install --repo-update

Manual integration

  • Download the latest version of the Unity Ads SDK, and link UnityAds.framework in your project.

  • Download the latest version of the Unity Ads adapter from the download link in the Changelog and link UnityAdapter.framework in your project.

Step 4: Implement privacy settings on Unity Ads SDK

Under the Google EU User Consent Policy, you must ensure that certain disclosures are given to, and consents obtained from, users in the European Economic Area (EEA) regarding the use of device identifiers and personal data. This policy reflects the requirements of the EU ePrivacy Directive and the General Data Protection Regulation (GDPR). When seeking consent, you must identify each ad network in your mediation chain that may collect, receive, or use personal data and provide information about each network's use. Google currently is unable to pass the user's consent choice to such networks automatically.

In SDK version 2.0.0, Unity Ads added an API to support privacy settings. The following sample code shows how to pass this consent information to the Unity Ads SDK. Should you choose to pass consent information to the Unity Ads SDK manually, it is recommended that this code is called prior to requesting ads through the Google Mobile Ads SDK.

Swift

import UnityAds
// ...

let gdprMetaData = UADSMetaData()
gdprMetaData.set("gdpr.consent", value: true)
gdprMetaData.commit()

Objective-C

#import <UnityAds/UnityAds.h>
// ...

UADSMetaData *gdprMetaData = [[UADSMetaData alloc] init];
[gdprMetaData set:@"gdpr.consent" value:@YES];
[gdprMetaData commit];

See Unity Ads' Privacy Consent and data APIs and Complying with GDPR guides for more details and the values that can be provided in each method.

US states privacy laws

U.S. states privacy laws require giving users the right to opt out of the "sale" of their "personal information" (as the law defines those terms), with the opt-out offered via a prominent "Do Not Sell My Personal Information" link on the "selling" party's homepage. The U.S. states privacy laws compliance guide offers the ability to enable restricted data processing for Google ad serving, but Google is unable to apply this setting to each ad network in your mediation chain. Therefore, you must identify each ad network in your mediation chain that may participate in the sale of personal information and follow guidance from each of those networks to ensure compliance.

In SDK version 2.0.0, Unity Ads added an API to support privacy settings. The following sample code shows how to pass this consent information to the Unity Ads SDK. Should you choose to pass consent information to the Unity Ads SDK manually, it is recommended that this code is called prior to requesting ads through the Google Mobile Ads SDK.

Swift

import UnityAds
// ...

let ccpaMetaData = UADSMetaData()
ccpaMetaData.set("privacy.consent", value: true)
ccpaMetaData.commit()

Objective-C

#import <UnityAds/UnityAds.h>
// ...

UADSMetaData *ccpaMetaData = [[UADSMetaData alloc] init];
[ccpaMetaData set:@"privacy.consent" value:@YES];
[ccpaMetaData commit];

See Unity Ads' Privacy Consent and data APIs and Complying with CCPA guides for more details and the values that can be provided in each method.

Step 5: Add required code

SKAdNetwork integration

Follow Unity Ads's documentation to add the SKAdNetwork identifiers to your project's Info.plist file.

Compile errors

Swift

No additional code is required for Swift integrations.

Objective-C

For Unity Ads adapter 4.4.0.0 or higher, you must follow the integration steps in the Unity documentation.

Step 6: Test your implementation

הפעלת מודעות בדיקה

חשוב לרשום את מכשיר הבדיקה ל- Ad Manager ולהפעיל את מצב הבדיקה ב Unity Ads ממשק המשתמש.

אימות מודעות בדיקה

כדי לוודא שמוצגות לך מודעות לבדיקה מ-Unity Ads, צריך להפעיל בדיקה של מקור מודעות יחיד בכלי לבדיקת מודעות באמצעות Unity Ads (Waterfall) מקורות המודעות.

Error codes

If the adapter fails to receive an ad from Unity Ads, publishers can check the underlying error from the ad response using GADResponseInfo.adNetworkInfoArray under the following classes:

GADMAdapterUnity
GADMediationAdapterUnity

Here are the codes and accompanying messages thrown by the UnityAds adapter when an ad fails to load:

Error code Reason
0-9 UnityAds SDK returned an error. See Unity's documentation for more details.
101 UnityAds server parameters configured in the Ad Manager UI are missing/invalid.
102 Device not supported by UnityAds.
103 UnityAds finished presenting with error state kUnityAdsFinishStateError.
104 The Unity ad object is nil after calling its initializer.
105 Failed to show Unity Ads due to ad not ready.
106 UnityAds called a placement changed callback with placement state kUnityAdsPlacementStateNoFill.
107 UnityAds called a placement changed callback with placement state kUnityAdsPlacementStateDisabled.
108 An ad was already loaded for this placement. UnityAds SDK does not support loading multiple ads for the same placement.

Unity Ads iOS Mediation Adapter Changelog

Version 4.12.1.0

  • Verified compatibility with Unity Ads SDK 4.12.1.

Built and tested with:

  • Google Mobile Ads SDK version 11.6.0.
  • Unity Ads SDK version 4.12.1.

Version 4.12.0.0

  • Verified compatibility with Unity Ads SDK 4.12.0.

Built and tested with:

  • Google Mobile Ads SDK version 11.5.0.
  • Unity Ads SDK version 4.12.0.

Version 4.11.3.1

  • Added bidding support for banner, interstitial and rewarded ad formats.

Built and tested with:

  • Google Mobile Ads SDK version 11.5.0.
  • Unity Ads SDK version 4.11.3.

Version 4.11.3.0

  • Verified compatibility with Unity Ads SDK 4.11.3.

Built and tested with:

  • Google Mobile Ads SDK version 11.4.0.
  • Unity Ads SDK version 4.11.3.

Version 4.11.2.0

  • Verified compatibility with Unity Ads SDK 4.11.2.

Built and tested with:

  • Google Mobile Ads SDK version 11.4.0.
  • Unity Ads SDK version 4.11.2.

Version 4.10.0.0

  • Verified compatibility with Unity Ads SDK 4.10.0.

Built and tested with:

  • Google Mobile Ads SDK version 11.2.0.
  • Unity Ads SDK version 4.10.0.

Version 4.9.3.0

  • Verified compatibility with Unity Ads SDK 4.9.3.
  • Now requires minimum iOS version 12.0.
  • Now requires Google Mobile Ads SDK version 11.0 or higher.
  • Included Info.plist in the frameworks within UnityAdapter.xcframework.

Built and tested with:

  • Google Mobile Ads SDK version 11.0.1.
  • Unity Ads SDK version 4.9.3.

Version 4.9.2.0

  • Verified compatibility with Unity Ads SDK 4.9.2.

Built and tested with:

  • Google Mobile Ads SDK version 10.13.0.
  • Unity Ads SDK version 4.9.2.

Version 4.9.1.0

  • Verified compatibility with Unity Ads SDK 4.9.1.

Built and tested with:

  • Google Mobile Ads SDK version 10.12.0.
  • Unity Ads SDK version 4.9.1.

Version 4.9.0.0

  • Removed GADMAdNetworkAdapter conformance and dependency from the Unity adapter.
  • Added report impression method invocation in unityAdsShowStart delegate method.
  • Verified compatibility with Unity Ads SDK 4.9.0.

Built and tested with:

  • Google Mobile Ads SDK version 10.12.0.
  • Unity Ads SDK version 4.9.0.

Version 4.8.0.0

  • Added support for impression events for banner ads.
  • Verified compatibility with Unity Ads SDK 4.8.0.

Built and tested with:

  • Google Mobile Ads SDK version 10.7.0.
  • Unity Ads SDK version 4.8.0.

Version 4.7.1.0

  • Verified compatibility with Unity Ads SDK 4.7.1.

Built and tested with:

  • Google Mobile Ads SDK version 10.5.0.
  • Unity Ads SDK version 4.7.1.

Version 4.7.0.0

  • Verified compatibility with Unity Ads SDK 4.7.0.
  • Now requires minimum iOS version 11.0.
  • Now requires Google Mobile Ads SDK version 10.4.0 or higher.

Built and tested with:

  • Google Mobile Ads SDK version 10.4.0.
  • Unity Ads SDK version 4.7.0.

Version 4.6.1.0

  • Verified compatibility with Unity Ads SDK 4.6.1.

Built and tested with:

  • Google Mobile Ads SDK version 10.2.0.
  • Unity Ads SDK version 4.6.1.

Version 4.6.0.0

  • Verified compatibility with Unity Ads SDK 4.6.0.
  • Added support for forwarding COPPA information to the Unity Ads SDK.
  • Removed support for the armv7 architecture.
  • Now requires Google Mobile Ads SDK version 10.0.0 or higher.

Built and tested with:

  • Google Mobile Ads SDK version 10.2.0.
  • Unity Ads SDK version 4.6.0.

Version 4.5.0.0

  • Verified compatibility with Unity Ads SDK 4.5.0.

Built and tested with:

  • Google Mobile Ads SDK version 9.14.0.
  • Unity Ads SDK version 4.5.0.

Version 4.4.1.0

  • Verified compatibility with Unity Ads SDK 4.4.1.

Built and tested with:

  • Google Mobile Ads SDK version 9.11.0.
  • Unity Ads SDK version 4.4.1.

Version 4.4.0.0

  • Updated the adapter to use the didRewardUser API.
  • Now requires Google Mobile Ads SDK version 9.8.0 or higher.
  • Verified compatibility with Unity Ads SDK 4.4.0.

Built and tested with:

  • Google Mobile Ads SDK version 9.10.0.
  • Unity Ads SDK version 4.4.0.

Version 4.3.0.0

  • Verified compatibility with Unity Ads SDK 4.3.0.

Built and tested with:

  • Google Mobile Ads SDK version 9.8.0.
  • Unity Ads SDK version 4.3.0.

Version 4.2.1.0

  • Verified compatibility with Unity Ads SDK 4.2.1.

Built and tested with:

  • Google Mobile Ads SDK version 9.4.0.
  • Unity Ads SDK version 4.2.1.

Version 4.1.0.0

  • Verified compatibility with Unity Ads SDK 4.1.0.

Built and tested with:

  • Google Mobile Ads SDK version 9.2.0.
  • Unity Ads SDK version 4.1.0.

Version 4.0.1.0

  • Verified compatibility with Unity Ads SDK 4.0.1.

Built and tested with:

  • Google Mobile Ads SDK version 9.0.0.
  • Unity Ads SDK version 4.0.1.

Version 4.0.0.2

  • Added support for the arm64 simulator architecture.

Built and tested with:

  • Google Mobile Ads SDK version 9.0.0.
  • Unity Ads SDK version 4.0.0.

Version 4.0.0.1

  • Verified compatibility with Google Mobile Ads SDK version 9.0.0.
  • Now requires Google Mobile Ads SDK version 9.0.0 or higher.

Built and tested with:

  • Google Mobile Ads SDK version 9.0.0.
  • Unity Ads SDK version 4.0.0.

Version 4.0.0.0

  • Verified compatibility with Unity Ads SDK 4.0.0.
  • Now requires minimum iOS version 10.0.

Built and tested with

  • Google Mobile Ads SDK version 8.13.0.
  • Unity Ads SDK version 4.0.0.

Version 3.7.5.0

  • Verified compatibility with Unity Ads SDK 3.7.5.

Built and tested with

  • Google Mobile Ads SDK version 8.8.0.
  • Unity Ads SDK version 3.7.5.

Version 3.7.4.0

  • Verified compatibility with Unity Ads SDK 3.7.4.

Built and tested with

  • Google Mobile Ads SDK version 8.7.0.
  • Unity Ads SDK version 3.7.4.

Version 3.7.2.0

  • Verified compatibility with Unity Ads SDK 3.7.2.
  • Relaxed dependency to Google Mobile Ads SDK version 8.0.0 or higher.

Built and tested with

  • Google Mobile Ads SDK version 8.5.0.
  • Unity Ads SDK version 3.7.2.

Version 3.7.1.0

  • Verified compatibility with Unity Ads SDK 3.7.1.
  • Now requires Google Mobile Ads SDK version 8.4.0 or higher.

Built and tested with

  • Google Mobile Ads SDK version 8.4.0.
  • Unity Ads SDK version 3.7.1.

Version 3.6.2.0

  • Updated the adapter to use the .xcframework format.
  • Verified compatibility with Unity Ads SDK 3.6.2.
  • Now requires Google Mobile Ads SDK version 8.2.0 or higher.

Built and tested with

  • Google Mobile Ads SDK version 8.2.0.
  • Unity Ads SDK version 3.6.2.

Version 3.6.0.0

  • Verified compatibility with Unity Ads SDK 3.6.0.
  • Now requires Google Mobile Ads SDK version 7.69.0 or higher.

Built and tested with

  • Google Mobile Ads SDK version 7.69.0.
  • Unity Ads SDK version 3.6.0.

Version 3.5.1.1

  • Fixed a crash that sometimes occurred when the Unity Ads SDK finished initializing.

Built and tested with

  • Google Mobile Ads SDK version 7.68.0.
  • Unity Ads SDK version 3.5.1.

Version 3.5.1.0

  • Verified compatibility with Unity Ads SDK 3.5.1.

Built and tested with

  • Google Mobile Ads SDK version 7.68.0.
  • Unity Ads SDK version 3.5.1.

Version 3.5.0.0

  • Verified compatibility with Unity Ads SDK 3.5.0.
  • Added support for Adaptive Banner ads.
  • Now requires Google Mobile Ads SDK version 7.68.0 or higher.

Built and tested with

  • Google Mobile Ads SDK version 7.68.0.
  • Unity Ads SDK version 3.5.0.

Version 3.4.8.0

  • Verified compatibility with Unity Ads SDK 3.4.8.
  • Now requires Google Mobile Ads SDK version 7.63.0 or higher.

Built and tested with

  • Google Mobile Ads SDK version 7.63.0.
  • Unity Ads SDK version 3.4.8.

Version 3.4.6.0

  • Verified compatibility with Unity Ads SDK 3.4.6.
  • Now requires Google Mobile Ads SDK version 7.60.0 or higher.

Built and tested with

  • Google Mobile Ads SDK version 7.60.0.
  • Unity Ads SDK version 3.4.6.

Version 3.4.2.2

  • Added standardized adapter error codes and messages.
  • Updated the minimum required Google Mobile Ads SDK version to 7.59.0.

Built and tested with

  • Google Mobile Ads SDK version 7.59.0.
  • Unity Ads SDK version 3.4.2.

Version 3.4.2.1

  • Improved forwarding of Unity's errors to recognize initialization and ad load failures earlier and reduce timeouts.
  • Removed support for the i386 architecture.

Built and tested with

  • Google Mobile Ads SDK version 7.57.0.
  • Unity Ads SDK version 3.4.2.

Version 3.4.2.0

  • Verified compatibility with Unity Ads SDK 3.4.2.

Built and tested with

  • Google Mobile Ads SDK version 7.55.1.
  • Unity Ads SDK version 3.4.2.

Version 3.4.0.0

  • Verified compatibility with Unity Ads SDK 3.4.0.
  • Now supports loading multiple banner ads at once.

Built and tested with

  • Google Mobile Ads SDK version 7.53.0.
  • Unity Ads SDK version 3.4.0.

Version 3.3.0.0

  • Verified compatibility with Unity Ads SDK 3.3.0.
  • Now supports loading multiple banner ads at once.

Built and tested with

  • Google Mobile Ads SDK version 7.51.0.
  • Unity Ads SDK version 3.3.0.

Version 3.2.0.1

  • Verified compatibility with Unity Ads SDK 3.2.0.
  • Now requires Google Mobile Ads SDK version 7.46.0 or higher.
  • Fixed an issue where Unity Banner ads would fail to show when loaded.
  • Fixed an issue where the adapter was not properly forwarding the unityAdsReady callback.

Version 3.2.0.0

  • Release was removed due to a regression on no-fill reporting.

Version 3.1.0.0

  • Verified compatibility with Unity Ads SDK 3.1.0.

Version 3.0.3.0

  • Verified compatibility with Unity Ads SDK 3.0.3.
  • Now requires Google Mobile Ads SDK version 7.42.2 or higher.
  • Added support for flexible banner ad sizes.
  • Fixed an issue where Unity Banner ads would only successfully load once per session.

Version 3.0.1.0

  • Verified compatibility with Unity Ads SDK 3.0.1.
  • Fixed a crash that occurred when deallocating rewarded ads.

Version 3.0.0.3

  • Updating adapter to use new rewarded API.
  • Now requires Google Mobile Ads SDK version 7.41.0 or higher.

Version 3.0.0.2

  • Added support for banner ads.

Version 3.0.0.1

  • Fixed an issue where the adapter stores the 'placementId' of previous request.

Version 3.0.0.0

  • Verified compatibility with Unity Ads SDK 3.0.0.

Version 2.3.0.0

  • Verified compatibility with Unity Ads SDK 2.3.0.

Version 2.2.1.1

  • Added adapterDidCompletePlayingRewardBasedVideoAd: callback to the adapter.

Version 2.2.1.0

  • Verified compatibility with Unity Ads SDK 2.2.1.

Version 2.2.0.0

  • Verified compatibility with Unity Ads SDK 2.2.0.

Version 2.1.2.0

  • Verified compatibility with Unity Ads SDK 2.1.2.
  • Removed the support for 'armv7s' architecture.

Version 2.1.1.0

  • Verified compatibility with Unity Ads SDK 2.1.1.

Version 2.1.0.0

  • Updated the adapter to make it compatible with Unity Ads SDK 2.1.0.

Version 2.0.8.0

  • Verified compatibility with Unity Ads SDK 2.0.8.

Version 2.0.7.0

  • Adapter now tracks Unity Ads clicks so the AdMob and the Unity Ads click statistics can match up.
  • Apps now get interstitialWillLeaveApplication: and rewardBasedVideoAdWillLeaveApplication: callbacks.

Version 2.0.6.0

  • Verified compatibility with Unity Ads SDK 2.0.6.

Version 2.0.5.0

  • Verified compatibility with Unity Ads SDK 2.0.5.

Version 2.0.4.0

  • Changed the version naming system to [Unity Ads SDK version].[adapter patch version].
  • Updated the minimum required Unity Ads SDK to v2.0.4.
  • Updated the minimum required Google Mobile Ads SDK to v7.10.1.

Version 1.0.2

  • Made the user reward item's key non nil. The reward key will always be an empty or a valid string.

Version 1.0.1

  • Fixed bug where the rewardBasedVideoAdDidOpen: callback wasn’t getting called.

Version 1.0.0

  • Supports interstitial and reward-based video ads.