Receive Smart Links on React Native

GetSocial Smart Links combine two types of mobile app linking:

  • Deep Linking provides a way to direct the user to a specific location within a mobile app rather than simply launching the app.
  • Deferred Deep Linking that allows users to deep link to content even if the app is not already installed.

Each Smart Link has associated referral data, which you can retrieve on the receiver side. This data consists of parameters you specify during link creation and additional metadata added by GetSocial.

Prerequisite

Dashboard Configuration

To set up deep linking follow the next steps:

  1. Login to the GetSocial Dashboard.
  2. Go to the App setting section.
  3. Ensure that Package name and Signing-certificate fingerprint fields matches the app you are integrating:

    GetSocial Dashboard - Android Package Name Configuration

  4. Ensure that Bundle ID, Team ID and App Store ID are filled and matches the app you are integrating:

    GetSocial Dashboard - iOS Apple App Id Configuration

Setup Deep Linking

Android

GetSocial Gradle Plugin configures everything automatically. If you’re not using plugin read how to configure deep linking manually.

iOS

iOS Installer Script configures everything automatically. If you’re not using the script read how to configure deep linking manually.

Retrieve Referral Data

Returned referral data contains:

  1. Predefined link params and custom key-value pairs added during link creation, or as URL query parameter overrides.
  2. Metadata added by GetSocial, e.g., channel, referrer user, whether we guarantee attribution, etc.

For a full list of available properties check the Smart Link params reference and API Reference.

You can retrieve referral data attached to the Smart Link when:

  • The app is launched for a first time after being installed by clicking on the GetSocial Smart Link.
  • The app was opened by clicking on the GetSocial Smart Link.

The code below show how to do it:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
GetSocial.getReferralData().then((referralData) => {
    if (referralData == null) {
        console.log('Referral data', 'No referral data found.');
    } else {
        const navigationPath = referralData.linkParams['$custom_path']; // predefined key
        const customValue1 = referralData.linkParams['custom_key_1']; // custom key
        const isGuaranteedMatch = referralData.isGuaranteedMatch; // added metadata

        console.log('Referral data', 'App started with referral data: ' + JSON.stringify(referralData));
    }
    }, (errorMessage) => {
        console.log('Failed to retrieve referral data', errorMessage);
    });

Validate Setup

Android Setup Validation

  1. Create a Smart Link from the Dashboard or send a Smart Invite.
  2. Click on the link on your phone, your app should be opened.

    Make sure to run this test on the device with Android 6+ and Android below 6, as we use different deep linking mechanics on pre-Android 6 devices.

    Smart Invite via Twitter with Custom Subdomain

  3. Additionally on Android 6+ devices, go to App info -> Open by default, supported deep linking domains should be listed in Supported links section:

    Supported links section

iOS Setup Validation

  1. Open Xcode project.
  2. To validate Universal Links setup. Go to Capabilities and validate Associated Domain section:

    Xcode - Capabilities Tab

    • applinks: domains should be added
    • All steps should be checked. If needed, go to developer.apple.com to enable “Associated Domains” for your App ID.
  3. To validate Custom Scheme setup for Deep linking on iOS 8. Open Info.plist file. Check if GetSocial URL schemes added:

Xcode - Info.plist

Whitelist Test Devices

To get the install attribution on every install you have to whitelist your testing devices on the GetSocial Dashboard.
For more information check Whitelist Test Devices.

Troubleshooting

App is not opened after click on the GetSocial Smart Link

Option 1. Outdated provisioning profiles after enabling “Associated Domains” for your App ID. To solve it, just download the latest provisioning profiles from Xcode settings or developer.apple.com.

Option 2. Universal links do not work with wildcard app identifiers (i.e. im.getsocial.*). You have to create a new specific app identifier and new provisioning profile for your app.

Option 3. New app.entitlements in not included in the correct build target. To solve the problem, include app.entitlements into the desired build target.

Next Steps

Give us your feedback! Was this article helpful?

😀 🙁