測試廣告單元
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
廣告檢查器支援下列測試:
- 實際情境測試:載入應用程式廣告單元的廣告。您可以開啟廣告檢查器,查看廣告單元發出的請求詳細資料。
- 非實際情境測試:直接在廣告檢查器中測試廣告單元,不必操作應用程式的使用者介面。您可以一次測試多個廣告單元、非同步載入及查看測試廣告請求,並執行單一廣告來源測試。
執行非實際情境測試時,請求不會包含在應用程式 UI 中執行的參數,包括兒童導向內容設定、自訂指定目標、聯播網額外資訊和不同廣告尺寸。由於這些請求具有限制,建議您在應用程式的 UI 使用實際情境測試。
必要條件
繼續操作前,請先完成下列事項:
- 完成初始「必要條件」列出的所有項目:建立 Ad Manager 帳戶、設定測試裝置、初始化 Google Mobile Ads SDK,以及安裝最新版本。
- 啟用廣告檢查器。
要求測試廣告
雖然廣告單元可能支援多種廣告格式,但廣告檢查器無法選取要測試的格式,且會預設為最後請求的格式。
如要在廣告檢查器要求測試廣告,請完成下列步驟。詳情請參閱「廣告檢查器 (Beta 版)」。
實際情境測試:
- 在測試裝置上前往應用程式的 UI,然後載入廣告。
- 開啟廣告檢查器。在「廣告單元」分頁中,找出您載入廣告的廣告單元。
- 在「SDK 請求記錄」中,查看所請求測試廣告的詳細資料。
非實際情境測試:
- 在「廣告單元」分頁,輕觸廣告單元,然後按一下「請求測試廣告」。
- 在「SDK 請求記錄」中,查看所請求測試廣告的詳細資料。

如果廣告單元格式顯示「不明」,「請求測試廣告」會顯示為灰色。如果為單一廣告單元請求多種格式,廣告檢查器會使用最後一個廣告單元。
測試單一廣告來源
廣告檢查器可限制應用程式中的廣告請求,只放送來自單一出價或刊登序列廣告來源的廣告。這個做法可確認已正確整合第三方轉接程式,且廣告來源正常放送。
如要測試單一廣告來源,請完成下列步驟:
在「廣告檢查器」中,按一下「單一廣告來源測試」切換鈕。系統會顯示「單一廣告來源測試」對話方塊:

選取要測試的廣告來源。接著您會收到「強制重新啟動應用程式」頁面:

單一廣告來源測試設定會套用至您日後提出的所有廣告請求。
這項測試不適用於該工作階段先前快取的廣告。
建議您在套用單一廣告來源測試時,強制重新啟動應用程式。這種做法會使可能顯示的快取廣告失效,並確保所選廣告來源會收到請求。
重新啟動應用程式後,所有廣告單元刊登位置都會嘗試顯示所選廣告來源的廣告。如果單一廣告來源測試正在執行,啟動廣告檢查器時會顯示測試中的廣告來源:

在單一廣告來源測試模式中,無論所選廣告來源是否設為出價或刊登序列,所有廣告請求都會嘗試透過該廣告來源供應廣告。如果受測的廣告來源未對廣告單元設定出價或刊登序列,您會收到下列錯誤訊息:
Ad Unit has no applicable adapter for single ad source testing on network: AD_SOURCE_ADAPTER_CLASS_NAME
如要確認廣告來源是否在您開始單一廣告來源測試後,按照廣告請求供應廣告,請輕觸廣告單元查看 SDK 請求記錄。如果廣告來源無法載入廣告,系統會顯示錯誤訊息並說明錯誤原因,例如 Adapter failed to initialize
。
如果您已在刊登序列中加入所選廣告來源的多個例項,系統會顯示該廣告來源的各個呼叫例項。這個程序會持續顯示,直到廣告供應完成,或刊登序列未供應廣告就結束為止。
停止單一廣告來源測試
如要停止測試,請完成下列步驟:
- 在「廣告檢查器」中,關閉「單一廣告來源測試」切換鈕。系統會顯示「停止單一廣告來源測試?」對話方塊。
輕觸「停止測試」。

如果成功,「強制重新啟動應用程式」上方會顯示確認訊息:

