سؤالات متداول SDK تبلیغات رسانه تعاملی Google
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
- چرا تبلیغات را برای همه فرمتها پس نمیگیرم؟
- برچسبهای آگهی آزمایشی به گونهای تنظیم شدهاند که همیشه برای درخواستهای معتبر، تبلیغات را برمیگردانند. این به منظور تسهیل یکپارچه سازی و آسان تر کردن آزمایش نحوه درخواست و ارائه تبلیغات توسط پخش کننده شما است. با این حال، تبلیغات همیشه در هر قالبی برای سایت، حساب یا واحد تبلیغات شما در دسترس نیستند. اگر ادغام شما برای تگ تست به درستی کار می کند اما برای تگ خود شما کار نمی کند، علت ممکن است یکی از موارد زیر باشد:
- شما در حال ارائه ویدیوهایی با فرمت پشتیبانی نشده به محیط خود هستید. به عنوان مثال، شما فقط تبلیغات HTML5 را برای iOS یا Android ارائه می دهید.
- اگر از Ad Manager استفاده میکنید، ممکن است شناسه ناشر شما در حال حاضر هیچ تبلیغی برای آن نداشته باشد. همچنین، مطمئن شوید که تبلیغات و خلاقیتهای مربوطه را در Ad Manager تأیید کردهاید.
- اگر از AdSense استفاده می کنید، معیارهای هدف گذاری برای سایت یا صفحه آزمایشی شما ممکن است تبلیغات فعال نداشته باشد. شایع ترین علت استفاده از وب سایت های خصوصی و بدون خزیدن است.
- اگر از مدیریت شریک شبکه Ad Exchange استفاده میکنید و
descriptionURL
تنظیم نشده است یا در فهرست مدیریت دامنههای تحت مالکیت یا ادارهشده نیست، تبلیغات به این مورد ارائه نمیشوند. - آستانه minCPM تعریف شده در Ad Exchange Video را بررسی کنید. CPM نسبتاً بالا ممکن است منجر به نرخ پر شدن بسیار پایین شود. برای تصحیح این، سعی کنید 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
را روی همان مقادیر sz
در تگ Ad Manager خود تنظیم کنم؟ - نه لزوما.
adSlotWidth
و adSlotHeight
باید روی عرض/ارتفاع پخش کننده یا ناحیه ای که می خواهید تبلیغات شما پر شود تنظیم شوند. AdSense از آنها استفاده می کند تا مشخص کند کدام تبلیغات در آن فضا قرار می گیرند. جفت کلید/مقدار sz
در تگ تبلیغاتی Ad Manager شما یک پارامتر هدف است و لزوماً بر خلاقیت ارائه شده تأثیر نمی گذارد (اطلاعات بیشتر در زیر). - تگ تبلیغ آزمایشی عالی به نظر می رسد، اما وقتی آن را با برچسب تبلیغ خود تغییر می دهم، هیچ تبلیغی ظاهر نمی شود.
- بررسی کنید تا مطمئن شوید چیزی به برچسب تبلیغی که درخواست میکنید قاچاق شده است. ساده ترین راه برای فهمیدن این است که ترافیک HTTP را تماشا کنید. اگر یک تصویر grey.gif 1x1 پیکسل در یک بلوک لنگر HTML برگردانده شود، باید هدف خود را در Ad Manager بررسی کنید.
- من میخواهم با استفاده از یک برچسب بیش از یک بار آگهی درخواست کنم، اما فقط برای اولین درخواستم آگهی دریافت میکنم. چگونه این را درست کنم؟
- وقتی بیش از یک بار درخواست تبلیغات میکنید، باید به سرور آگهی اطلاع دهید که این درخواستها قانونی هستند و تکراری تصادفی نیستند. SDK با دو تماس سریع API این کار را برای شما انجام می دهد:
- در نمونه
AdsManager
خود destroy()
فراخوانی کنید. هنگامی که تماس زیر را با contentComplete()
برقرار میکنید، از پخش هر پست رول جلوگیری میکند. هنگامی که درخواست بعدی خود را ارائه می کنید، یک AdsManager
جدید دریافت می کنید. -
contentComplete()
را در نمونه AdsLoader
خود فراخوانی کنید. این SDK را بازنشانی میکند تا درخواست آگهی جدید شبیه درخواست قبلی نباشد.
پس از برقراری دو تماس بالا، میتوانید requestAds()
در نمونه AdsLoader
خود فراخوانی کنید تا مجموعه دیگری از تبلیغات را برای پخش ویدیوی جدید خود دریافت کنید. - چگونه میتوانم با استفاده از کیت توسعه نرمافزار IMA، آگهیهای AdSense همپوشانی و شکاف کامل را درخواست کنم؟
برای درخواست تبلیغات AdSense با استفاده از SDK، ابتدا باید یک برچسب AdSense دریافت کنید. میتوانید در صفحه AdSense for Video در مورد آن اطلاعات بیشتری کسب کنید. هنگامی که برچسب خود را دریافت کردید، باید مراحل زیر را برای ایجاد یک درخواست تبلیغاتی همپوشانی یا شکاف کامل انجام دهید:
تبلیغات همپوشانی- در
AdsRequest
خود، ViewModes خود را روی NORMAL
تنظیم کنید. - در تگ تبلیغاتی خود، پارامتر
overlay=1
اضافه کنید.
تبلیغات اسلات کامل- در
AdsRequest
خود، ViewModes خود را روی FULLSCREEN
تنظیم کنید. - در تگ تبلیغاتی خود، پارامتر
overlay=0
اضافه کنید.
- وقتی روی تبلیغ خود کلیک می کنم با خطای "Invalid clickthrough URL" مواجه می شوم. علت چی میتونه باشه؟
- رایجترین دلیل این خطا، نشانی اینترنتی کلیکی است که به درستی از آن خارج شده است. اگر این خطا را میبینید، بررسی کنید تا مطمئن شوید که URL کلیک شما به درستی در پاسخ VAST شما خارج شده است.
- چرا خطای "VAST Document Empty" را می بینم؟
- این خطا زمانی رخ می دهد که تگ آگهی یک سند VAST خالی را برمی گرداند که نشان می دهد تبلیغ به درستی ارائه نشده است. با مدیر حساب یا نماینده سرور تبلیغات خود صحبت کنید تا ببینید چرا برچسب تبلیغات شما کار نمی کند.
- آیا می توانم اندازه/متن کادر Skip Ad یا سایر عناصر رابط کاربری را تغییر دهم؟
- کیت توسعه نرم افزار IMA از تغییر طرح، اندازه یا محتوای عناصر رابط کاربری پشتیبانی نمی کند. برای جزئیات بیشتر در مورد عناصر رابط کاربری،
AdsManager.uiElements
را ببینید. - آیا کنترلهای ویدئویی بومی با HTML5 SDK پشتیبانی میشوند؟
- خیر، HTML5 SDK از کنترل های بومی پشتیبانی نمی کند.
- من در اجرای HTML5 خود عبارت "بازی را در "HTMLMediaElement" اجرا نشد: API را فقط می توان با اشاره کاربر شروع کرد." چگونه این را درست کنم؟
- در دستگاه های تلفن همراه، باید
adDisplayContainer.initialize()
در نتیجه یک اقدام کاربر (مانند ضربه زدن) فراخوانی کنید. اگر این خطا را مشاهده می کنید، به احتمال زیاد آن را در یک زمینه غیر آغاز شده توسط کاربر فراخوانی می کنید. توجه داشته باشید که باید نتیجه مستقیم یک اقدام کاربر باشد. به عنوان مثال، اگر با پخش یک ویدیو به یک رویداد «tap» پاسخ دهید و سپس از رویداد «play» پخشکننده ویدیو برای فراخوانی initialize()
استفاده کنید، SDK این خطا را برمیگرداند. شما باید initialize()
به عنوان نتیجه خود رویداد tap فراخوانی کنید. - چگونه می توانم با تمرکز صفحه کلید روی کلیک های تبلیغاتی مقابله کنم؟
- اگر از کنترل های صفحه کلید برای پخش کننده خود استفاده می کنید، ممکن است متوجه شوید که پس از کلیک روی
adDisplayContainer
دیگر کار نمی کنند. این به این دلیل است که پس از کلیک روی یک تبلیغ، تمرکز صفحه کلید به iframe IMA تغییر می کند. برای حفظ تمرکز صفحه کلید بر روی پخش کننده محتوا، لطفاً از رویداد CLICK
برای انتقال فوکوس صفحه کلید به ظرف مورد نظر استفاده کنید. برای جزئیات بیشتر به قطعه کد زیر مراجعه کنید: adsManager.addEventListener(
google.ima.AdEvent.Type.CLICK,
function(){
window.focus();
// Or another method to return focus to the desired container.
});
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThe IMA HTML5 SDK facilitates ad integration and testing, but live ads depend on factors like ad targeting, formats, and publisher settings.\u003c/p\u003e\n"],["\u003cp\u003eIf your ad tag isn't working, review your Ad Manager targeting, ensure your descriptionUrl is properly set up, and check for any errors in your VAST response.\u003c/p\u003e\n"],["\u003cp\u003eFor repeated ad requests, use \u003ccode\u003edestroy()\u003c/code\u003e on the AdsManager and \u003ccode\u003econtentComplete()\u003c/code\u003e on the AdsLoader to avoid duplicate requests.\u003c/p\u003e\n"],["\u003cp\u003eNative video controls are not supported with the HTML5 SDK, and on mobile devices, \u003ccode\u003eadDisplayContainer.initialize()\u003c/code\u003e must be called directly as a result of a user action.\u003c/p\u003e\n"],["\u003cp\u003eKeyboard focus can be managed by utilizing the CLICK event and transferring it back to the content player.\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- [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- [Are native video controls supported with the HTML5 SDK?](#15)\n- [I'm seeing \"Failed to execute 'play' on 'HTMLMediaElement': API can only be\n initiated by a user gesture\" in my HTML5 implementation. How do I fix this?](#17)\n- [How do I handle keyboard focus on ad clicks?](#19)\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/html5/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\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\nAre native video controls supported with the HTML5 SDK?\n:\n No, the HTML5 SDK does not support native controls.\n\nI'm seeing \"Failed to execute 'play' on 'HTMLMediaElement': API can only be initiated\nby a user gesture\" in my HTML5 implementation. How do I fix this?\n:\n On mobile devices, you must call `adDisplayContainer.initialize()`\n as the result of a user action (such as a tap). If you're\n seeing this error, you're most likely calling it on a non-user-initiated context. Note that it\n must be the **direct** result of a user action. For example, if you respond to a\n \"tap\" event by playing a video, and then use the video player's \"play\" event to call\n `initialize()`, the SDK returns this error. You must call `initialize()` as\n the result of the tap event itself.\n\nHow do I handle keyboard focus on ad clicks?\n:\n If you use keyboard controls for your player you may notice that they will no longer work\n following clicks on the `adDisplayContainer`. This is because, once an ad is clicked\n keyboard focus is switched to the IMA iframe. To keep keyboard focus on the content player, please\n utilize the\n [CLICK](/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.AdEvent)\n event to transfer keyboard focus back to the desired container. See the following code snippet for\n more details: \n\n ```text\n adsManager.addEventListener(\n google.ima.AdEvent.Type.CLICK,\n function(){\n window.focus();\n // Or another method to return focus to the desired container.\n });\n \n ```"]]