Правила в отношении данных о точном местоположении

Если вы передаете Google данные о точном местоположении пользователей, то в соответствии с правилами Google для издателей вы должны соблюдать требования к запросу согласия и показывать уведомление.

Если это правило относится к вам, то в примере ниже показано, как задать заголовок, сообщение и текст кнопки, чтобы сообщить пользователям о передаче данных:

Swift

func presentConsentOverlayFromViewController(_ rootViewController: UIViewController) {
  if (rootViewController == nil) {
    return;
  }

  DispatchQueue.main.async {
    let alert = UIAlertController(title: "TITLE",
        message: "MESSAGE_TEXT",
        preferredStyle: .alert)
    let alertAction = UIAlertAction(title: "BUTTON_TEXT",
        style: .default,
        handler: { _ in
          print("CONSENT_RECEIVED_LOG_MESSAGE")
        }
    )
    alert.addAction(alertAction)
    rootViewController.present(alert, animated: true, completion: nil)
  }
}

// To use the previous function, and if you are in a view controller, call:
presentConsentOverlayFromViewController(self)

Objective-C

- (void)presentConsentOverlayFromViewController:(UIViewController *)rootViewController {
  if (rootViewController == nil) {
    return;
  }

  dispatch_async(dispatch_get_main_queue(), ^{
      UIAlertController *alert = [UIAlertController
          alertControllerWithTitle:@"TITLE"
          message: @"MESSAGE_TEXT"
          preferredStyle:UIAlertControllerStyleAlert];
      UIAlertAction *ok = [UIAlertAction
          actionWithTitle:@"BUTTON_TEXT"
          style:UIAlertActionStyleDefault
          handler:^(UIAlertAction *action) {
            [alert dismissViewControllerAnimated:YES completion:^{
            NSLog(@"CONSENT_RECEIVED_LOG_MESSAGE");
            }];
          }];

      [alert addAction:ok];
      [rootViewController presentViewController:alert animated:YES completion:nil];
  });
}

// To use the previous function, and if you are in a view controller, call:
[self presentConsentOverlayFromViewController:self];

Замените следующее:

  • TITLE – заголовок диалогового окна для получения согласия пользователей, например Location data.
  • MESSAGE_TEXT – текст диалогового окна для получения согласия, например:

    We may use your location and share with third parties for the
    purposes of personalized advertising, analytics, and attributions. To learn
    more, visit our privacy policy at example.com.
    
  • BUTTON_TEXT – текст кнопки в диалоговом окне для получения согласия пользователей, например OK.

  • CONSENT_RECEIVED_LOG_MESSAGE – сообщение в журнале, которое записывается, когда пользователь дает согласие, например Consent received.