Để thảo luận và đưa ra ý kiến phản hồi về các sản phẩm của chúng tôi, hãy tham gia kênh Discord chính thức của Ad Manager trong máy chủ Cộng đồng quảng cáo và đo lường của Google.
Hướng dẫn này giải thích cách bật quảng cáo thử nghiệm cho hoạt động tích hợp quảng cáo của bạn. Bạn
nên bật quảng cáo thử nghiệm trong quá trình phát triển để có thể thử nghiệm
hành vi nhấp qua mà không làm ảnh hưởng đến số liệu thống kê của chiến dịch đặt trước hoặc
tính phí cho nhà quảng cáo trên Ad Exchange.
Cách nhanh nhất để bật tính năng thử nghiệm là sử dụng các đơn vị quảng cáo minh hoạ do Google cung cấp.
Các đơn vị quảng cáo này không liên kết với tài khoản Ad Manager của bạn, vì vậy, tài khoản của bạn sẽ không tạo ra lưu lượng truy cập không hợp lệ khi sử dụng các đơn vị quảng cáo này.
Dưới đây là các đơn vị quảng cáo minh hoạ trỏ đến mẫu quảng cáo thử nghiệm cụ thể cho từng định dạng:
Lưu ý quan trọng: Các đơn vị quảng cáo thử nghiệm này được định cấu hình để phân phát quảng cáo bán trực tiếp trong Ad Manager, và quảng cáo được bán trực tiếp không trả về nhãn Lựa chọn quảng cáo.
Bật thiết bị thử nghiệm
Nếu muốn thử nghiệm kỹ hơn bằng những quảng cáo giống với các quảng cáo đang chạy trong thực tế, bạn hiện có thể
định cấu hình thiết bị của mình thành thiết bị thử nghiệm và sử dụng mã đơn vị quảng cáo riêng mà
bạn đã tạo trong giao diện người dùng Ad Manager.
Làm theo các bước dưới đây để thêm thiết bị của bạn làm thiết bị thử nghiệm.
Thêm thiết bị thử nghiệm bằng cách lập trình
Để đăng ký thiết bị thử nghiệm, hãy hoàn tất các bước sau:
Tải ứng dụng có tích hợp quảng cáo và tạo một yêu cầu quảng cáo.
Kiểm tra đầu ra logcat để tìm thông báo tương tự như thông báo sau. Thông báo này sẽ cho bạn biết mã thiết bị của bạn và cách thêm thiết bị đó làm thiết bị thử nghiệm:
I/Ads: Use RequestConfiguration.Builder.setTestDeviceIds(Arrays.asList("33BE2250B43518CCDA7DE426D04EE231"))
to get test ads on this device."
Thay thế TEST_DEVICE_ID bằng mã thiết bị kiểm thử của bạn.
Bạn có thể kiểm tra
isTestDevice()
để xác nhận rằng thiết bị của bạn đã được thêm đúng cách dưới dạng thiết bị thử nghiệm (không bắt buộc).
Chạy lại ứng dụng của bạn. Nếu quảng cáo của Google hiển thị, bạn sẽ thấy nhãn Quảng cáo thử nghiệm xuất hiện ở chính giữa phía trên cùng của quảng cáo (quảng cáo biểu ngữ, quảng cáo xen kẽ hoặc quảng cáo dạng video có tặng thưởng):
Đối với quảng cáo gốc nâng cao, chuỗi Quảng cáo thử nghiệm sẽ được thêm trước tài sản dòng tiêu đề.
Việc nhấp vào những quảng cáo có nhãn Quảng cáo thử nghiệm này rất an toàn. Số yêu cầu, số lượt hiển thị và số lượt nhấp vào quảng cáo thử nghiệm sẽ không xuất hiện trong báo cáo của tài khoản.
Thử nghiệm với tính năng dàn xếp
Các đơn vị quảng cáo mẫu của Google chỉ hiển thị quảng cáo của Google. Để thử nghiệm cấu hình dàn xếp, bạn phải sử dụng phương pháp bật thiết bị thử nghiệm.
Quảng cáo được dàn xếp KHÔNG hiển thị nhãn Quảng cáo thử nghiệm. Bạn phải chịu trách nhiệm về việc đảm bảo bật quảng cáo thử nghiệm cho từng mạng dàn xếp để các mạng này không gắn cờ tài khoản của bạn do hoạt động không hợp lệ. Hãy xem hướng dẫn dàn xếp
tương ứng của từng mạng để biết thêm thông tin.
Nếu bạn không chắc chắn liệu bộ điều hợp mạng quảng cáo dàn xếp có hỗ trợ quảng cáo thử nghiệm hay không, thì cách an toàn nhất là tránh nhấp vào các quảng cáo từ mạng đó trong giai đoạn phát triển. Bạn
có thể sử dụng phương thức
getMediationAdapterClassName()
trên mọi định dạng quảng cáo để tìm ra mạng quảng cáo đã phân phát quảng cáo hiện tại.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-09-05 UTC."],[[["\u003cp\u003eThis guide helps you enable test ads in your app during development to avoid impacting campaign stats and accidental charges.\u003c/p\u003e\n"],["\u003cp\u003eYou can use Google-provided demo ad units or configure your own device as a test device for more realistic testing scenarios.\u003c/p\u003e\n"],["\u003cp\u003eWhen using your own ad units, register your device programmatically for testing and remember to remove this configuration before releasing your app.\u003c/p\u003e\n"],["\u003cp\u003eTest ads are clearly labeled, ensuring clicks won't affect your reports; however, mediated ads might not have this label, requiring extra caution.\u003c/p\u003e\n"],["\u003cp\u003eFor mediation testing, enable test ads for each network individually and refer to their respective guides to ensure accurate results and prevent invalid activity flags.\u003c/p\u003e\n"]]],["To enable test ads, use Google-provided demo ad units during development, replacing them with your own before publishing. For more rigorous testing, configure devices as test devices. Programmatically, add devices by retrieving the device ID from logcat, then use `RequestConfiguration.Builder.setTestDeviceIds()` to register it. Test ads will have a \"Test Ad\" label. For mediation, use test devices, as mediated ads lack the label; consult each network's guide and use `getMediationAdapterClassName()` to identify the serving network.\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 for your ads integration. It's\nrecommended that you enable test ads during development so you can test\nclick-through behavior without affecting your reservation campaigns' stats or\ncharging advertisers on Ad Exchange.\n\n\u003cbr /\u003e\n\nPrerequisite\n\n- Complete [Get Started](/ad-manager/mobile-ads-sdk/android/quick-start).\n\nDemo ad units\n\nThe quickest way to enable testing is to use Google-provided demo ad units.\nThese ad units are not associated with your Ad Manager\naccount, so there's no risk of your account generating invalid traffic when\nusing these ad units.\n| **Key Point:** Make sure you replace these IDs with your own ad unit ID before publishing your app.\n\nHere are demo ad units that point to specific test creatives for each format:\n\n| Ad format | Demo ad unit ID |\n|-----------------------------------------------------------------------------------|----------------------------------------------|\n| [App Open](/ad-manager/mobile-ads-sdk/android/app-open) | `/21775744923/example/app-open` |\n| [Adaptive Banner](/ad-manager/mobile-ads-sdk/android/banner) | `/21775744923/example/adaptive-banner` |\n| [Fixed Size Banner](/ad-manager/mobile-ads-sdk/android/banner/fixed-size) | `/21775744923/example/fixed-size-banner` |\n| [Interstitial](/ad-manager/mobile-ads-sdk/android/interstitial) | `/21775744923/example/interstitial` |\n| [Rewarded Ads](/ad-manager/mobile-ads-sdk/android/rewarded) | `/21775744923/example/rewarded` |\n| [Rewarded Interstitial](/ad-manager/mobile-ads-sdk/android/rewarded-interstitial) | `/21775744923/example/rewarded-interstitial` |\n| [Native](/ad-manager/mobile-ads-sdk/android/native) | `/21775744923/example/native` |\n| [Native Video](/ad-manager/mobile-ads-sdk/android/native/video-ads) | `/21775744923/example/native-video` |\n\nKey Point: These demo ad units are configured to serve direct-sold ads in Ad Manager, and direct-sold ads do not return AdChoices.\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 UI.\n\n\nFollow the steps below to add your device as a test device.\n| **Key Point:** Android emulators are automatically configured as test devices.\n\nAdd your test device programmatically\n\nTo register your test device, complete the following steps:\n\n1. Load your ads-integrated app and make an ad request.\n2. Check the logcat output for a message similar to the following, which shows you your device ID and how to add it as a test device: \n\n ```text\n I/Ads: Use RequestConfiguration.Builder.setTestDeviceIds(Arrays.asList(\"33BE2250B43518CCDA7DE426D04EE231\"))\n to get test ads on this device.\"\n ```\n Copy your test device ID to your clipboard.\n3. Modify your code to call\n\n [`RequestConfiguration.Builder.setTestDeviceIds()`](/ad-manager/mobile-ads-sdk/android/reference/com/google/android/gms/ads/RequestConfiguration.Builder#setTestDeviceIds(java.util.List%3Cjava.lang.String%3E))\n\n and pass in a list of your test device IDs.\n\n Java \n\n List\u003cString\u003e testDeviceIds = Arrays.asList(\"\u003cvar translate=\"no\"\u003eTEST_DEVICE_ID\u003c/var\u003e\");\n RequestConfiguration configuration =\n new RequestConfiguration.Builder().setTestDeviceIds(testDeviceIds).build();\n MobileAds.setRequestConfiguration(configuration); \n https://github.com/googleads/googleads-mobile-android-examples/blob/ccc290a583d7f552bdcf81ea76adc05beaa43f0b/java/advanced/APIDemo/app/src/main/java/com/google/android/gms/snippets/RequestConfigurationSnippets.java#L15-L18\n\n Kotlin \n\n val testDeviceIds = listOf(\"\u003cvar translate=\"no\"\u003eTEST_DEVICE_ID\u003c/var\u003e\")\n val configuration = RequestConfiguration.Builder().setTestDeviceIds(testDeviceIds).build()\n MobileAds.setRequestConfiguration(configuration) \n https://github.com/googleads/googleads-mobile-android-examples/blob/ccc290a583d7f552bdcf81ea76adc05beaa43f0b/kotlin/advanced/APIDemo/app/src/main/java/com/google/android/gms/snippets/RequestConfigurationSnippets.kt#L27-L29\n\n Replace \u003cvar translate=\"no\"\u003eTEST_DEVICE_ID\u003c/var\u003e with your test device ID.\n\n You can optionally check\n\n [`isTestDevice()`](/ad-manager/mobile-ads-sdk/android/reference/com/google/android/gms/ads/AdRequest#isTestDevice(android.content.Context))\n\n to confirm that your device was properly added as a test device.\n | **Caution:** Be sure to remove the code that sets these test device IDs before you release your app.\n4. Re-run your app. If the ad is a Google ad, you'll see a **Test Ad** label\n centered at the top of the ad (banner, interstitial, or rewarded video):\n\n | **Note:** To see the **Test Ad** label, you need to be using an SDK version of 11.6.0 or higher.\n\n For native advanced ads, the headline asset is prepended with the string **Test Ad**.\n\nAds with this **Test Ad** label are safe to click. Requests, impressions, and\nclicks on test ads won't show up in your account's reports.\n| **Note:** Mediated ads do *NOT* render a **Test Ad** label. See the following section for details.\n\nTesting with mediation\n\nGoogle's sample ad units only show Google Ads. To test your\n\nmediation configuration,\nyou 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](/ad-manager/mobile-ads-sdk/android/mediation)\nfor more information.\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\n\n[`getMediationAdapterClassName()`](/ad-manager/mobile-ads-sdk/android/reference/com/google/android/gms/ads/ResponseInfo#getMediationAdapterClassName())\n\nmethod on any of the ad formats to figure out which ad network served the\ncurrent ad."]]