يوضّح هذا الدليل كيفية تفعيل الإعلانات الاختبارية في عملية دمج الإعلانات. من المهم تفعيل الإعلانات الاختبارية أثناء التطوير حتى تتمكّن من النقر عليها بدون تحصيل رسوم من المعلِنين على Google. إذا نقرتَ على عدد كبير جدًا من الإعلانات بدون استخدام وضع الاختبار، قد يتم الإبلاغ عن حسابك بسبب النشاط غير الصالح.
هناك طريقتان للحصول على إعلانات اختبارية:
استخدِم نموذج وحدة إعلانية من Google.
استخدِم وحدتك الإعلانية وفعِّل الأجهزة الاختبارية.
استورِد مكوّن Google Mobile Ads Unity الإضافي إلى تطبيق Unity.
نماذج الوحدات الإعلانية
أسرع طريقة لتفعيل الاختبار هي استخدام الوحدات الإعلانية الاختبارية التي توفّرها Google.
هذه الوحدات الإعلانية غير مرتبطة بحسابك على "مدير إعلانات Google"، لذلك من غير المحتمل أن يُنشئ حسابك زيارات غير صالحة عند استخدام هذه الوحدات الإعلانية.
من المهم ملاحظة أنّه يجب استخدام وحدات إعلانية اختبارية مختلفة تقدّمها Google حسب المنصة. عليك استخدام وحدة إعلانية اختبارية على iOS لتقديم طلبات إعلانات اختبارية على iOS، ووحدة إعلانية اختبارية على Android لتقديم طلبات على Android.
في ما يلي نماذج لوحدات إعلانية لكل شكل من الأشكال على كلّ من Android وiOS:
تشير هذه الوحدات الإعلانية إلى تصاميم إعلانية اختبارية محدّدة.
تفعيل أجهزة الاختبار
إذا كنت تريد إجراء اختبارات أكثر دقة باستخدام إعلانات ذات شكل نهائي، يمكنك الآن إعداد جهازك على أنّه جهاز اختباري واستخدام أرقام تعريف الوحدات الإعلانية التي أنشأتها في واجهة الويب الخاصة بـ "مدير إعلانات Google". يمكن إضافة الأجهزة الاختبارية إما في واجهة الويب أو آليًا باستخدام حزمة تطوير البرامج (SDK) لإعلانات Google على الأجهزة الجوّالة.
اتّبِع الخطوات التالية لإضافة جهازك كجهاز اختباري.
إضافة جهاز الاختبار في واجهة الويب الخاصة بـ "مدير إعلانات Google"
للحصول على طريقة بسيطة وغير آلية لإضافة جهاز اختباري واختبار إصدارات التطبيق الجديدة أو الحالية، استخدِم واجهة الويب الخاصة بـ "مدير إعلانات Google".
إضافة جهاز الاختبار بطريقة آلية
إذا كنت تريد اختبار الإعلانات في تطبيقك أثناء تطويره، اتّبِع الخطوات التالية لتسجيل جهازك الاختباري آليًا.
شغِّل تطبيقًا تم إعداده باستخدام حزمة "SDK لإعلانات Google على الأجهزة الجوّالة" وقدِّم طلب إعلان
باستخدام أحد أرقام تعريف الوحدات الإعلانية الاختبارية المدرَجة أعلاه.
قائمة الرموز
...privatevoidRequestBanner(){#if UNITY_ANDROIDstringadUnitId="ca-app-pub-3940256099942544/6300978111";#elif UNITY_IPHONEstringadUnitId="ca-app-pub-3940256099942544/2934735716";#elsestringadUnitId="unexpected_platform";#endif// Create a 320x50 banner at the top of the screen.bannerView=newBannerView(adUnitId,AdSize.Banner,AdPosition.Top);// Create an empty ad request.AdRequestrequest=newAdRequest();// Load the banner with the request.bannerView.LoadAd(request);}
تحقَّق من وحدة التحكّم أو مخرجات logcat بحثًا عن رسالة تبدو على النحو التالي:
Android
I/Ads: Use
RequestConfiguration.Builder
.setTestDeviceIds(Arrays.asList("33BE2250B43518CCDA7DE426D04EE231"))
to get test ads on this device.
iOS
<Google> To get test ads on this device, set:
GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers =
@[ @"2077ef9a63d2b398840261c8221a0c9b" ];
انسخ معرّف جهاز الاختبار المكوّن من حروف أبجدية رقمية إلى الحافظة.
عدِّل الرمز لإضافة معرّفات الأجهزة الاختبارية إلى قائمة RequestConfiguration.TestDeviceIds.
أعِد تشغيل تطبيقك. إذا أضفت جهازك بشكل صحيح كجهاز اختباري، سيظهر لك التصنيف إعلان اختباري في أعلى وسط الإعلانات الصورية والإعلانات البينية والإعلانات مقابل مكافآت:
يمكن النقر على الإعلانات التي تحمل التصنيف إعلان اختباري بدون أن يؤثّر ذلك سلبًا عليك. لا تظهر أي طلبات أو مرّات ظهور أو نقرات على الإعلانات الاختبارية في تقارير حسابك.
بعد تسجيل جهازك كجهاز اختباري، يمكنك البدء في تلقّي إعلانات اختبارية أكثر واقعية من خلال استبدال adUnitID الاختبارية بـ adUnitID الخاصة بك.
الاختبار باستخدام Unity Editor
بدءًا من الإصدار 5.4.0، يمكنك اختبار إعلاناتك مباشرةً في محرّر Unity. سيضيف المحرّر صورة Prefab تقدّم تجربة مشابهة لطريقة عمل الإعلانات الفعلية على منصة الأجهزة الجوّالة.
اختبار التوسّط
لا تعرض نماذج الوحدات الإعلانية من Google إلا إعلانات Google. ولاختبار إعداد التوسّط، عليك استخدام أسلوب تفعيل أجهزة الاختبار.
لا تعرض الإعلانات التي يتم التوسّط فيها التصنيف إعلان اختباري. أنت مسؤول عن التأكّد من تفعيل الإعلانات الاختبارية لكل شبكة من شبكات التوسّط حتى لا تبلغ هذه الشبكات عن حسابك بسبب النشاط غير الصالح. لمزيد من المعلومات، يُرجى الرجوع إلى دليل التوسّط الخاص بكل شبكة.
إذا لم تكن متأكدًا مما إذا كان محوّل شبكة إعلانات التوسّط يتيح عرض إعلانات اختبارية، من الأفضل تجنُّب النقر على الإعلانات من تلك الشبكة أثناء التطوير. يمكنك استخدام طريقة MediationAdapterClassName() مع أي من أشكال الإعلانات لمعرفة الشبكة الإعلانية التي عرضت الإعلان الحالي.
تاريخ التعديل الأخير: 2025-09-02 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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-02 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eEnable test ads during development to avoid invalid activity flags on your account by preventing accidental clicks on real ads.\u003c/p\u003e\n"],["\u003cp\u003eYou can enable test ads using Google-provided sample ad units or by configuring your device as a test device with your own ad unit IDs.\u003c/p\u003e\n"],["\u003cp\u003eReplace test ad unit IDs with your own before publishing your app and remove test device configuration code.\u003c/p\u003e\n"],["\u003cp\u003eAndroid emulators, iOS simulators, and the Unity Editor (version 5.4.0 and above) offer built-in testing capabilities.\u003c/p\u003e\n"],["\u003cp\u003eWhen testing mediation, ensure test ads are enabled for each ad network to prevent invalid activity flags.\u003c/p\u003e\n"]]],[],null,["Select platform: [Android](/ad-manager/mobile-ads-sdk/android/test-ads \"View this page for the Android platform docs.\") [iOS](/ad-manager/mobile-ads-sdk/ios/test-ads \"View this page for the iOS platform docs.\") [Unity](/ad-manager/mobile-ads-sdk/unity/test-ads \"View this page for the Unity platform docs.\") [Flutter](/ad-manager/mobile-ads-sdk/flutter/test-ads \"View this page for the Flutter platform docs.\")\n\n\u003cbr /\u003e\n\nThis guide explains how to enable test ads in your ads integration. It's\nimportant to enable test ads during development so that you can click on them\nwithout charging Google advertisers. If you click on too many ads without being\nin test mode, you risk your account being flagged for invalid activity.\n\nThere are two ways to get test ads:\n\n1. Use one of Google's sample ad units.\n\n2. Use your own ad unit and enable test devices.\n\nPrerequisites\n\n- Complete [Get Started](quick-start).\n\n- Import the Google Mobile Ads Unity plugin to your Unity app.\n\nSample ad units\n\nThe quickest way to enable testing is to use Google-provided test ad units.\nThese ad units are not associated with your Ad Manager account, so there's no\nrisk of your account generating invalid traffic when using these ad units.\n\nIt is important to note that different Google-provided test ad units should be\nused depending on the platform. You'll need to use an iOS test ad unit for\nmaking test ad requests on iOS and an Android test ad unit for making requests\non Android.\n| **Key Point:** Make sure you replace these test IDs with your own ad unit ID before publishing your app.\n\nHere are sample ad units for each format on both Android and iOS:\n\n| Ad format | Sample ad unit ID |\n|------------------------------------------------|----------------------------------------------|\n| [App open](app-open) | `/21775744923/example/app-open` |\n| [Banner](banner) | `/21775744923/example/adaptive-banner` |\n| [Interstitial](interstitial) | `/21775744923/example/interstitial` |\n| [Rewarded](rewarded) | `/21775744923/example/rewarded` |\n| [Rewarded Interstitial](rewarded-interstitial) | `/21775744923/example/rewarded-interstitial` |\n| [Native](native-overlay) | `/21775744923/example/native` |\n| [Native Video](native-overlay) | `/21775744923/example/native-video` |\n\nThese ad units point to specific test creatives.\n\nEnable test devices\n\nIf you want to do more rigorous testing with production-looking ads, you can\nnow configure your device as a test device and use your own ad unit IDs that\nyou've created in the Ad Manager web interface. Test devices can either be added\nin the web interface or programmatically using the Google Mobile Ads SDK.\n\nFollow the steps below to add your device as a test device.\n| **Key Point:** Android emulators and iOS simulators are automatically configured as test devices.\n\nAdd your test device in the Ad Manager web interface\n\nFor a simple, non-programmatic way to add a test device and test new or existing\napp builds, use the Ad Manager web interface.\n| **Key Point:** New test devices typically start serving test ads in your app within 15 minutes, but it can also take up to 24 hours.\n\nAdd your test device programmatically\n\nIf you want to test ads in your app as you're developing, follow the\nsteps below to programmatically register your test device.\n\n1. Run an app configured with the Mobile Ads SDK and make an ad request\n using one of the test ad unit IDs listed above.\n [Code listing](banner#create_a_bannerview).\n\n ```c#\n ...\n private void RequestBanner()\n {\n #if UNITY_ANDROID\n string adUnitId = \"ca-app-pub-3940256099942544/6300978111\";\n #elif UNITY_IPHONE\n string adUnitId = \"ca-app-pub-3940256099942544/2934735716\";\n #else\n string adUnitId = \"unexpected_platform\";\n #endif\n\n // Create a 320x50 banner at the top of the screen.\n bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Top);\n // Create an empty ad request.\n AdRequest request = new AdRequest();\n // Load the banner with the request.\n bannerView.LoadAd(request);\n }\n ```\n2. Check the console or logcat output for a message that looks like this:\n\n Android \n\n ```\n I/Ads: Use\n RequestConfiguration.Builder\n .setTestDeviceIds(Arrays.asList(\"33BE2250B43518CCDA7DE426D04EE231\"))\n to get test ads on this device.\n ```\n\n iOS \n\n ```\n \u003cGoogle\u003e To get test ads on this device, set:\n GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers =\n @[ @\"2077ef9a63d2b398840261c8221a0c9b\" ];\n ```\n3. Copy your alphanumeric test device ID to your clipboard.\n\n4. Modify your code to add the test device IDs to your\n `RequestConfiguration.TestDeviceIds` list.\n\n ```c#\n RequestConfiguration requestConfiguration = new RequestConfiguration();\n requestConfiguration.TestDeviceIds.Add(\"2077ef9a63d2b398840261c8221a0c9b\");\n ```\n | Be sure to remove the code that sets these test devices before you release your app.\n5. Set `requestConfiguration` globally to `MobileAds`.\n\n ```c#\n MobileAds.SetRequestConfiguration(requestConfiguration);\n ```\n6. Re-run your app. If you correctly added your device as a test device, you\n will see a **Test Ad** label centered at the top of banner, interstitial,\n and rewarded ads:\n\n Ads with this **Test Ad** label are safe to click. Any requests,\n impressions, and clicks on test ads do not show up in your account's\n reports.\n | Mediated ads DO NOT render a **Test Ad** label.\n7. Now that your device is registered as a test device, you can begin receiving\n more realistic test ads by replacing the test `adUnitID` with your own\n `adUnitID`.\n\nTesting with the Unity Editor\n\nBeginning with version 5.4.0, you can test your ads directly in the\nUnity editor. The editor will add a Prefab image giving a similar experience to\nhow actual ads will behave on a mobile platform.\n\n| **Note:** Because the mock ads are prefab objects, they will appear \"under\" your GUI in the Unity Editor. When you export to a mobile platform, however, ads render on top of any game views.\n\nTesting with mediation\n\nGoogle's sample ad units only show Google Ads. To test your mediation\nconfiguration, you must use the [enable test devices](#enable_test_devices)\napproach.\n\nMediated ads do *NOT* render a **Test Ad** label. You are responsible for\nensuring that test ads are enabled for each of your mediation networks so these\nnetworks don't flag your account for invalid activity. See each network's\nrespective [mediation guide](mediation) for more\ninformation.\n\nIf you aren't sure whether a mediation ad network adapter supports test ads, it\nis safest to avoid clicking on ads from that network during development. You\ncan use the `MediationAdapterClassName()` method on any of the ad formats to\nfigure out which ad network served the current ad."]]