Precise location data policy

Select platform: Android iOS

Recent updates to the Google Publisher Policies have introduced new notice and consent requirements for publishers who pass precise location data of users to Google, for ads-related purposes.

If this policy applies to you, the following snippet shows one way you could inform your users of this data sharing:

Swift

 func 
  
 presentConsentOverlayFromViewController 
 ( 
 _ 
  
 rootViewController 
 : 
  
 UIViewController 
 ) 
  
 { 
  
 if 
  
 ( 
 rootViewController 
  
 == 
  
 nil 
 ) 
  
 { 
  
 return 
 ; 
  
 } 
  
 DispatchQueue 
 . 
 main 
 . 
 async 
  
 { 
  
 let 
  
 alert 
  
 = 
  
 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 
 ) 
  
 let 
  
 alertAction 
  
 = 
  
 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 
  
 = 
  
 [ 
 UIAlertController 
  
 alertControllerWithTitle 
 : 
 @"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 
  
 = 
  
 [ 
 UIAlertAction 
  
 actionWithTitle 
 : 
 @"OK" 
  
 style 
 : 
 UIAlertActionStyleDefault 
  
 handler 
 : 
 ^ 
 ( 
 UIAlertAction 
  
 * 
 action 
 ) 
  
 { 
  
 [ 
 alert 
  
 dismissViewControllerAnimated 
 : 
 YES 
  
 completion 
 :^ 
 { 
  
 // TODO: replace the below log statement with code that specifies 
  
 // how you want to handle the user's acknowledgement. 
  
 NSLog 
 ( 
 @"Got consent." 
 ); 
  
 }]; 
  
 }]; 
  
 [ 
 alert 
  
 addAction 
 : 
 ok 
 ]; 
  
 [ 
 rootViewController 
  
 presentViewController 
 : 
 alert 
  
 animated 
 : 
 YES 
  
 completion 
 : 
 nil 
 ]; 
  
 }); 
 } 
 // To use the previous function assuming you are in a view controller: 
 [ 
 self 
  
 presentConsentOverlayFromViewController 
 : 
 self 
 ]; 
Design a Mobile Site
View Site in Mobile | Classic
Share by: