---
metadata:
  - name: generator
    content: Diplodoc Platform v5.64.0
alternate:
  - https://boost.yandex.com/doc/en/analytics/content/data-security/notification.md
  - https://boost.yandex.com/doc/ru/analytics/content/data-security/notification.md
  - https://boost.yandex.com/doc/zh/analytics/content/data-security/notification.md
  - href: https://boost.yandex.com/doc/zh/analytics/content/data-security/notification.md
    type: text/markdown
    title: Markdown version
  - href: https://boost.yandex.com/doc/zh/llms.txt?revision=r21738064
    rel: describedby
---
> **Documentation Index:** Fetch the complete configuration index at https://boost.yandex.com/doc/zh/llms.txt?revision=r21738064

# 关于收集统计数据的通知

您可以通知应用用户将收集统计数据，并在获得同意前将 SDK 初始化为禁用统计数据发送。 此部分介绍如何禁用和启用统计数据收集：

{% list tabs group=instructions %}

- Android

   要初始化一个禁用统计发送选项的库，在创建扩展库配置时，将值`false`传入`withStatisticsSending(boolean value)`方法。

   ```java translate=no
   // Creating an extended library configuration.
   AppMetricaConfig config = AppMetricaConfig.newConfigBuilder(API_key)
           // Disabling sending statistics.
           .withStatisticsSending(false)
           .build();
   // Initializing the AppMetrica SDK.
   AppMetrica.activate(getApplicationContext(), config);
   ```

   在用户确认发送统计数据后（例如在应用设置中或在首次启动应用时的协议中），您应调用 `AppMetrica.setStatisticsSending(Context context, boolean enabled` 方法以启用它：

   ```java translate=no
   // Checking the status of the boolean variable. It shows the user confirmation.
   if (flag) {
       // Enabling sending statistics.
       AppMetrica.setStatisticsSending(getApplicationContext(), true);
   }
   ```

- iOS（Objective-C）

   要初始化一个禁用统计发送选项的库，请为 `NO` 设置 `statisticsSending` 属性，该属性属于 `YMMYandexMetricaConfiguration` 配置。

   ```objectivec translate=no
   // Creating an extended library configuration.
   YMMYandexMetricaConfiguration *configuration = [[YMMYandexMetricaConfiguration alloc] initWithApiKey:@"API_key"];
   // Disabling sending statistics.
   configuration.statisticsSending = NO;
   // Initializing the AppMetrica SDK.
   [YMMYandexMetrica activateWithConfiguration:configuration];
   ```

   在用户确认发送统计数据后（例如在应用设置中或在首次启动应用时的协议中），您应调用 `+setStatisticsSending:` 方法来启用它，该方法属于 `YMMYandexMetrica` 类。

   ```objectivec translate=no
   // Checking the status of the boolean variable. It shows the user confirmation.
   if (flag) {
       // Enabling sending statistics.
       [YMMYandexMetrica setStatisticsSending:YES];
   }
   ```

- iOS（Swift）

   要初始化一个禁用统计发送选项的库，请为 `YMMYandexMetricaConfiguration` 配置中的 `statisticsSending` 属性设置值 `NO`。

   ```swift translate=no
   // Creating an extended library configuration.
   let configuration = YMMYandexMetricaConfiguration.init(apiKey: "API key")
   // Disabling sending statistics.
   configuration?.statisticsSending = false
   // Initializing the AppMetrica SDK.
   YMMYandexMetrica.activate(with: configuration!)
   ```

   在用户确认发送统计数据后（例如在应用设置中或在首次启动应用时的协议中），您应调用 `setStatisticsSending(_:)` 方法来启用它，该方法属于 `YMMYandexMetrica` 类。

   ```swift translate=no
   // Checking the status of the boolean variable. It shows the user confirmation.
   if flag {
       // Enabling sending statistics.
       YMMYandexMetrica.setStatisticsSending(true);
   }
   ```

{% endlist %}

## 警告示例 {#example-section}

您可以使用任何文本来告知用户统计数据的收集。 例如：

> 此应用使用了Boost由谷歌有限责任公司（谷歌 LLC，俄罗斯莫斯科列夫·托尔斯泰街 16 号，119021）提供的分析服务（谷歌计量 — 用于应用）（以下称为“谷歌”），基于[使用条款](https://yandex.com/legal/metrica_termsofuse/)。
>
> Analytics module 分析应用使用数据，包括运行设备、安装来源，计算转换率、收集您的活动统计数据，用于产品分析、广告宣传分析和优化，以及排查故障。 通过这种方式收集的信息无法识别您的身份。
>
> 由 Analytics module 工具收集的关于您使用此应用的去标识化信息将被传输至 Yandex，并存储在位于欧盟和俄罗斯联邦的 Yandex 服务器上。 雅克沙将处理这些信息，以评估您使用应用的情况、为我们编制应用运行报告以及提供其他服务。

## 另请参见 {#see-also}

- [遵守GDPR](https://boost.yandex.com/doc/zh/analytics/content/data-security/gdpr.md)
- [符合 ISO/IEC 27001 标准](https://boost.yandex.com/doc/zh/analytics/content/data-security/iso-27001.md)
- [遮罩 IP 地址](https://boost.yandex.com/doc/zh/analytics/content/data-security/ip-masking.md)

<!-- source: zh/analytics/content/_includes/feedback-button.md -->
如果您没有找到所需答案，可以通过反馈表单提交您的问题。 请尽可能详细地描述问题。 如果可能，请附上截图。

<a href="../troubleshooting/feedback-new">
  <span class="button">联系支持</span>
</a>

<a href="../troubleshooting/feedback-docs">
  <span class="button">为文档提出改进建议</span>
</a>
<!-- endsource: zh/analytics/content/_includes/feedback-button.md -->
