لا تتطلّب معظم استخدامات حزمة تطوير البرامج لإعلانات الوسائط التفاعلية سوى إدارة طلب إعلان واحد في كل مرة. ومع ذلك، قد تتطلّب بعض عمليات التنفيذ في الحالات القصوى، مثل التحميل المُسبَق لبيانات الإعلانات قبل أن يختار المستخدم فيديو، تقديم طلبات متعدّدة متزامنة. بما أنّ طلبات الإعلانات يتم إجراؤها بشكل غير متزامن، قد يبدو أنّ ضمان ربط مدير الإعلانات المناسب بالسياق الصحيح هو مهمة شاقّة.
لتبسيط عملية التمييز بين عدّة مديري إعلانات، تسمح حزمة تطوير البرامج لإعلانات الوسائط التفاعلية لإصدار HTML5 للناشرين بتمرير أي قيمة أو عنصر إلى حقل UserContext في أي طلب إعلان. ويمكن بعد ذلك استرداد هذه القيمة أو هذا العنصر في معالِج AdsManagerLoadedEvent، وذلك باستخدام الطريقة getUserRequestContext().
مثال
...adsLoader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,onAdsManagerLoaded,false);adsLoader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,onAdsManagerError,false);constcontextA={id:"Request A",element:videoElementA};constcontextB={id:"Request B",element:videoElementB}adsLoader.requestAds(adsRequestA,contextA);adsLoader.requestAds(adsRequestB,contextB);...functiononAdsManagerLoaded(adsManagerLoadedEvent){constcontext=adsManagerLoadedEvent.getUserRequestContext();adsManager=adsManagerLoadedEvent.getAdsManager(context.element);console.log("Successfully loaded ID: "+context.id);}functiononAdsManagerError(adsManagerErrorEvent){constcontext=adsManagerErrorEvent.getUserRequestContext();console.log("Error with AdRequest ID: "+context.id);}...
تاريخ التعديل الأخير: 2025-04-15 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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-04-15 (حسب التوقيت العالمي المتفَّق عليه)"],[[["The IMA SDK allows for multiple concurrent ad requests, useful for preloading ads or managing multiple video players."],["Developers can use the `UserContext` field to associate a custom object with each ad request for easy identification."],["This object can be retrieved later using `getUserRequestContext()` in the `AdsManagerLoadedEvent` and `AdErrorEvent` handlers."],["This approach simplifies associating the correct AdsManager with its corresponding video element and context."]]],[]]