Hỗ trợ về Giá trị nhận dạng cho nhà quảng cáo (IDFA)
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Chọn nền tảng:
iOS
Flutter
SDK Nền tảng gửi thông báo cho người dùng (UMP) cho phép bạn trình bày một thông báo về IDFA cho người dùng trước khi yêu cầu họ đồng ý với Minh bạch về việc theo dõi ứng dụng (ATT). Thông báo IDFA cho người dùng biết cách ứng dụng của bạn sử dụng mã nhận dạng.
Hướng dẫn này trình bày cách sử dụng UMP SDK để trình bày thông báo về IDFA.
Điều kiện tiên quyết
Trước khi bắt đầu, hãy đảm bảo bạn đã thực hiện những việc sau:
Cập nhật tệp Info.plist
Để hiện thông báo cảnh báo tuỳ chỉnh, hãy làm như sau:
- Mở tệp
Info.plist
.
- Thêm khoá
NSUserTrackingUsageDescription
cùng với một thông báo tuỳ chỉnh mô tả việc sử dụng:
<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalized ads to you.</string>
Nội dung mô tả việc sử dụng sẽ xuất hiện trong cảnh báo ATT của IDFA khi bạn hiển thị biểu mẫu lấy sự đồng ý:

Sau đó, hãy liên kết khung AppTrackingTransparency
:

Sau đó, ứng dụng của bạn sẽ hiển thị một thông báo về IDFA trước cảnh báo ATT.
Thử nghiệm
Trong quá trình thử nghiệm, xin lưu ý rằng cảnh báo ATT chỉ xuất hiện một lần vì requestTrackingAuthorization
là yêu cầu một lần. SDK UMP chỉ có một biểu mẫu để tải nếu trạng thái uỷ quyền là ATTrackingManagerAuthorizationStatusNotDetermined
.
Để cảnh báo này xuất hiện lần thứ hai, bạn phải gỡ cài đặt rồi cài đặt lại ứng dụng của mình trên thiết bị thử nghiệm.
Yêu cầu quảng cáo có hoặc không có IDFA
Nếu người dùng từ chối ATT, hãy tiếp tục yêu cầu quảng cáo bằng API của định dạng quảng cáo. SDK quảng cáo trên thiết bị di động của Google không gửi IDFA trong yêu cầu quảng cáo. Để biết thêm thông tin chi tiết, hãy xem phần Chọn một định dạng quảng cáo.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-09-02 UTC.
[[["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-02 UTC."],[[["\u003cp\u003eThis guide provides steps to integrate the IDFA message within the User Messaging Platform (UMP) SDK for iOS apps.\u003c/p\u003e\n"],["\u003cp\u003eBefore proceeding, complete the UMP SDK setup and create an IDFA message in AdMob.\u003c/p\u003e\n"],["\u003cp\u003eUpdate your app's \u003ccode\u003eInfo.plist\u003c/code\u003e with \u003ccode\u003eNSUserTrackingUsageDescription\u003c/code\u003e to present a custom message within Apple's App Tracking Transparency dialog.\u003c/p\u003e\n"],["\u003cp\u003eRemember to link the \u003ccode\u003eAppTrackingTransparency\u003c/code\u003e framework to display the IDFA explainer message before the ATT dialog.\u003c/p\u003e\n"],["\u003cp\u003eFor testing, reinstall the app to reset the IDFA authorization status and see the dialog again.\u003c/p\u003e\n"]]],["To support the IDFA message with the UMP SDK, complete the \"Get started\" guide and create an IDFA message. Update the `Info.plist` by adding the `NSUserTrackingUsageDescription` key with a custom message. Link the `AppTrackingTransparency` framework. During testing, note that the IDFA ATT dialog only appears once unless the app is reinstalled, due to `requestTrackingAuthorization` being a one-time request and the status needs to be `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/ios/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/ios/quick-start#select_an_ad_format)."]]