정확한 위치 데이터 정책

Google 게시자 정책이 최근 업데이트되면서 광고 관련 목적으로 사용자의 정확한 위치 데이터를 Google에 전달하는 게시자를 위한 새로운 알림 및 동의 요건이 도입되었습니다.

이 정책이 적용되는 경우 아래 스니펫은 사용자에게 이러한 데이터 공유에 관해 알릴 수 있는 한 가지 방법을 보여줍니다.

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 above function assuming you are in a view controller:
[self presentConsentOverlayFromViewController:self];