3

In my React-Native application I use branch.io to handle referrals. Deep links are generated successfully through the app and can be shared it to the others.

Issue is, if the receiver hasn't installed the app yet, once the dynamic link is received, after clicking on that, he will go to the appstore/playstore and install the app.

After the installation, I want to identify the sender of the deeplink. My subscribe to branch is like this.

BranchIO.subscribe(async ({ error, params }) => {
    if (error) {
      console.log('Error from Branch: ', error);
      return;
    }

    if (params['+non_branch_link']) return;

    if (!params['+clicked_branch_link']) return;

    if (params.$canonical_identifier === DeepLinkTypes.referral) {
      store.dispatch(setReferralKey(params.referralKey));
    }

    const lastParams = await BranchIO.getLatestReferringParams(); 
    const installParams = await BranchIO.getFirstReferringParams(); 

    console.log(lastParams);
    console.log(installParams);

    navigatePath(params.$deeplink_path);
  });

How should I access these params after a new install of the app? I mean, once the receiver clicks on the link and goes to playstore/appstore, does branch track this? Once the inatalled app is loaded, shall we access the relevant data through params?

Shashika Virajh
  • 8,497
  • 17
  • 59
  • 103

1 Answers1

1

Yes deferred deep linking is supported with Branch. For React Native you can read the parameters like this - \

branch.subscribe(({error, params, uri}) => {
if (error) {
console.error('Error from Branch: ' + error)
return
}

// params will never be null if error is null
})

let lastParams = await branch.getLatestReferringParams() // params from last open
let installParams = await branch.getFirstReferringParams() // params from original install

Make sure you get the params after calling branch.subsribe().Here is the documentation for the same - https://help.branch.io/developers-hub/docs/react-native#section-read-deep-link

Kartik Shandilya
  • 3,796
  • 5
  • 24
  • 42
  • But installParams doesn't contian the properties I set. Only the params has that. So if Im supposed to use installParams, how can I uniquely identify the sender without the properties I set? – Shashika Virajh Jun 04 '20 at 16:34