Để 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.
Thay đổi gần đây về Các chính sách dành cho nhà xuất bản của Google
đã đặt ra yêu cầu mới về việc thông báo và lấy sự đồng ý cho những nhà xuất bản chuyển dữ liệu vị trí chính xác của người dùng đến Google cho các mục đích liên quan đến quảng cáo.
Nếu bạn phải tuân thủ chính sách này, thì đoạn mã sau đây là một cách để bạn có thể thông báo cho người dùng biết về hoạt động chia sẻ dữ liệu này:
Swift
funcpresentConsentOverlayFromViewController(_rootViewController:UIViewController){if(rootViewController==nil){return;}DispatchQueue.main.async{letalert=UIAlertController(title:"Location data",message:""" We may use your location, and share it with third parties, for the purposes of personalized advertising, analytics, and attribution. To learn more, visit our privacy policy at https://myapp.com/privacy. """,preferredStyle:.alert)letalertAction=UIAlertAction(title:"OK",style:.default,handler:{_in// TODO: replace the below log statement with code that specifies how// you want to handle the user's acknowledgement.print("Got consent.")})alert.addAction(alertAction)rootViewController.present(alert,animated:true,completion:nil)}}// To use the above function assuming you are in a view controller:presentConsentOverlayFromViewController(self)
Objective-C
-(void)presentConsentOverlayFromViewController:(UIViewController*)rootViewController{if(rootViewController==nil){return;}dispatch_async(dispatch_get_main_queue(),^{UIAlertController*alert=[UIAlertControlleralertControllerWithTitle:@"Location data"message:@"We may use your location, and share it with third parties,"@"for the purposes of personalized advertising, analytics, and attribution."@"To learn more, visit our privacy policy at https://myapp.com/privacy."preferredStyle:UIAlertControllerStyleAlert];UIAlertAction*ok=[UIAlertActionactionWithTitle:@"OK"style:UIAlertActionStyleDefaulthandler:^(UIAlertAction*action){[alertdismissViewControllerAnimated:YEScompletion:^{// TODO: replace the below log statement with code that specifies// how you want to handle the user's acknowledgement.NSLog(@"Got consent.");}];}];[alertaddAction:ok];[rootViewControllerpresentViewController:alertanimated:YEScompletion:nil];});}// To use the previous function assuming you are in a view controller:[selfpresentConsentOverlayFromViewController:self];
[null,null,["Cập nhật lần gần đây nhất: 2025-08-27 UTC."],[[["\u003cp\u003eGoogle Publisher Policies now require publishers to obtain user consent before sharing precise location data for ads.\u003c/p\u003e\n"],["\u003cp\u003ePublishers need to clearly inform users about how their location data is being used and shared with third parties.\u003c/p\u003e\n"],["\u003cp\u003eThe provided code snippets (Swift and Objective-C) offer examples of how to create a consent overlay for iOS apps.\u003c/p\u003e\n"],["\u003cp\u003eIt's crucial to customize the consent message to accurately reflect your data sharing practices.\u003c/p\u003e\n"]]],["Google Publisher Policies now require publishers to notify users and obtain consent before sharing precise location data for ad-related purposes. The provided code examples (Swift and Objective-C) demonstrate presenting an alert to users, informing them that their location might be used and shared for personalized advertising, analytics, and attribution. Users can acknowledge this information by selecting 'OK'. Publishers should customize the alert to match their data practices and replace the example handling with their chosen method.\n"],null,["# Precise location data policy\n\nSelect platform: [Android](/ad-manager/mobile-ads-sdk/android/privacy/precise-location \"View this page for the Android platform docs.\") [iOS](/ad-manager/mobile-ads-sdk/ios/privacy/precise-location \"View this page for the iOS platform docs.\")\n\n\u003cbr /\u003e\n\nRecent updates to the [Google Publisher\nPolicies](//support.google.com/adsense/answer/9335564#use_of_device_and_location_data)\nhave introduced new notice and consent requirements for publishers who pass\nprecise location data of users to Google, for ads-related purposes.\n\nIf this policy applies to you, the following snippet shows one way you could\ninform your users of this data sharing: \n\n### Swift\n\n```swift\nfunc presentConsentOverlayFromViewController(_ rootViewController: UIViewController) {\n if (rootViewController == nil) {\n return;\n }\n\n DispatchQueue.main.async {\n let alert = UIAlertController(title: \"Location data\",\n message: \"\"\"\n We may use your location, and share it with third parties,\n for the purposes of personalized advertising, analytics,\n and attribution.\n To learn more, visit our privacy policy at https://myapp.com/privacy.\n \"\"\",\n preferredStyle: .alert)\n let alertAction = UIAlertAction(title: \"OK\",\n style: .default,\n handler: { _ in\n // TODO: replace the below log statement with code that specifies how\n // you want to handle the user's acknowledgement.\n print(\"Got consent.\")\n }\n )\n alert.addAction(alertAction)\n rootViewController.present(alert, animated: true, completion: nil)\n }\n}\n\n// To use the above function assuming you are in a view controller:\npresentConsentOverlayFromViewController(self)\n```\n\n### Objective-C\n\n```objective-c\n- (void)presentConsentOverlayFromViewController:(UIViewController *)rootViewController {\n if (rootViewController == nil) {\n return;\n }\n\n dispatch_async(dispatch_get_main_queue(), ^{\n UIAlertController *alert = [UIAlertController\n alertControllerWithTitle:@\"Location data\"\n message: @\"We may use your location, and share it with third parties,\"\n @\"for the purposes of personalized advertising, analytics, and attribution.\"\n @\"To learn more, visit our privacy policy at https://myapp.com/privacy.\"\n preferredStyle:UIAlertControllerStyleAlert];\n UIAlertAction *ok = [UIAlertAction\n actionWithTitle:@\"OK\"\n style:UIAlertActionStyleDefault\n handler:^(UIAlertAction *action) {\n [alert dismissViewControllerAnimated:YES completion:^{\n // TODO: replace the below log statement with code that specifies\n // how you want to handle the user's acknowledgement.\n NSLog(@\"Got consent.\");\n }];\n }];\n\n [alert addAction:ok];\n [rootViewController presentViewController:alert animated:YES completion:nil];\n });\n}\n\n// To use the previous function assuming you are in a view controller:\n[self presentConsentOverlayFromViewController:self];\n```\n| **Key Point:** This snippet is only an example. Make sure to customize the snippet to accurately reflect your data sharing practices, so users are informed of all the relevant purposes for which you share their precise location data."]]