Roku 高级功能

识别用户

与其他 Branch SDK 一样,您可以使用自己的用户标识符来简化会话和转化事件的追踪。

m.branchSdkObj.SetIdentity("YOUR_USER_ID_HERE", "OnSetIdentityCallbackFunc")

You can see an example of this code here.

事件追踪

要记录标准的 Branch 事件,例如 purchase,可以调用以下命令:

m.branchSdkObj.logEvent(BranchSdkConstants().EVENT_TYPE.PURCHASE, "Example customer_event_alias", "transaction_id", "USD", 99.99, "OnLogEventPurchaseCallbackFunc")

You can see an example of this code here.

NOTE: Refer to 'Branch SDK Standard Event List' section in the BranchSdkLibrary.brs file for all available predefined EVENT_TYPE values.

您还可以通过调用以下命令来记录自定义事件:

m.branchSdkObj.logEvent("Example Custom Event Name", "", "", "USD", 0, "OnLogEventCustomCallbackFunc")

You can see an example of this code here

预安装追踪

如果您的应用已预先安装在 Roku 设备上,则对于分发到 Roku 的构建,您应调用以下方法。

更换 MyCampaign with any string, which will then appear in the Branch Dashboard under the variable "campaign" (last_attributed_touch_data_tilde_campaign).

更换 MyPartner with a $3p value, which will then appear in the Branch Dashboard under the variable "$3p" (last_attributed_touch_data_dollar_3p). Most likely you will keep this blank for Roku. You can email [email protected] to discuss further.

m.branchSdkObj.setPreinstalldata("MyCampaign", "MyPartner")

You can see an example of this code here.

注销用户

如果当前用户注销了您的应用,您可以通过调用注销来通知 Branch。

m.branchSdkObj.logout("OnLogoutCallbackFunc")

You can see an example of this code here.

启用或禁用用户追踪

如果您需要按照 GDPR 的目的遵循用户不被追踪的请求,或者认为用户不应该被追踪,请利用此字段来防止 Branch 发送网络请求。此设置也可以在所有用户的特定链接或 Branch Link 中被启用。

m.branchSdkObj.disableTracking(true)

这个页面对您有帮助吗?