如要撤銷測試廣告來源的快取廣告,建議您在停止測試後強制重新啟動應用程式。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-25 (世界標準時間)。
[null,null,["上次更新時間:2025-08-25 (世界標準時間)。"],[],[],null,["Select platform: [Android](/ad-manager/mobile-ads-sdk/android/ad-inspector/test-ad-units \"View this page for the Android platform docs.\") [iOS](/ad-manager/mobile-ads-sdk/ios/ad-inspector/test-ad-units \"View this page for the iOS platform docs.\") [Unity](/ad-manager/mobile-ads-sdk/unity/ad-inspector/test-ad-units \"View this page for the Unity platform docs.\") [Flutter](/ad-manager/mobile-ads-sdk/flutter/ad-inspector/test-ad-units \"View this page for the Flutter platform docs.\")\n\n\u003cbr /\u003e\n\nAd inspector supports the following tests:\n\n- **In-context testing**: load ads from the ad units in your app. You can open ad inspector to view details on requests made from ad units.\n- **Out-of-context testing**: test your ad unit directly in ad inspector without navigating to your app's UI. You can test multiple ad units at once, asynchronously load and view your test ad requests, and perform single ad source tests.\n\nWhen running an out-of-context test, your requests don't carry the parameters\nto run in your app's UI, including child-directed treatment configuration,\ncustom targeting, network extras, and different sizes. Due to the limitation of\nthese requests, we recommend you use in-context testing in your app's UI.\n\nPrerequisites\n\nBefore you continue, do the following:\n\n- Complete all items in the initial [Prerequisites](/ad-manager/mobile-ads-sdk/android/ad-inspector#prerequisites) to create an Ad Manager account, set your test device, initialize Google Mobile Ads SDK, and install the latest version.\n- [Launch ad inspector](/ad-manager/mobile-ads-sdk/android/ad-inspector/launch-ad-inspector).\n\nRequest a test ad\n\nThough your ad unit might support multiple ad formats, ad inspector doesn't let\nyou select which format to test, and defaults to the last requested format.\n\nTo request a test ad in ad inspector, complete the following steps. For more\ndetails, see\n\n[Ad inspector (Beta)](//support.google.com/admanager/answer/7180401#ad-inspector).\n\n\n- **In-context**:\n\n 1. On a test device, navigate to your app's UI and load an ad.\n 2. Open ad inspector. In the **Ad unit** tab, find the ad unit where you loaded the ad.\n 3. In **SDK request log**, view details on your requested test ad.\n- **Out-of-context**:\n\n 1. In the **Ad unit** tab, tap on your ad unit and click **Request test ad**.\n 2. In **SDK request log**, view details on your requested test ad.\n\n| **Note:** To request a test ad, [initialize the Google Mobile Ads SDK](/ad-manager/mobile-ads-sdk/android/quick-start#initialize_the_mobile_ads_sdk) with an `Activity` context.\n\nIf the ad unit format shows **Unknown** , you see **Request test ad** greyed\nout. If you request multiple formats for\na single ad unit, ad inspector uses the last ad unit.\n\n\nTest a single ad source\n\nAd inspector can restrict ad requests in your app to serve ads from a single\nbidding or waterfall ad source. This approach lets you verify that you've\ncorrectly integrated with the third-party adapter, and the ad source serves\nas expected.\n\nTo test a single ad source, complete the following steps:\n\n1. In **Ad inspector** , click the **Single ad source test** toggle. A\n **Single ad source test** dialog appears:\n\n \u003cbr /\u003e\n\n\n2. Select an ad source to test. Afterwards, you receive the\n **Force restart app** page:\n\nThe single ad source test setting applies to any future ad requests you make.\nThis test doesn't apply to previously cached ads in that session.\nWe recommend you to force restarting your app when applying a single ad source\ntest. This approach invalidates cached ads that might display instead of\nyour chosen ad source receiving a request.\n\nAfter restarting your app, all ad unit placements attempt to show an ad from the\nselected ad source. Launching ad inspector when a single ad source test is\nactive shows the active test ad source:\n\nIn single ad source test mode, all ad requests attempt to fill with the\nselected ad source, regardless of whether that ad source was configured for\nbidding or waterfall. If the ad source you're testing is not set up for bidding\nor waterfall for the ad unit, you receive the following error message: \n\n Ad Unit has no applicable adapter for single ad source testing on network: \u003cvar translate=\"no\"\u003eAD_SOURCE_ADAPTER_CLASS_NAME\u003c/var\u003e\n\nTo verify whether the ad source filled the ad requests after you start a single\nad source test, tap an ad unit to view the SDK request log. If the ad source\nfailed to load an ad, an error message appears describing the error, such\nas `Adapter failed to initialize`.\n\nIf you've added multiple instances of the selected ad source to a waterfall, you\nsee each call instance to the ad source. This process renders until the ad is\neither filled or the waterfall ends without a fill.\n\nStop a single ad source test\n\nTo stop the test, complete the following steps:\n\n1. In **Ad inspector** , click off the **Single ad source test** toggle. The **Stop single ad source test?** dialog appears.\n2. Tap **Stop test**.\n\n\n If successful, a confirmation message appears over **Force restart app**:\n\nTo revoke cached ads for the tested ad source, we recommend you to force\nrestart the app after stopping the test."]]