การรองรับ IDFA (iOS เท่านั้น)
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เลือกแพลตฟอร์ม:
iOS
Flutter
SDK สำหรับ User Messaging Platform (UMP) ช่วยให้คุณแสดงข้อความ IDFA ต่อผู้ใช้ก่อนที่จะขอความยินยอมสำหรับความโปร่งใสในการติดตามแอป (ATT) ข้อความ IDFA จะแสดงให้ผู้ใช้เห็นว่าแอปของคุณใช้ตัวระบุอย่างไร
คู่มือนี้ครอบคลุมการใช้ UMP SDK เพื่อแสดงข้อความ IDFA
ข้อกำหนดเบื้องต้น
โปรดตรวจสอบว่าคุณได้ทำสิ่งต่อไปนี้แล้วก่อนที่จะเริ่มต้น
อัปเดต Info.plist
หากต้องการแสดงข้อความแจ้งเตือนที่กำหนดเอง ให้ทำดังนี้
- เปิดไฟล์
Info.plist
- เพิ่มคีย์
NSUserTrackingUsageDescription
พร้อมข้อความที่กำหนดเองซึ่ง
อธิบายการใช้งาน
<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalized ads to you.</string>
คำอธิบายการใช้งานจะปรากฏเป็นส่วนหนึ่งของการแจ้งเตือน ATT สำหรับ IDFA เมื่อคุณแสดง
แบบฟอร์มความยินยอม

จากนั้นลิงก์เฟรมเวิร์ก AppTrackingTransparency
ดังนี้

จากนั้นแอปจะแสดงข้อความ IDFA ก่อนการแจ้งเตือน ATT
การทดสอบ
ขณะทดสอบ โปรดทราบว่าการแจ้งเตือน ATT จะปรากฏเพียงครั้งเดียวเนื่องจาก
requestTrackingAuthorization
เป็นคำขอแบบครั้งเดียว UMP SDK จะมีแบบฟอร์มให้โหลดก็ต่อเมื่อ
สถานะการให้สิทธิ์เป็น
ATTrackingManagerAuthorizationStatusNotDetermined
หากต้องการให้การแจ้งเตือนปรากฏขึ้นเป็นครั้งที่ 2 คุณต้องถอนการติดตั้งและติดตั้งแอปอีกครั้งในอุปกรณ์ทดสอบ
ขอโฆษณาที่มีหรือไม่มี IDFA
หากผู้ใช้ปฏิเสธ ATT ให้ขอโฆษณาต่อไปโดยใช้ API ของรูปแบบโฆษณา
SDK โฆษณาในอุปกรณ์เคลื่อนที่ของ Google ไม่ได้ส่ง IDFA ในคำขอโฆษณา ดูรายละเอียดเพิ่มเติมได้ที่หัวข้อ
เลือกรูปแบบโฆษณา
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-09-02 UTC
[null,null,["อัปเดตล่าสุด 2025-09-02 UTC"],[[["\u003cp\u003eThis guide provides steps to integrate the IDFA message within the User Messaging Platform (UMP) SDK for iOS apps, specifically focusing on Apple's App Tracking Transparency (ATT) framework.\u003c/p\u003e\n"],["\u003cp\u003eBefore proceeding, ensure you have completed the UMP SDK setup and created an IDFA message in AdMob.\u003c/p\u003e\n"],["\u003cp\u003eUpdate your app's \u003ccode\u003eInfo.plist\u003c/code\u003e file by adding the \u003ccode\u003eNSUserTrackingUsageDescription\u003c/code\u003e key with a clear explanation of how you will use the IDFA, and link the \u003ccode\u003eAppTrackingTransparency\u003c/code\u003e framework for the UMP SDK to manage the ATT dialog.\u003c/p\u003e\n"],["\u003cp\u003eDuring testing, note that the IDFA ATT dialog appears only once per app installation; to retest, uninstall and reinstall the app on your device.\u003c/p\u003e\n"]]],["To support the IDFA message with the UMP SDK, create and publish an IDFA explainer message in the AdMob UI. Update the `Info.plist` file by adding the `NSUserTrackingUsageDescription` key with a custom message. Link the `AppTrackingTransparency` framework. Remember, the IDFA ATT dialog appears only once unless the app is reinstalled. The UMP SDK can load a form only if the authorization status is `ATTrackingManagerAuthorizationStatusNotDetermined`.\n"],null,["Select platform: [iOS](/admob/ios/privacy/idfa \"View this page for the iOS platform docs.\") [Flutter](/admob/flutter/privacy/idfa \"View this page for the Flutter platform docs.\")\n\n\u003cbr /\u003e\n\nThe User Messaging Platform (UMP) SDK lets you present an\n\n[IDFA message](//support.google.com/admob/answer/10115027)\n\nto your users before requesting their consent for\n[App Tracking Transparency](//developer.apple.com/documentation/apptrackingtransparency)\n(ATT). The IDFA message shows your users how your app uses the identifier.\n\nThis guide covers using the UMP SDK to present an IDFA message.\n| **Note:** If you enable both GDPR and IDFA messages, refer to [Which message your users will\n| see](//support.google.com/admob/answer/10114020#which-message-your-users-will-see) for the possible outcomes.\n\nPrerequisites\n\nBefore you begin, make sure you've done the following:\n\n- Complete the [Get started guide](/admob/flutter/privacy).\n- [Create an IDFA message](//support.google.com/admob/answer/10115331) in the AdMob UI.\n\nUpdate Info.plist\n\nTo show a custom alert message, do the following:\n\n1. Open the `Info.plist` file.\n2. Add the `NSUserTrackingUsageDescription` key with a custom message that describes the usage:\n\n \u003ckey\u003eNSUserTrackingUsageDescription\u003c/key\u003e\n \u003cstring\u003eThis identifier will be used to deliver personalized ads to you.\u003c/string\u003e\n\nThe usage description appears as part of the IDFA ATT alert when you present the\nconsent form:\n\nThen, link the `AppTrackingTransparency` framework:\n\nYour app then shows an IDFA message before the ATT alert.\n\nTesting\n\nWhile testing, remember that the ATT alert only appears a single time since\n[`requestTrackingAuthorization`](//developer.apple.com/documentation/apptrackingtransparency/attrackingmanager/3547037-requesttrackingauthorization)\nis a one-time request. The UMP SDK only has a form available to load if the\nauthorization status is\n[`ATTrackingManagerAuthorizationStatusNotDetermined`](//developer.apple.com/documentation/apptrackingtransparency/attrackingmanagerauthorizationstatus/attrackingmanagerauthorizationstatusnotdetermined?language=objc).\n\nTo make the alert appear a second time, you must uninstall and reinstall your\napp on your test device.\n\nRequest ads with or without IDFA\n\nIf a user denies ATT, continue to request ads using your ad format's APIs. The\nGoogle Mobile Ads SDK doesn't send IDFA in the ad request. For more details see,\n[Select an ad format](/admob/flutter/quick-start#select_an_ad_format)."]]