RodrigoSMarques / flutter_branch_sdk

Flutter Plugin for create deep link using Branch Metrics SDK. This plugin provides a cross-platform (iOS, Android, Web).
https://branch.io
MIT License
100 stars 91 forks source link

How can we call requestTrackingAuthorization() before initializing the SDK? #362

Closed vamsi-branch closed 2 months ago

vamsi-branch commented 3 months ago

Describe the bug Incorrect attribution occurs when both Apple Search Ads (ASA) and a non-SAN ad partner are used together. Apple always claims the first install event directly through a callout without using the PREM value. When a non-SAN ad partner is involved, the attribution is incorrectly assigned to Apple instead of the non-SAN partner, even when the ATT (App Tracking Transparency) prompt is accepted.

To Reproduce

  1. Ensure an Apple Search Ads campaign is running.
  2. Click on the non-SAN link.
  3. Install the app; notice that Apple claims the first install.
  4. Accept the ATT prompt.
  5. When the second install event is sent, it either upgrades or gets capped, and incorrect attribution to Apple still occurs.

Expected behavior When a non-SAN link is clicked and the ATT prompt is accepted, the attribution should go to the non-SAN partner, not Apple, even when ASA campaign is being run.

Mobile (Please complete the following information. remove session if not Mobile):

Proposed Fix To address the issue, we are considering the following:

  1. Initializing the Branch SDK only after the ATT prompt is shown and we receive the user's response (accepted or rejected).
  2. This approach should prevent ASA from hijacking the installs attributed to the non-SAN ad partner when both are active.

    ASKs ->

    1. In the Flutter SDK, the requestTrackingAuthorization (ATT prompt) is handled by the Branch SDK, so it can only be called after SDK initialization. How can we trigger it beforehand for the use case described?
  3. Is it possible to implement the ATT prompt at the iOS native layer within a Flutter app? How can we achieve this and ensure that the Flutter Branch SDK correctly receives the responses?
RodrigoSMarques commented 3 months ago

Describe the bug Incorrect attribution occurs when both Apple Search Ads (ASA) and a non-SAN ad partner are used together. Apple always claims the first install event directly through a callout without using the PREM value. When a non-SAN ad partner is involved, the attribution is incorrectly assigned to Apple instead of the non-SAN partner, even when the ATT (App Tracking Transparency) prompt is accepted.

To Reproduce

  1. Ensure an Apple Search Ads campaign is running.
  2. Click on the non-SAN link.
  3. Install the app; notice that Apple claims the first install.
  4. Accept the ATT prompt.
  5. When the second install event is sent, it either upgrades or gets capped, and incorrect attribution to Apple still occurs.

Expected behavior When a non-SAN link is clicked and the ATT prompt is accepted, the attribution should go to the non-SAN partner, not Apple, even when ASA campaign is being run.

Mobile (Please complete the following information. remove session if not Mobile):

  • flutter_branch_sdk version: 8.0.4
  • OS: iOS any version
  • Device: iPhone

Proposed Fix To address the issue, we are considering the following:

  1. Initializing the Branch SDK only after the ATT prompt is shown and we receive the user's response (accepted or rejected).
  2. This approach should prevent ASA from hijacking the installs attributed to the non-SAN ad partner when both are active.

It is not possible to delay the SDK initialization.

The plugin had this behavior in version 7.x.x and we had several issues opened due to this.

In version 8.x.x the initialization delay was removed again.

ASKs ->

  1. In the Flutter SDK, the requestTrackingAuthorization (ATT prompt) is handled by the Branch SDK, so it can only be called after SDK initialization. How can we trigger it beforehand for the use case described?
  2. Is it possible to implement the ATT prompt at the iOS native layer within a Flutter app? How can we achieve this and ensure that the Flutter Branch SDK correctly receives the responses?

The Branch SDK calls the requestTrackingAuthorization API on iOS using the Method Channel.

Any Fluter application can call any native API.

If you have knowledge of Swift, you can try to do this customization.

https://help.branch.io/developers-hub/docs/ios-advanced-features#tracking-att-opt-in-and-opt-out-prompt-responses

Have you checked the issues in the iOS repository to verify that this issue has not been reported?

RodrigoSMarques commented 2 months ago

Closed. No activity in the last 14 days. If necessary open again.