Roku Advanced Features

Identifying Users

As with other Branch SDKs, you can use your own user identifiers to make session and conversion event tracking easier.

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

You can see an example of this code here.

Event Tracking

To log standard Branch events, such as purchases, you can invoke the following:

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.

You can also log custom events by invoking the following:

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

You can see an example of this code here

Preinstall Tracking

If your app is preinstalled on Roku devices, for builds distributed to Roku, you should invoke the following method.

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

Replace 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.

Logging Out Users

If the current user logs out of your app, you can notify Branch of this by invoking logout.

m.branchSdkObj.logout("OnLogoutCallbackFunc")

You can see an example of this code here.

Enable or Disable User Tracking

If you need to comply with a user's request to not be tracked for GDPR purposes, or otherwise determine that a user should not be tracked, utilize this field to prevent Branch from sending network requests. This setting can also be enabled across all users for a particular link, or across your Branch links.

m.branchSdkObj.disableTracking(true)

Updated 7 months ago


Roku Advanced Features


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.