AMAAppMetricaReporting 协议

Instance methods

-清除应用环境

删除与所有未来事件相关的所有键值数据。

-暂停会话

暂停会话。

-reportAdRevenue:onFailure:

向 AppMetrica 服务器发送关于广告收入的信息。

-reportECommerce:onFailure

发送关于电商事件的消息。

-reportEvent:onFailure

发送自定义事件消息。

-reportEvent:parameters:onFailure

发送自定义事件消息,包含额外参数。

-reportRevenue:onFailure:

将购买信息发送到AppMetrica服务器。

-reportUserProfile:onFailure

发送关于用户资料更新的信息。

resumeSession

恢复会话,或在会话超时后创建新会话。

-sendEventsBuffer

从缓冲区发送已存储的事件。

-setAppEnvironmentValue:forKey:

设置与所有未来事件关联的键值对。

-setDataSendingEnabled:

启用/禁用向 AppMetrica 服务器发送统计数据。

-setupWebViewReporting:onFailure:

在指定的 webview 中为窗口添加一个名为 AppMetrica 的 JavaScript 接口。 这让你能从 JavaScript 代码发送客户端事件。

Properties

userProfileID

设置 用户资料 的 ID。

Method descriptions

-clearAppEnvironment

- (void)clearAppEnvironment;

清理应用环境,例如删除与所有未来事件相关的所有键值数据。

-pauseSession

- (void)pauseSession;

暂停用户会话。

-reportAdRevenue:onFailure:

- (void)reportAdRevenue:(AMAAdRevenueInfo *)adRevenue
              onFailure:(nullable void (^)(NSError *error))onFailure;

向AppMetrica服务器发送关于广告收入的信息。

参数:

广告收入

包含广告收入信息的 AMAAdRevenueInfo 类的实例。

onFailure

发生错误时执行的代码块。 错误作为块参数传递。

-reportECommerce:onFailure

- (void)reportECommerce:(AMAECommerce *)eCommerce
              onFailure:(nullable void (^)(NSError *error))onFailure;

发送关于电商事件的消息。

参数:

电子商务

The AMAECommerce 类实例。

onFailure

发生错误时执行的代码块。 错误作为块参数传递。

-reportEvent:onFailure

- (void)reportEvent:(NSString *)name
          onFailure:(nullable void (^)(NSError *error))onFailure;

发送自定义事件消息。

参数:

名称

事件的简短名称或描述。

onFailure

发生错误时执行的代码块。 错误作为块参数传递。

-reportEvent:parameters:onFailure

- (void)reportEvent:(NSString *)name
         parameters:(nullable NSDictionary *)params
          onFailure:(nullable void (^)(NSError *error))onFailure;

发送自定义事件消息,包含额外参数。

参数:

名称

事件的简短名称或描述。

params

参数以键值对形式。

onFailure

发生错误时执行的代码块。 错误作为块参数传递。

-reportRevenue:onFailure:

- (void)reportRevenue:(AMARevenueInfo *)revenueInfo
            onFailure:(nullable void (^)(NSError *error))onFailure;

将购买信息发送到AppMetrica服务器。

参数:

收入信息

包含购买信息的 AMARevenueInfo 类的实例。

onFailure

发生错误时执行的代码块。 错误作为块参数传递。

-reportUserProfile:onFailure

- (void)reportUserProfile:(AMAUserProfile *)userProfile
                onFailure:(nullable void (^)(NSError *error))onFailure;

将用户个人资料更新信息发送到AppMetrica服务器。

参数:

用户个人资料

包含用户个人信息的 AMAUserProfile 类的实例。

onFailure

当发生错误时执行的代码块。 错误作为块参数传递。

-resumeSession

- (void)resumeSession;

恢复会话,如果会话超时则创建新会话。

-sendEventsBuffer

- (void)sendEventsBuffer;

从缓冲区发送已存储的事件。

AppMetrica SDK 不会在事件发生后立即发送事件。 库存放事件数据在缓冲区中。 方法 +sendEventsBuffer 会从缓冲区发送数据并清空缓冲区。 使用该方法在用户场景的重要检查点之后强制发送已存储的事件。

注意

频繁使用该方法可能会导致出去的互联网流量和能耗增加。

-setAppEnvironmentValue:forKey:

- (void)setAppEnvironmentValue:(nullable NSString *)value
                        forKey:(NSString *)key;

设置键值数据,作为与所有未来事件相关的附加信息使用。

如果值为零,之前设置的键值将被删除。 如果没有添加密钥,就不会执行任何操作。

参数:

value

Value.

key

Key.

-setDataSendingEnabled:

- (void)setDataSendingEnabled:(BOOL)enabled;

启用/禁用向 AppMetrica 服务器发送统计数据。

备注

禁用向报告者发送统计数据不会影响从主API密钥发送数据。 但禁用主 API 密钥的数据发送会停止所有报告器发送统计数据。

参数:

已启用

一个标志,表示已启用发送统计数据。 默认值是是。
可能的值:

  • 是:已启用发送统计数据。
  • 无:已禁用发送统计数据。

-setupWebViewReporting:onFailure:

- (void)setupWebViewReporting:(id<AMAJSControlling>)controller
                    onFailure:(nullable void (^)(NSError *error))onFailure;

在指定的 webview 中添加一个名为 AppMetrica 的 JavaScript 接口。 这让你能从 JavaScript 代码发送客户端事件。

Notes:

  • 该方法必须从主队列调用。
  • 该方法在 tvOS 上不可用。
  • 在加载任何内容之前调用此方法。 我们建议在创建 webview 以及向 WKUserContentController 添加脚本之前调用此方法。
    要了解更多信息,请参见使用示例。

参数:

controller

The AMAJSControlling 实例。

onFailure

在发生错误时会被调用的回调方法。

Property descriptions

userProfileID

@property (class, nonatomic, nullable) NSString *userProfileID;

设置 用户资料 的 ID。 AppMetrica 在网页界面中不会显示 预定义属性,如果未配置 ProfieId 的发送。