react-native-branch-deep-linking-attribution icon indicating copy to clipboard operation
react-native-branch-deep-linking-attribution copied to clipboard

On install onOpenComplete does not contain the deferred deep link data but firstParams does

Open jrobichaud opened this issue 4 years ago • 0 comments

Description

On first install, the deep link returned to onOpenComplete data looks like this:

{
  "error": null,
  "params": {
    "+clicked_branch_link": false,
    "+is_first_session": false,
    "+non_branch_link": "my_app://open?code=10cfe9be-df1b-4e94-b589-6d53f4b0966a&state=gHzglTN5tnn2KQD1YGz2puOiAsLPoXr9"
  },
  "uri": null
}

Instead of a non_branch_link I would expect the referring link along with the appropriate params.

However branch.getFirstReferringParams() returns the appropriate information:

{
  "$marketing_title": "Test deferred deep link",
  "$matching_ttl_s": 7200,
  "$one_time_use": false,
  "+click_timestamp": 1622740378,
  "+clicked_branch_link": true,
  "+is_first_session": false,
  "+match_guaranteed": false,
  "screen": "MyScreen",
  "~creation_source": 1,
  "~id": "927979957205127363",
  "~marketing": true,
  "~referring_link": "https://link.example.com/BAFAHHXjIgb"
}

It does that only on the first install only. It works properly if after I click on a link when the app is in background or killed. (on iOS it requires the javascript workaround of #651 when the app was killed)

Specifications

react-native-branch: 5.0.3

Plateforms: iOS and Android

Example

Let assume the following:

  • my_app as uri scheme
  • link.example.com as associated domain
  • we have the following code in our app:
branch.subscribe({
      onOpenComplete: async (res) => {
        console.log("Deep link onOpenComplete", res);

        const firstParams = await branch.getFirstReferringParams();
        const latestParams = await branch.getLatestReferringParams();
        console.log("firstParams", firstParams);
        console.log("latestParams", latestParams);
      },
    });
  }

We click on the a link of our associated domain: https://link.example.com/BAFAHHXjIgb (In this example at: Thu Jun 03 2021 13:13:47.812)

Install the app.

Launch the app.

Deep link onOpenComplete:

{
  "error": null,
  "params": {
    "+clicked_branch_link": false,
    "+is_first_session": false,
    "+non_branch_link": "my_app://open?code=10cfe9be-df1b-4e94-b589-6d53f4b0966a&state=gHzglTN5tnn2KQD1YGz2puOiAsLPoXr9"
  },
  "uri": null
}

firstParams:

{
  "$marketing_title": "Test deferred deep link",
  "$matching_ttl_s": 7200,
  "$one_time_use": false,
  "+click_timestamp": 1622740378,
  "+clicked_branch_link": true,
  "+is_first_session": false,
  "+match_guaranteed": false,
  "screen": "MyScreen",
  "~creation_source": 1,
  "~id": "927979957205127363",
  "~marketing": true,
  "~referring_link": "https://link.example.com/BAFAHHXjIgb"
}

latestParams:

{
  "+clicked_branch_link": false,
  "+is_first_session": false,
  "+non_branch_link": "my_app://open?code=10cfe9be-df1b-4e94-b589-6d53f4b0966a&state=gHzglTN5tnn2KQD1YGz2puOiAsLPoXr9"
}

Additional informations

  • I am having #651 as well but I think they are unrelated

jrobichaud avatar Jun 03 '21 19:06 jrobichaud