การติดตามเครือข่าย
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เลือกแพลตฟอร์ม:
Android
iOS
การติดตามเครือข่ายช่วยให้คุณเห็นกิจกรรมของเครือข่ายที่เกี่ยวข้องกับ
SDK โฆษณาในอุปกรณ์เคลื่อนที่ของ Google ซึ่งจะมีประโยชน์ในการแก้ไขข้อบกพร่องของการติดตั้งใช้งานโฆษณา Google ในอุปกรณ์เคลื่อนที่
สาเหตุสำคัญในการใช้การติดตามเครือข่ายแทนการใช้เครื่องมืออย่าง Charles
Proxy คือการติดตามเครือข่ายทำงานได้ในอุปกรณ์ iOS ทุกเครื่อง ทุกเวอร์ชัน โดยไม่ต้องเชื่อถือโปรไฟล์ใบรับรองความปลอดภัยของบุคคลที่สาม แต่เครื่องมือพร็อกซีไม่เป็นเช่นนั้นเนื่องจากข้อกำหนดของโปรไฟล์ใบรับรองตั้งแต่ iOS 10.3
คู่มือนี้จะอธิบายวิธีเปิดใช้การติดตามเครือข่ายเพื่อวัตถุประสงค์ในการแก้ไขข้อบกพร่อง
Enable tracing
หากต้องการเปิดใช้การติดตามเครือข่าย ให้ตั้งค่าคีย์ GADEnableNetworkTracing
เป็น YES
ใน
ไฟล์ plist
เมื่อเปิดใช้การติดตามเครือข่าย SDK โฆษณาในอุปกรณ์เคลื่อนที่ของ Google จะบันทึกเหตุการณ์เครือข่าย
ไปยังคอนโซล จากนั้นคุณจะส่งสำเนาบันทึกให้วิศวกรของเราเพื่อ
วิเคราะห์เป็นคำตอบส่วนตัวในฟอรัมนักพัฒนาแอปได้
การบันทึก
ระบบจะใช้บันทึกคอนโซลมาตรฐานที่เหมาะสมกับแพลตฟอร์มเพื่อแสดงผลบันทึกเครือข่าย
ข้อความบันทึกของคอนโซลจะขึ้นต้นด้วยสตริง GMA Debug BEGIN
GMA Debug CONTENT
หรือ GMA Debug FINISH
เสมอ เพื่อให้ค้นหาหรือ
กรองออกได้ สำหรับบันทึกเครือข่ายแต่ละรายการ ข้อความบันทึกแรกคือ GMA Debug BEGIN
ข้อความบันทึกสุดท้ายคือ GMA Debug FINISH
และเนื้อหาบันทึกเครือข่ายจะเริ่มต้น
ด้วย GMA Debug CONTENT
หากเนื้อหาบันทึกเครือข่ายยาวเกินกว่าจะแสดงในบรรทัดเดียว
ระบบจะแบ่งเนื้อหาออกเป็นหลายบรรทัด โดยแต่ละบรรทัดจะขึ้นต้นด้วย GMA Debug CONTENT
เอาต์พุตตัวอย่าง
<Your App Name>[2710:30568] <Google> GMA Debug BEGIN
2017-12-06 09:47:09.268020-0800 <Your App Name>[2710:30568] <Google> GMA Debug CONTENT: {
"components" : [
"network_request_31107D12-E54E-45D6-AEA9-4A303C659EDF"
],
"timestamp" : 1512582429267.2629,
"event" : "onNetworkRequest",
"params" : {
"firstline" : {
"uri" : "<encoded text>",
"verb" : "<encoded text>"
},
"headers" : [
{
"name" : "<encoded text>",
"value" : "<encoded text>"
}
]
}
}
2017-12-06 09:47:09.275742-0800 <Your App Name>[2710:30568] <Google> GMA Debug FINISH
จากนั้น คุณสามารถส่งสำเนาบันทึกให้วิศวกร
ของเราเพื่อทำการวิเคราะห์ได้
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-09-02 UTC
[null,null,["อัปเดตล่าสุด 2025-09-02 UTC"],[[["\u003cp\u003eNetwork tracing provides insights into Google Mobile Ads SDK network activities, aiding in debugging your ad implementation.\u003c/p\u003e\n"],["\u003cp\u003eIt offers a debugging advantage over proxy tools by functioning on all iOS versions and devices without requiring third-party security certificate profiles.\u003c/p\u003e\n"],["\u003cp\u003eTo enable tracing, simply set the \u003ccode\u003eGADEnableNetworkTracing\u003c/code\u003e key to \u003ccode\u003eYES\u003c/code\u003e within your plist file.\u003c/p\u003e\n"],["\u003cp\u003eWhen enabled, the SDK logs network events to the console, which can be shared with Google engineers for analysis.\u003c/p\u003e\n"],["\u003cp\u003eConsole logs are easily identifiable, starting with \u003ccode\u003eGMA Debug BEGIN\u003c/code\u003e, \u003ccode\u003eGMA Debug CONTENT\u003c/code\u003e, or \u003ccode\u003eGMA Debug FINISH\u003c/code\u003e, allowing for efficient searching and filtering.\u003c/p\u003e\n"]]],[],null,["Select platform: [Android](/ad-manager/mobile-ads-sdk/android/network-tracing \"View this page for the Android platform docs.\") [iOS](/ad-manager/mobile-ads-sdk/ios/network-tracing \"View this page for the iOS platform docs.\")\n\n\u003cbr /\u003e\n\nNetwork tracing lets you see network activities relating to the\nGoogle Mobile Ads SDK. This can be useful in debugging your Google Mobile Ads\nimplementation.\n\nA key reason to use network tracing instead of tools such as [Charles\nProxy](//www.charlesproxy.com) is that it will work on **all** iOS versions and\ndevices without trusting any third party security certificate profiles. This is\nnot the case with proxying tools due [certificate profile\nrequirements](https://support.apple.com/en-nz/HT204477) in place since iOS 10.3.\n\nThis guide explains how to enable network tracing for debugging purposes.\n\nEnable tracing\n\nTo enable network tracing, set the `GADEnableNetworkTracing` key to `YES` in\nyour plist file.\n\nWhen network tracing is enabled, the Google Mobile Ads SDK logs network events\nto the console. You can then provide copies of the logs to our engineers for\nanalysis as a private reply on the [developer\nforum](//groups.google.com/forum/#!forum/google-admob-ads-sdk).\n\nLogging\n\nStandard platform-appropriate console logs are used to output the network logs.\n\nConsole log messages always begin with the string `GMA Debug BEGIN`,\n`GMA Debug CONTENT`, or `GMA Debug FINISH` so that it can be searched for or\nfiltered out. For each network log, the first log message is `GMA Debug BEGIN`,\nthe last log message is `GMA Debug FINISH`, and the network log content begins\nwith `GMA Debug CONTENT`. If a network log content is too long to fit on a line,\nit is split among multiple lines, each line beginning with `GMA Debug CONTENT`.\n\nSample output \n\n \u003cYour App Name\u003e[2710:30568] \u003cGoogle\u003e GMA Debug BEGIN\n 2017-12-06 09:47:09.268020-0800 \u003cYour App Name\u003e[2710:30568] \u003cGoogle\u003e GMA Debug CONTENT: {\n \"components\" : [\n \"network_request_31107D12-E54E-45D6-AEA9-4A303C659EDF\"\n ],\n \"timestamp\" : 1512582429267.2629,\n \"event\" : \"onNetworkRequest\",\n \"params\" : {\n \"firstline\" : {\n \"uri\" : \"\u003cencoded text\u003e\",\n \"verb\" : \"\u003cencoded text\u003e\"\n },\n \"headers\" : [\n {\n \"name\" : \"\u003cencoded text\u003e\",\n \"value\" : \"\u003cencoded text\u003e\"\n }\n ]\n }\n }\n 2017-12-06 09:47:09.275742-0800 \u003cYour App Name\u003e[2710:30568] \u003cGoogle\u003e GMA Debug FINISH\n\nYou can then [provide copies of the logs to our\nengineers](//groups.google.com/forum/#!forum/google-admob-ads-sdk) for analysis."]]