Overview

React Native SDK for deferred deep linking by Smler. Supports Android Install Referrer, iOS clipboard deep links, probabilistic matching, webhooks, and full TypeScript types.


The @smler/deferred-link package is a lightweight React Native SDK for deferred deep linking and install attribution. It works on both Android and iOS with full TypeScript support and does not require any heavy third-party attribution SDKs.

What Is Deferred Deep Linking?

Deferred deep linking allows a user to click a link, install your app from the store, and still land on the exact screen that the link pointed to — even though the app was not installed when they clicked.

The Flow

  1. A user clicks a Smler short link (e.g. https://go.yourdomain.com/abc123).

  2. Since the app is not installed, the link opens in the browser.

  3. The browser detects the platform and redirects to the appropriate store:

    • Android → Google Play Store (with a referrer parameter)

    • iOS → Apple App Store (after copying the link to the clipboard)

  4. The user installs the app and opens it.

  5. On first launch, the SDK reads the deferred deep link parameters and your app navigates to the correct screen.

Platform-Specific Approaches

Platform

Method

How It Works

Android

Google Play Install Referrer API

Reads the referrer parameter from the Play Store URL. The referrer is a URL-encoded string that can contain UTM parameters, short codes, click IDs, or any custom data.

iOS

Clipboard Deep Link Detection

Reads the clipboard on first app launch and matches the text against allowed URL patterns. Works even under iCloud Private Relay since it does not rely on IP-based tracking.

ios

Probabilistic Matching (Fallback)

Analyzes device fingerprint data (manufacturer, model, OS) and matches it against recent click records. Useful when clipboard matching fails on iOS.

Features

  • Android Install Referrer — Read, parse, and extract data from Google Play's referrer string

  • iOS Clipboard Deep Links — Detect deep links with flexible URL pattern matching (wildcards, subdomains, path prefixes)

  • Deep Link Resolution — Resolve Smler short links to get the original URL, domain, short code, and campaign metadata

  • Probabilistic Matching — Device fingerprint fallback attribution with confidence scoring

  • Webhook Notifications — Notify your backend when a deep link is opened (inline or standalone)

  • Click Tracking — Automatically track clicks from the referrer's clickId

  • Full TypeScript Support — Every method, parameter, and return type is fully typed

Getting Started

Guide

Description

Installation & Setup

Install the SDK, configure iOS and Android, and set up optional peer dependencies.

Android — Install Referrer

Read and parse the Google Play Install Referrer. Extract UTM params, short codes, and track clicks.

iOS — Clipboard Deep Links

Detect deep links from the iOS clipboard with flexible pattern matching.

Resolving Deep Links

Resolve Smler short links at runtime to get the original URL and metadata.

Probabilistic Matching

Device fingerprint fallback attribution when other methods fail.

Webhooks & Click Tracking

Notify your backend and track conversions.

API Reference

Complete reference for all classes, methods, and TypeScript types.

Quick Example

import { Platform } from 'react-native';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { SmlerDeferredLink, HelperReferrer } from '@smler/deferred-link';

async function runDeferredAttribution() {
  const isFirstInstall = await AsyncStorage.getItem('smler_first_install');
  if (isFirstInstall !== null) return; // Already ran

  if (Platform.OS === 'android') {
    const info = await SmlerDeferredLink.getInstallReferrerAndroid();
    const params = SmlerDeferredLink.parseReferrerParams(info);
    // Route based on params.utm_campaign, etc.

  } else if (Platform.OS === 'ios') {
    const result = await SmlerDeferredLink.getInstallReferrerIos({
      deepLinks: ['https://yourdomain.com', 'yourdomain.com'],
    });

    if (result) {
      // Clipboard match — resolve and navigate
      const data = await SmlerDeferredLink.resolveDeepLink(
        result.fullDeepLink,
        { triggerWebhook: true }
      );
      // Navigate based on data.originalUrl
    } else {
      // Fallback to probabilistic matching
      const match = await HelperReferrer.getProbabilisticMatch({
        domain: 'yourdomain.com',
      });
      if (match.matched && (match.score ?? 0) > 0.65) {
        // Navigate based on match.pathParams
      }
    }
  }

  await AsyncStorage.setItem('smler_first_install', 'done');
}

Published with LeafPad