Probabilistic Matching

Use device fingerprint probabilistic matching as a fallback for deferred deep link attribution in React Native. Ideal for iOS when clipboard matching fails.


Probabilistic matching is a fallback attribution method that identifies which ad click led to an app install by analyzing device fingerprint data. It is primarily useful on iOS when clipboard matching fails.

When to Use

  • iOS fallback: When getInstallReferrerIos() returns null (the clipboard was empty or didn't match).

  • Cross-platform validation: To confirm attribution from another method.

  • Enhanced attribution: To get additional click metadata and confidence scoring.

How It Works

  1. The SDK collects device information (manufacturer, model, OS name, OS version) using react-native-device-info if available.

  2. It sends this data along with your domain to the Smler probabilistic matching API: POST https://smler.in/api/v2/track/probablistic

  3. The API compares the device fingerprint against recent click records for that domain.

  4. If a match is found, the API returns the matched short URL, a confidence score, and the original click details.

Prerequisites

For the best match accuracy, install react-native-device-info:

npm install react-native-device-info

If react-native-device-info is not installed, the SDK will still call the API but will send "Unknown" for the device and OS fields. This reduces the likelihood of a successful match.

Basic Usage

import { HelperReferrer } from '@smler/deferred-link';
import type { ProbabilisticMatchResult } from '@smler/deferred-link';

const result: ProbabilisticMatchResult = await HelperReferrer.getProbabilisticMatch({
  domain: 'go.yourdomain.com',
});

if (result.matched) {
  console.log('Match found!');
  console.log('Confidence score:', result.score);
  console.log('Short code:', result.pathParams?.shortCode);
  console.log('Domain:', result.pathParams?.domain);
  console.log('Original URL:', result.originalUrl);
} else {
  console.log('No probabilistic match found');
}

With Click ID

If you have a clickId (e.g. from a referrer parameter or a tracking pixel), you can provide it for more precise matching:

const result = await HelperReferrer.getProbabilisticMatch({
  domain: 'go.yourdomain.com',
  clickId: 'abc123-click-id',
});

ProbabilisticMatchResult Fields

Field

Type

Description

matched

boolean

Whether a match was found

score

number | null

Confidence score between 0.0 and 1.0

matchedAttributes

unknown

The attributes that contributed to the match

clickDetails

unknown

Details of the click event that was matched

shortUrl

Record<string, unknown> | null

Full short URL metadata object

fingerprint

unknown

The device fingerprint data that was sent

domain

string

Domain from the matched short URL (if matched)

originalUrl

string

Original destination URL (if matched)

pathParams

object

Short code, DLT header, and domain from the matched link

error

string

Error code if the request failed

message

string

Error message if the request failed

pathParams (when matched)

Field

Type

Description

shortCode

string

The short URL code

dltHeader

string | null

Campaign/category header

domain

string

Domain of the short URL

Interpreting the Confidence Score

The score field represents how confident the system is that the match is correct:

  • 0.8 – 1.0: High confidence. Safe to use for attribution and navigation.

  • 0.5 – 0.8: Medium confidence. Consider using for attribution but may want to validate.

  • Below 0.5: Low confidence. The match may be incorrect — use with caution.

A common threshold is 0.65:

if (result.matched && (result.score ?? 0) > 0.65) {
  // High enough confidence to act on
  navigateToScreen(result.pathParams?.shortCode);
}

Full iOS Flow with Probabilistic Fallback

import { SmlerDeferredLink, HelperReferrer } from '@smler/deferred-link';

const DOMAIN = 'go.yourdomain.com';

async function handleIosAttribution() {
  // Step 1: Try clipboard matching first
  const clipboardResult = await SmlerDeferredLink.getInstallReferrerIos({
    deepLinks: [DOMAIN, `https://${DOMAIN}`, `*.${DOMAIN}`],
  });

  if (clipboardResult) {
    // Clipboard match — resolve and navigate
    const data = await SmlerDeferredLink.resolveDeepLink(
      clipboardResult.fullDeepLink,
      { triggerWebhook: true }
    );
    console.log('Clipboard attribution:', data.originalUrl);
    return;
  }

  // Step 2: Clipboard failed — try probabilistic matching
  const probabilistic = await HelperReferrer.getProbabilisticMatch({
    domain: DOMAIN,
  });

  if (probabilistic.error) {
    console.error('Probabilistic match failed:', probabilistic.message);
    return;
  }

  if (probabilistic.matched && (probabilistic.score ?? 0) > 0.65) {
    console.log('Probabilistic attribution:', {
      score: probabilistic.score,
      shortCode: probabilistic.pathParams?.shortCode,
      originalUrl: probabilistic.originalUrl,
    });
    // Navigate based on probabilistic.pathParams
  } else {
    console.log('No attribution match found (organic install)');
  }
}

Error Handling

The method does not throw. If anything goes wrong, the error and message fields will be populated:

const result = await HelperReferrer.getProbabilisticMatch({
  domain: 'go.yourdomain.com',
});

if (result.error) {
  console.error('Error:', result.error, result.message);
  // result.matched will be false
}

Possible errors:

  • "Validation" — the domain parameter was empty

  • "HTTP 4xx/5xx" — the API returned an error status

  • "Exception" — a network or unexpected error occurred

Published with LeafPad