Branch.io (Android SDK): 'only initialize Branch in the Launcher activity' and GDPR

时光怂恿深爱的人放手 提交于 2019-12-02 09:04:15

From the same document that you linked above:

Enable / 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.

Branch.getInstance().disableTracking(true);

You can choose to call this throughout the lifecycle of the app. Once called, network requests will not be sent from the SDKs. Link generation will continue to work, but will not contain identifying information about the user. In addition, deep linking will continue to work, but will not track analytics for the user.

This should allow you to focus on the deep linking functionality without having to worry about user tracking, as you can add separate logic for disabling it. Also, Branch doesn't collect any PII (personally identifiable information) just because of you integrating the SDK. You would have to manually set user IDs and report user events through the Branch.io SDK.

Branch asks for the SDK to be initialized within the Launcher activity for a few different reasons:

  • App Links - when using App Links (native Android deep linking, supported on Android 6+), the deep link data is found within the intent that started the Launcher activity. In this scenario, unless you handle the intent manually, the data would no longer be accessible if you start another activity without initializing the Branch SDK first.
  • Branch analytics attribution - the intent that started the Launcher activity might contain data that indicates where the app was launched from (could be a push notification, Play Store listing, etc.)

If you are not using App Links, you can safely initialize the SDK in the MainActivity. Also, since you are not initializing it within the Launcher activity, it's probably a good idea to do it within the onCreate method of MainActivity, instead of onStart. This means you would only consume network data when the MainActivity is loaded the first time - backgrounding and foregrounding the app would not trigger it again. All of the deep links would trigger the Launcher activity anyway, which in turn would open MainActivity, at which point the SDK would be initialized from onCreate.

Jackie from Branch here.

As a rule of thumb, initializing the Branch SDK in the Launcher Activity is critical for attribution and is a mandatory step. Without this, the Branch SDK will not be able to report installs, opens or any other down the funnel events and hence you will not get any attribution data on the Branch dashboard.

That being said, in your case, I'd recommend setting Branch.trackingDisabled = YES at the beginning and then initializing Branch after. When a user opts in for tracking, Branch.trackingDisabled = NO will be called, and the Branch SDK will operate as normal. Installs will be missing for this approach unless the user opts in within the first app open.

If you have additional questions, please email directly at integrations@branch.io.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!