קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
תהליך בחירת הרשת ב-AdMob הוא תכונה שמאפשרת לכם להציג מודעות באפליקציות מכמה מקורות, כולל רשת AdMob ומקורות מודעות של צד שלישי, במקום אחד. תהליך בחירת הרשת ב-AdMob עוזר להשיג קצב מילוי מקסימלי ולהגדיל את המונטיזציה על-ידי שליחת בקשות להצגת מודעה אל רשתות מרובות. כך מובטח שתימצא הרשת הזמינה הטובה ביותר לפרסום מודעות.
מקרה לדוגמה.
דרישות מוקדמות
כדי לשלב גישור לפורמט מודעה מסוים, צריך לשלב את פורמט המודעה הזה באפליקציה:
במדריך לתחילת העבודה מוסבר איך להפעיל את Google Mobile Ads SDK.
במהלך קריאת האתחול הזו, מתבצע גם אתחול של מתאמי גישור. חשוב להמתין עד שהאתחול יסתיים לפני שאתם טוענים מודעות, כדי לוודא שכל רשת מודעות משתתפת באופן מלא בבקשה הראשונה להצגת מודעה.
בדוגמת הקוד הבאה אפשר לראות איך בודקים את סטטוס האתחול של כל מתאם לפני שליחת בקשה להצגת מודעה.
Java
publicvoidinitialize(Contextcontext){newThread(()->
// Initialize the Google Mobile Ads SDK on a background thread.MobileAds.initialize(context,this::logAdapterStatus)).start();}privatevoidlogAdapterStatus(InitializationStatusinitializationStatus){// Check each adapter's initialization status.Map<String,AdapterStatus>statusMap=initializationStatus.getAdapterStatusMap();for(Map.Entry<String,AdapterStatus>entry:statusMap.entrySet()){StringadapterClass=entry.getKey();AdapterStatusstatus=entry.getValue();Log.d(TAG,String.format("Adapter name: %s, Description: %s, Latency: %d",adapterClass,status.getDescription(),status.getLatency()));}}
funinitialize(context:Context){CoroutineScope(Dispatchers.IO).launch{// Initialize the Google Mobile Ads SDK on a background thread.MobileAds.initialize(context,::logAdapterStatus)}}privatefunlogAdapterStatus(initializationStatus:InitializationStatus){// Check each adapter's initialization status.for((adapterClass,status)ininitializationStatus.adapterStatusMap){Log.d(TAG,"Adapter: $adapterClass, Status: ${status.description}, Latency: ${status.latency}ms",)}}
בדיקה של המחלקה של המתאם של רשת המודעות שטענה את המודעה
הנה קוד לדוגמה שמתעד את שם המחלקה של רשת המודעות עבור מודעת באנר:
Java
ResponseInforesponseInfo=ad.getResponseInfo();StringadapterClassName=null;if(responseInfo!=null){adapterClassName=responseInfo.getMediationAdapterClassName();}Log.d(TAG,"Adapter class name: "+adapterClassName);
פרטים על השיטה הזו מופיעים בResponseInfoמסמכי התיעוד בנושא getMediationAdapterClassName().
הפעלת אובייקט המודעה באמצעות מופע של Activity
בבונה של אובייקט מודעה חדש (לדוגמה, AdView),
צריך להעביר אובייקט מסוג Context.
הערך Context מועבר לרשתות מודעות אחרות כשמשתמשים בתהליך בחירת הרשת (Mediation). חלק מרשתות המודעות דורשות Context מגביל יותר, מסוג Activity, ויכול להיות שלא יוכלו להציג מודעות ללא מופע של Activity. לכן, מומלץ להעביר מופע של Activity כשמפעילים אובייקטים של מודעות
כדי לוודא שחוויית השימוש ברשתות המודעות המגשרות עקבית.
שימוש במודעות באנר עם תהליך בחירת הרשת (Mediation) ב-AdMob
חשוב להשבית את הרענון בכל ממשקי המשתמש של מקורות מודעות מצד שלישי עבור יחידות של מודעות באנר שמשמשות לבחירת רשת ב-AdMob. השיטה הזו מונעת רענון כפול, כי מערכת AdMob מפעילה רענון גם על סמך קצב הרענון של היחידה עם מודעת הבאנר.
שימוש במודעות מותאמות עם תהליך בחירת הרשת (Mediation) ב-AdMob
ריכזנו כאן כמה שיטות מומלצות שכדאי להביא בחשבון כשמטמיעים מודעות מותאמות בתהליך בחירת הרשת (Mediation) ב-AdMob.
המדיניות בנושא הצגה של מודעות מותאמות
לכל רשת מודעות יש מדיניות משלה. כשמשתמשים בתהליך בחירת רשת, חשוב לזכור שהאפליקציה עדיין צריכה לפעול בהתאם למדיניות של הרשת שסיפקה את המודעה.
במקום loadAds(), צריך להשתמש ב-loadAd()
השיטה loadAds() מציגה רק מודעות Google. למודעות בתיווך, צריך להשתמש ב-loadAd() במקום.
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-09-06 (שעון UTC)."],[[["\u003cp\u003eAdMob Mediation lets you maximize ad revenue by serving ads from multiple ad networks, including AdMob and third-party sources, all in one place.\u003c/p\u003e\n"],["\u003cp\u003eBefore integrating mediation, ensure you have the necessary account permissions and integrate the desired ad format (banner, interstitial, native, rewarded, or rewarded interstitial) into your app.\u003c/p\u003e\n"],["\u003cp\u003eIt is crucial to initialize the Mobile Ads SDK and wait for initialization to complete before loading ads to ensure all ad networks participate in the first ad request.\u003c/p\u003e\n"],["\u003cp\u003eWhen using AdMob Mediation, remember to disable refresh in third-party ad source UIs for banner ads to prevent double refreshing and adhere to each ad network's policies for native ad presentation.\u003c/p\u003e\n"],["\u003cp\u003eTo comply with privacy regulations like GDPR or US state privacy laws, add your mediation partners to the AdMob Privacy & Messaging settings to avoid ad serving disruptions.\u003c/p\u003e\n"]]],["AdMob Mediation serves ads from multiple sources, maximizing fill rates. Before configuring, verify account permissions and integrate desired ad formats (banner, interstitial, native, rewarded). Initialize the Mobile Ads SDK and wait for adapter initialization completion. Pass an `Activity` instance when creating ad objects. Disable refresh in third-party ad sources for banner units and utilize `loadAd()` for mediated native ads. Comply with U.S. states privacy laws and GDPR by adding mediation partners in AdMob's Privacy & messaging settings.\n"],null,["AdMob Mediation is a feature lets you serve ads to your apps from\nmultiple sources, including the AdMob Network and third-party ad sources, in\none place. AdMob Mediation helps maximize your fill rate and increase your\nmonetization by sending ad requests to multiple networks to verify you find the\nbest available network to serve ads.\n[Case study](//admob.google.com/home/resources/cookapps-grows-ad-revenue-86-times-with-admob-rewarded-ads-and-mediation/).\n\n\nPrerequisites **Important:** Verify that you have the necessary account permissions to complete the mediation configuration. These permissions include access to inventory management, app access, and privacy and messaging features. See [Manage user access to your\n| account](//support.google.com/admob/answer/2784628) for details.\n\nBefore you can integrate mediation for an ad format, you need to integrate that\nad format into your app:\n\n- [Banner Ads](/admob/android/banner)\n- [Interstitial Ads](/admob/android/interstitial)\n- [Native Ads](/admob/android/native)\n- [Rewarded Ads](/admob/android/rewarded)\n- [Rewarded Interstitial\n Ads](/admob/android/rewarded-interstitial)\n\nNew to mediation? Read\n\n[Overview of AdMob Mediation](//support.google.com/admob/answer/3063564).\n\nFor bidding:\n\nGoogle Mobile Ads SDK 18.3.0\nor higher.\n\nInitialize Google Mobile Ads SDK\n\nThe quick start guide shows you how to [initialize the Google Mobile Ads SDK](/admob/android/quick-start#initialize_the_mobile_ads_sdk).\nDuring that initialization call, mediation adapters also\nget initialized. It is important to wait for initialization to complete before\nyou load ads in order to verify full participation from every ad network on the\nfirst ad request.\n| **Important:** Bidding adapters require you to explicitly initialize Google Mobile Ads SDK.\n\nThe following sample code shows how you can check each adapter's initialization\nstatus prior to making an ad request. \n\nJava \n\n public void initialize(Context context) {\n new Thread(\n () -\u003e\n // Initialize the Google Mobile Ads SDK on a background thread.\n MobileAds.initialize(context, this::logAdapterStatus))\n .start();\n }\n\n private void logAdapterStatus(InitializationStatus initializationStatus) {\n // Check each adapter's initialization status.\n Map\u003cString, AdapterStatus\u003e statusMap = initializationStatus.getAdapterStatusMap();\n for (Map.Entry\u003cString, AdapterStatus\u003e entry : statusMap.entrySet()) {\n String adapterClass = entry.getKey();\n AdapterStatus status = entry.getValue();\n Log.d(\n TAG,\n String.format(\n \"Adapter name: %s, Description: %s, Latency: %d\",\n adapterClass, status.getDescription(), status.getLatency()));\n }\n } \n https://github.com/googleads/googleads-mobile-android-examples/blob/ccc290a583d7f552bdcf81ea76adc05beaa43f0b/java/advanced/APIDemo/app/src/main/java/com/google/android/gms/snippets/MediationSnippets.java#L30-L50\n\nKotlin \n\n fun initialize(context: Context) {\n CoroutineScope(Dispatchers.IO).launch {\n // Initialize the Google Mobile Ads SDK on a background thread.\n MobileAds.initialize(context, ::logAdapterStatus)\n }\n }\n\n private fun logAdapterStatus(initializationStatus: InitializationStatus) {\n // Check each adapter's initialization status.\n for ((adapterClass, status) in initializationStatus.adapterStatusMap) {\n Log.d(\n TAG,\n \"Adapter: $adapterClass, Status: ${status.description}, Latency: ${status.latency}ms\",\n )\n }\n } \n https://github.com/googleads/googleads-mobile-android-examples/blob/ccc290a583d7f552bdcf81ea76adc05beaa43f0b/kotlin/advanced/APIDemo/app/src/main/java/com/google/android/gms/snippets/MediationSnippets.kt#L25-L41\n\nCheck which ad network adapter class loaded the ad\n\nHere is some sample code that logs the ad network class name for a banner ad: \n\nJava \n\n ResponseInfo responseInfo = ad.getResponseInfo();\n String adapterClassName = null;\n if (responseInfo != null) {\n adapterClassName = responseInfo.getMediationAdapterClassName();\n }\n Log.d(TAG, \"Adapter class name: \" + adapterClassName); \n https://github.com/googleads/googleads-mobile-android-examples/blob/ccc290a583d7f552bdcf81ea76adc05beaa43f0b/java/advanced/APIDemo/app/src/main/java/com/google/android/gms/snippets/ResponseInfoSnippets.java#L46-L51\n\nKotlin \n\n Log.d(TAG, \"Adapter class name:\" + ad.responseInfo?.mediationAdapterClassName) \n https://github.com/googleads/googleads-mobile-android-examples/blob/ccc290a583d7f552bdcf81ea76adc05beaa43f0b/kotlin/advanced/APIDemo/app/src/main/java/com/google/android/gms/snippets/ResponseInfoSnippets.kt#L42-L42\n\nRefer to the `ResponseInfo` documentation on `getMediationAdapterClassName()`\nfor details about this method.\n\nInitialize your ad object with an Activity instance\n\nIn the constructor for a new ad object (for example,\n\n[`AdView`](/admob/android/reference/com/google/android/gms/ads/AdView)),\n\nyou must pass in an object of type\n[`Context`](//developer.android.com/reference/android/content/Context.html).\nThis `Context` is passed on to other ad networks when using mediation. Some\nad networks require a more restrictive `Context` that is of type\n[`Activity`](//developer.android.com/reference/android/app/Activity.html)\nand may not be able to serve ads without an `Activity` instance. Therefore,\nwe recommend passing in an `Activity` instance when initializing ad objects\nto verify a consistent experience with your mediated ad networks.\n\n\u003cbr /\u003e\n\nUse banner ads with AdMob Mediation\n\nMake sure to disable refresh in all third-party ad source UIs for banner ad\nunits used in AdMob Mediation. This prevents a double refresh since\nAdMob also triggers a refresh based on your banner ad unit's\nrefresh rate.\n\nUse native ads with AdMob Mediation\n\nThe following are some best practices to consider when implementing native ads\nin AdMob Mediation.\n\nNative ad presentation policy\n: Each ad network has its own policies. When using mediation, it's important to\n remember that your app still needs to abide by the policies of the mediated\n network that provided the ad.\n\nUse `loadAd()` instead of `loadAds()`\n: The `loadAds()` method serves only Google ads. For mediated ads, use\n `loadAd()` instead.\n\nUS states privacy laws and GDPR\n\nIf you need to comply with the [U.S. states privacy\nlaws](//support.google.com/admob/answer/9561022) or [General Data Protection\nRegulation (GDPR)](//support.google.com/admob/answer/7666366), follow the\nsteps in [US state regulations\nsettings](//support.google.com/admob/answer/10860309) or [GDPR\nsettings](//support.google.com/admob/answer/10113004#adding_ad_partners_to_published_gdpr_messages) to add your\nmediation partners in AdMob Privacy \\& messaging's\nUS states or GDPR ad partners list. Failure to do so can lead to partners\nfailing to serve ads on your app.\n\nLearn more about enabling [restricted data processing\n(RDP)](/admob/android/privacy/us-states) and obtaining GDPR consent with the\n[Google User Messaging Platform (UMP) SDK](/admob/android/privacy)."]]