Google 互動式媒體廣告 SDK 常見問題
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
- 為什麼我無法取回所有格式的廣告?
-
測試廣告代碼的設定是一律針對有效請求傳回廣告。這麼做是為了方便整合,並讓您更輕鬆測試玩家如何要求及顯示廣告。不過,廣告不一定適用於網站、帳戶或廣告單元的所有格式。如果整合作業適用於測試代碼,但不適用於您自己的代碼,原因可能是下列任一項:
- 您在環境中放送的影片格式不受支援。例如,您只向 iOS 或 Android 放送 HTML5 廣告。
- 如果您使用 Ad Manager,您的發布商 ID 目前可能沒有任何指定廣告。此外,請確認您已在 Ad Manager 中核准相關廣告和廣告素材。
- 如果您使用 AdSense,網站或測試網頁的指定條件可能沒有任何有效的廣告。最常見的原因是
私人且未檢索的網站。
- 如果您使用 Ad Exchange 聯播網夥伴管理功能,但未設定
descriptionURL
,或該網域不在自有或經營的網域管理清單中,系統就不會放送廣告。
- 查看 Ad Exchange 影片廣告中定義的「最低千次曝光出價」門檻。minCPM千次曝光出價偏高可能導致供應率偏低。如要修正這個問題,請嘗試從廣告請求 (即 slotname) 中移除 minCPM 或廣告單元參數,以驗證這是否會影響供應率。
- 理想的
descriptionUrl
長什麼樣?
-
為達到最佳成效,
descriptionUrl
所指向的網頁內容不應是字詞或詞組的集合,而應是 1 到 3 段實際描述內容,以及您在提供內容時所扮演的角色。我們過去已將其成功
根據預先定義區塊動態建立「descriptionUrl
」網頁內容。
例如,這是幾個用來描述內容的句子、幾個用來說明
而是一些預先定義的摘要
AdSense 頻道 (例如「娛樂」或「運動」)。因此,每部內容都會與一組相當獨特的 descriptionUrl
相關聯,提供一般資訊 (例如類型描述符) 和特定資訊 (直接關於內容的內容)。這個中繼資料 HTML 應該要很簡潔,例如:
<html>
<head>
<title>Domain.com - Your tag line here!</title>
</head>
<body>
<h1>Descriptions</h1>
<h2>About this Content</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. ...</p>
<h2>About Domain.com</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. ...</p>
</body>
</html>
- 為什麼我會收到「廣告回應不含有效的廣告類型」錯誤訊息?
- 這個錯誤通常出現,因為您並未將任何廣告指定至
特定
publisherId
(在指定時間範圍內)。這項條件可能會在一天或數天內因廣告活動的開始和結束而變動。請檢查要指定的廣告尚未過期
廣告指定條件正確無誤。
只要廣告能正確使用測試 publisherId
進行要求、接收及算繪,您就可以確保在廣告可用時,系統會使用您的實際 publisherId
正確處理這些廣告。
- 您是否有 Ad Manager 影片廣告代碼,可供我用於測試?
- 您可以在「範例代碼」頁面中找到範例代碼。
- 我應該將
adSlotWidth
和 adSlotHeight
設為相同的值
做為 Ad Manager 廣告代碼中的 sz
嗎?
- 不一定。
adSlotWidth
和 adSlotHeight
必須設為播放器的寬度/高度,或您希望廣告填入的區域。AdSense 會使用這些資訊,判斷哪些廣告可放入該空間。Ad Manager 廣告代碼中的 sz
鍵/值組合為
指定目標參數,不一定會影響放送的廣告素材
(詳情請見下文)。
- 示範的廣告代碼看起來很棒,但是當我切換成我的廣告代碼時,卻沒有出現廣告。
-
檢查以確定有廣告投放至您的廣告代碼
資源。最簡單的方法就是觀察 HTTP 流量。如果 HTML 錨點區塊中傳回 1x1 像素灰色.gif 圖片,您就需要在 Ad Manager 中檢查指定目標。
- 我想多次使用相同代碼來請求廣告,但只產生第一個廣告
請求。該如何解決這個問題?
-
多次請求廣告時,請務必讓廣告伺服器知道
這些是合法要求,並非意外重複。SDK 會透過兩個快速的 API 呼叫為您完成這項操作:
- 在
AdsManager
例項上呼叫 destroy()
。這樣當您以下列呼叫
contentComplete()
。您可獲得新的 AdsManager
有助於您提出下一個要求
- 在
AdsLoader
例項上呼叫 contentComplete()
。這會重設 SDK,讓新的廣告請求不會看起來像是先前的廣告請求的複本。
在發出上述兩個呼叫後,您可以在 AdsLoader
例項上呼叫 requestAds()
,取得另一組廣告,以便在新的影片中播放。
- 如何使用 IMA SDK 要求疊加和全版 AdSense 廣告?
-
如要使用 SDK 請求 AdSense 廣告,您必須先取得 AdSense
廣告代碼。詳細資訊請見 AdSense
。取得代碼後,您必須採取下列步驟,才能提出疊加或全版廣告版位廣告請求:
重疊廣告
- 在
AdsRequest
中,將 ViewMode 設為 NORMAL
。
- 在廣告代碼中,新增參數
overlay=1
。
全版位廣告
- 在
AdsRequest
中,將 ViewMode 設為 FULLSCREEN
。
- 在廣告代碼中,新增參數
overlay=0
。
- 點選廣告時,我收到「到達網址無效」錯誤訊息。可能的原因為何?
-
這個錯誤最常見的原因是點擊率網址未正確逸出。如果您看到這則錯誤訊息,請確認點閱網址在 VAST 回應中是否已正確逸出。
- 在 Android 和 iOS SDK 中,有辦法將整個影片廣告設為可點擊嗎?
- 就整部影片的點擊追蹤而言,行動裝置影片的標準觀眾體驗是輕觸影片後,影片會暫停或顯示播放器控制項。為避免使用者在想使用播放器控制項時,不小心點按廣告,IMA 會使用「Learn more」按鈕,讓使用者點按廣告,進一步瞭解廣告產品。
- 為什麼我會看到「VAST Document Empty」錯誤?
- 如果廣告代碼傳回空白的 VAST 文件,就會發生這個錯誤。
廣告無法正常放送請與客戶經理或廣告伺服器代表聯絡,瞭解廣告代碼無法運作的原因。
- 我可以變更「略過廣告」方塊或其他 UI 元素的大小/文字嗎?
- IMA SDK 不支援變更 UI 元素的版面配置、大小或內容。
如要進一步瞭解 UI 元素,請參閱
AdsManager.uiElements
。
- 為什麼我無法在 iOS 上調整廣告的音量?
-
iOS 不允許您以程式輔助方式設定音量。如果您使用 HTML5 SDK,
adsManager.setVolume()
就不會生效。因此,iOS SDK 不會在 IMAAdsManager 上提供音量設定器。
- 我可以使用多個執行緒來初始化及操作 UI 嗎?
-
所有 UI 初始化作業都必須在主執行緒上完成。初始化後,您可以選擇實作背景廣告播放。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-31 (世界標準時間)。
[null,null,["上次更新時間:2025-08-31 (世界標準時間)。"],[[["\u003cp\u003eThe test ad tags always return ads for valid requests to make integration and testing easier, however, live ads may not always be available for all ad formats, placements or targeting criteria.\u003c/p\u003e\n"],["\u003cp\u003eEnsure your \u003ccode\u003edescriptionUrl\u003c/code\u003e is set to a page on your site with 1-3 paragraphs accurately describing the content for better ad targeting.\u003c/p\u003e\n"],["\u003cp\u003eWhen requesting ads more than once using the same tag, ensure you reset the SDK by calling \u003ccode\u003edestroy()\u003c/code\u003e on \u003ccode\u003eAdsManager\u003c/code\u003e and \u003ccode\u003econtentComplete()\u003c/code\u003e on \u003ccode\u003eAdsLoader\u003c/code\u003e to avoid duplicate requests.\u003c/p\u003e\n"],["\u003cp\u003eThe "Ad response does not contain a valid ad type" error generally indicates that no ads are currently targeted to your publisher ID, time period or ad unit, ensure your ads and creatives are approved, targeted correctly and have not expired.\u003c/p\u003e\n"],["\u003cp\u003eThe IMA SDK does not allow for customization of UI elements like the "Skip Ad" button, and on iOS, programmatic volume control for ads is restricted by the operating system.\u003c/p\u003e\n"]]],[],null,["# Google Interactive Media Ads SDK FAQs\n\n- [Why am I not getting ads back for all formats?](#1)\n- [What does a good descriptionUrl look like?](#2)\n- [Why am I receiving the error \"Ad response does not contain a valid ad type\"?](#3)\n- [Do you have an Ad Manager video ad tag that I can use for testing?](#4)\n- [Should I set the adSlotWidth and adSlotHeight to the same values\n as the sz in my Ad Manager ad tag?](#5)\n- [The demo ad tag looks great, but when I switch it with my ad tag,\n no ad appears.](#7)\n- [I want to request ads using the same tag more than once, but I\n only get ads for my first request. How do I fix this?](#8)\n- [How do I request overlay and full slot AdSense ads using the IMA\n SDK?](#9)\n- [I'm getting an \"Invalid clickthrough URL\" error when I click on my\n ad. What could be the cause?](#10)\n- [In the Android and iOS SDKs, is there a way to make the entire video\n ad clickable?](#11)\n- [Why do I see a \"VAST Document Empty\" error?](#12)\n- [Can I change the size/text of the \"Skip Ad\" box or other UI elements?](#13)\n- [Why can't I change an ad's volume on iOS?](#16)\n- [Can I use multiple threads to initialize and manipulate the UI?](#18)\n\n*** ** * ** ***\n\nWhy am I not getting ads back for all formats?\n:\n The test ad tags are set up to always return ads for valid requests. This is\n meant to facilitate integration and make it easier to test how your player\n requests and renders ads. However, ads are not always available in every\n format for your site, account, or ad unit. If your integration is working\n properly for the test tag but not for your own tag, the cause may be one of\n the following:\n\n - You're serving videos of an unsupported format to your environment. For example, you're serving only HTML5 ads to iOS or Android.\n - If you're using Ad Manager, your publisher ID may not have any ads targeted to it at this time. Also, ensure that you have approved the relevant ads and creatives in Ad Manager.\n - If you're using AdSense, the targeting criteria for your site or test page may not have any active advertisements. The most common cause is the use of private, uncrawled websites.\n - If you're using Ad Exchange Network Partner Management and `descriptionURL` is not set or is not on the owned or operated domains management list, ads do not serve to this.\n - Check the *minCPM* thresholds defined in Ad Exchange Video. A fairly high CPM may result in very low fill rates. To correct this, try either removing the minCPM or removing the ad unit parameter from the ad request (i.e., slotname) to verify whether this is affecting the fill rate.\n\nWhat does a good `descriptionUrl` look like?\n:\n To be most effective, the content of the page that `descriptionUrl`\n points to shouldn't be a collection of words or phrases but rather\n 1-3 paragraphs actually describing the content and your role in providing it.\n One method that has been successful in the past is to stitch together\n `descriptionUrl` page content dynamically from predefined blocks.\n For example, a few sentences about the content, a few sentences about your\n site's offering, and then a few predefined snippets associated with each\n AdSense channel (like \"Entertainment\" or \"Sports\"). As a result, each piece of\n content has a reasonably distinct `descriptionUrl` associated with\n it that provides both general information (such as genre descriptors) as well\n as specific information (content about the content directly).\n\n This metadata HTML should be simple, for example:\n\n ```text\n \u003chtml\u003e\n \u003chead\u003e\n \u003ctitle\u003eDomain.com - Your tag line here!\u003c/title\u003e\n \u003c/head\u003e\n \u003cbody\u003e\n \u003ch1\u003eDescriptions\u003c/h1\u003e\n \u003ch2\u003eAbout this Content\u003c/h2\u003e\n \u003cp\u003eLorem ipsum dolor sit amet, consectetur adipiscing elit. ...\u003c/p\u003e\n \u003ch2\u003eAbout Domain.com\u003c/h2\u003e\n \u003cp\u003eLorem ipsum dolor sit amet, consectetur adipiscing elit. ...\u003c/p\u003e\n \u003c/body\u003e\n \u003c/html\u003e\n \n ```\n\nWhy am I receiving the error \"Ad response does not contain a valid ad type\"?\n: This error generally appears because no ads have been targeted to the\n specific `publisherId` (for the given time period). This condition\n may vary throughout the day, or over several days as campaigns begin and end.\n You should check that the ad you wish to target has not expired and that the\n ad targeting criteria are correct.\n As long as ads are properly requested, received, and rendered using\n the test `publisherId`, you can be sure that these ads are\n properly handled using your live `publisherId` when the ads are\n available.\n\nDo you have an Ad Manager video ad tag that I can use for testing?\n: Sample tags are available on the [sample tags](/interactive-media-ads/docs/sdks/ios/client-side/tags) page.\n\nShould I set the `adSlotWidth` and `adSlotHeight` to the same\nvalues as the `sz` in my Ad Manager ad tag?\n: Not necessarily. The `adSlotWidth` and `adSlotHeight`\n must be set to the width/height of the player or area you want your ads to\n fill. They are used by AdSense to determine which ads are available to fit\n into that space. The `sz` key/value pair in your Ad Manager ad tag is\n a targeting parameter and does not necessarily affect the creative served\n (more information below).\n\nThe demo ad tag looks great, but when I switch it with my ad tag, no ad appears.\n:\n Check to ensure that something is trafficked to the ad tag you are\n requesting. The easiest way to find out is to watch the HTTP traffic. If a\n **1x1 pixel grey.gif** image is returned within an HTML anchor block,\n then you need to check your targeting in Ad Manager.\n\nI want to request ads using the same tag more than once, but I only get ads for my first\nrequest. How do I fix this?\n:\n When you request ads more than once, you need to let the ad server know\n that these are legitimate requests, and not accidental duplicates. The SDK\n does this for you with two quick API calls:\n\n 1. Call `destroy()` on your `AdsManager` instance. This prevents any post-rolls from playing when you make the below call to `contentComplete()`. You get a new `AdsManager` when you make your next request.\n 2. Call `contentComplete()` on your `AdsLoader` instance. This resets the SDK so the new ad request doesn't look like a duplicate of the previous one.\n\n\n After making the two calls above, you can call `requestAds()` on\n your `AdsLoader` instance to get another set of ads to play for your\n new video.\n\nHow do I request overlay and full slot AdSense ads using the IMA SDK?\n\n: To request AdSense ads using the SDK, you need to first obtain an AdSense\n ad tag. You can learn more about that on the [AdSense\n for Video page](//support.google.com/adsense/answer/1705822). Once you have your tag, you need to take the following\n steps to make either an overlay or a full slot ad request:\n\n **Overlay ads**\n\n 1. In your `AdsRequest`, set your ViewModes to `NORMAL`.\n 2. In your ad tag, add the parameter `overlay=1`.\n\n **Full slot ads**\n\n 1. In your `AdsRequest`, set your ViewModes to `FULLSCREEN`.\n 2. In your ad tag, add the parameter `overlay=0`.\n\nI'm getting an \"Invalid clickthrough URL\" error when I click on my ad. What could be the cause?\n:\n The most common cause for this error is an improperly escaped clickthrough\n URL. If you're seeing this error, check to make sure that your clickthrough\n URL is properly escaped in your VAST response.\n\nIn the Android and iOS SDKs, is there a way to make the entire video ad clickable?\n: As far as whole-video click tracking goes, the standard viewer experience\n for mobile video that has emerged is that tapping on a video either\n pauses it or brings up the player controls. To avoid users\n unintentionally clicking on ads when they really just want access to the\n player controls IMA uses the **Learn more** button to let\n users click on an ad and learn more about the product being advertised.\n\nWhy do I see a \"VAST Document Empty\" error?\n: This error occurs when the ad tag returns an empty VAST document, indicating\n that the ad was not served properly. Talk to your account manager\n or ad server representative to see why your ad tag is not working.\n\nCan I change the size/text of the **Skip Ad** box or other UI elements?\n: The IMA SDKs do not support changing the layout, size, or content of UI elements.\n For more details on UI elements, see `AdsManager.uiElements`.\n\nWhy can't I change an ad's volume on iOS?\n:\n iOS does not allow you to set volume programmatically. If you're using the\n HTML5 SDK, `adsManager.setVolume()` has no effect. The iOS SDK does not\n provide a volume setter on the IMAAdsManager for this reason.\n\nCan I use multiple threads to initialize and manipulate the UI?\n:\n\n All initialization of the UI must be done on the main thread. After\n initialization, you can choose to implement\n [Background Ad Playback](/interactive-media-ads/docs/sdks/ios/background_ad_playback)."]]