Complete reference for all classes, methods, and types exported by the @smler/deferred-link React Native SDK.
SmlerDeferredLink
The main class for interacting with the SDK. All methods are static.
getInstallReferrerAndroid()
static async getInstallReferrerAndroid(): Promise<ReferrerInfo>Reads the Google Play Install Referrer information. Android only.
Returns:
ReferrerInfo— the raw referrer string and associated timestamps.Throws: Error if called on a non-Android platform.
Throws: Error if the native module returns a service error (see Android docs for error codes).
parseReferrerParams(info)
static parseReferrerParams(info: ReferrerInfo): Record<string, string>Parses the installReferrer string from a ReferrerInfo object as URL query parameters.
Parameters:
info— aReferrerInfoobject fromgetInstallReferrerAndroid().Returns: Key-value object of parsed parameters. Returns an empty object if the referrer is null or cannot be parsed.
getReferrerParam(info, key)
static getReferrerParam(info: ReferrerInfo, key: string): stringExtracts a single query parameter from the install referrer string.
Parameters:
info— aReferrerInfoobject.key— the query parameter key to extract.
Returns: The parameter value, or an empty string if not found.
extractShortCodeAndDltHeader(info)
static extractShortCodeAndDltHeader(info: ReferrerInfo): PathParamsExtracts the shortCode and optional dltHeader from the referrer string's URL path.
Parameters:
info— aReferrerInfoobject.Returns:
{ shortCode: string, dltHeader: string | null }If the referrer contains a URL with 2 path segments: first segment is
dltHeader, second isshortCode.If 1 segment: it is the
shortCode,dltHeaderisnull.If the referrer is empty or has no segments:
shortCodeis an empty string,dltHeaderisnull.
trackClick(info)
static async trackClick(info: ReferrerInfo): Promise<Record<string, unknown> | null>Tracks a click via the Smler API using the clickId from the referrer. Automatically extracts clickId, shortCode, dltHeader, and domain from the referrer.
Parameters:
info— aReferrerInfoobject.Returns: The tracking API response, or
nullif noclickIdis found in the referrer.
getInstallReferrerIos(options)
static async getInstallReferrerIos(options: {
deepLinks: string[];
}): Promise<IosClipboardDeepLinkResult | null>Reads the iOS clipboard and matches the text against the provided URL patterns. iOS only.
Parameters:
options.deepLinks— array of URL patterns to match against the clipboard. Supports scheme normalization,www.stripping, subdomain matching, wildcard host (*.example.com), wildcard path (example.com/*), and global wildcard (*).
Returns:
IosClipboardDeepLinkResultif a match is found,nullotherwise.Throws: Error if called on a non-iOS platform.
resolveDeepLink(url, options?)
static async resolveDeepLink(
url: string,
options?: { triggerWebhook?: boolean }
): Promise<ResolvedDeepLinkData>Resolves a Smler short link URL to get the original destination URL and full metadata. Works on both platforms.
Parameters:
url— the full short link URL to resolve.options.triggerWebhook— whentrue, the Smler backend fires the configured webhook in the same request.
Returns:
ResolvedDeepLinkDatawith the resolved metadata. Check theerrorfield for failures.
HelperReferrer
Utility class with lower-level helper methods. All methods are static.
matchesDeepLinkPattern(clipboard, pattern)
static matchesDeepLinkPattern(clipboard: string, pattern: string): booleanChecks if a clipboard string matches a deep link URL pattern.
Parameters:
clipboard— the clipboard text to check.pattern— the URL pattern to match against.
Returns:
trueif the clipboard text matches the pattern.
fetchTrackingData(clickId, pathParams, domain?)
static async fetchTrackingData(
clickId: string,
pathParams: { shortCode?: string | null; dltHeader?: string | null },
domain?: string | null
): Promise<TrackingResponse>Sends click tracking data to the Smler API.
Parameters:
clickId— the click identifier.pathParams.shortCode— the short URL code.pathParams.dltHeader— optional DLT header.domain— optional domain.
Returns:
TrackingResponse. Checkerrorfield for failures.API:
POST https://smler.in/api/v2/track/{clickId}
getProbabilisticMatch(options)
static async getProbabilisticMatch(options: {
domain: string;
clickId?: string;
}): Promise<ProbabilisticMatchResult>Performs probabilistic matching using device fingerprint data.
Parameters:
options.domain— the domain to match against (required).options.clickId— optional click ID for more precise matching.
Returns:
ProbabilisticMatchResult. Checkmatchedandscorefields.API:
POST https://smler.in/api/v2/track/probablisticNote: Requires
react-native-device-infofor automatic device/OS detection. Falls back to"Unknown"if not installed.
resolveDeepLinkData(url, options?)
static async resolveDeepLinkData(
url: string,
options?: { triggerWebhook?: boolean }
): Promise<ResolvedDeepLinkData>Resolves a short link URL to its full metadata. This is the underlying implementation of SmlerDeferredLink.resolveDeepLink().
Parameters: Same as
resolveDeepLink().Returns:
ResolvedDeepLinkData.API:
GET https://smler.in/api/v1/short?short=<shortCode>&dltHeader=<dltHeader>&domain=<domain>
triggerWebhook(options)
static async triggerWebhook(options: {
shortCode: string;
domain: string;
dltHeader?: string;
}): Promise<WebhookResponse>Triggers a webhook notification for the given short link.
Parameters:
options.shortCode— the short URL code (required).options.domain— the domain (required).options.dltHeader— optional campaign header.
Returns:
WebhookResponse.{ success: true }on success.API:
POST https://smler.in/api/v1/webhook?shortCode=<code>&domain=<domain>&dltHeader=<header>
extractShortCodeAndDltHeader(url)
static extractShortCodeAndDltHeader(url: string): {
shortCode: string;
dltHeader: string | null;
}Extracts the short code and optional DLT header from a URL's path segments.
Parameters:
url— a full URL string.Returns:
{ shortCode, dltHeader }. Returns empty shortCode and null dltHeader if the URL is invalid or has no path segments.
parseReferrerAsQueryParams(referrer)
static parseReferrerAsQueryParams(
referrer: string | null
): Record<string, string>Parses a referrer string as query parameters. Handles both full URLs and bare query strings.
Parameters:
referrer— the referrer string, ornull.Returns: Key-value object. Returns an empty object if input is null or unparseable.
TypeScript Types
All types are exported from the package:
import type {
ReferrerInfo,
IosClipboardDeepLinkResult,
ProbabilisticMatchResult,
TrackingResponse,
WebhookResponse,
ResolvedDeepLinkData,
PathParams,
} from '@smler/deferred-link';ReferrerInfo
Field | Type | Description |
|---|---|---|
|
| Raw referrer string from Google Play |
|
| Client-side click timestamp (seconds) |
|
| Client-side install-begin timestamp (seconds) |
|
| Server-side click timestamp (seconds) |
|
| Server-side install-begin timestamp (seconds) |
|
| App version at first install |
|
| Whether instant experience was launched recently |
IosClipboardDeepLinkResult
Field | Type | Description |
|---|---|---|
|
| Full deep link from clipboard |
|
| Alias for fullDeepLink |
|
| Parsed query parameters |
|
| Extracted shortCode and dltHeader |
PathParams
Field | Type | Description |
|---|---|---|
|
| Short URL code |
|
| Optional DLT header |
ProbabilisticMatchResult
Field | Type | Description |
|---|---|---|
|
| Whether a match was found |
|
| Confidence score (0.0–1.0) |
|
| Attributes that matched |
|
| Matched click details |
|
| Short URL metadata |
|
| Device fingerprint data |
|
| Domain (if matched) |
|
| Original URL (if matched) |
|
| Path parameters (if matched) |
|
| Error code |
|
| Error message |
ResolvedDeepLinkData
Field | Type | Description |
|---|---|---|
|
| Short URL code |
|
| Link domain |
|
| Campaign header |
|
| Original destination URL |
|
| Error code |
|
| Error message |
TrackingResponse
Field | Type | Description |
|---|---|---|
|
| Error code |
|
| Error message |
May contain additional fields from the API.
WebhookResponse
Field | Type | Description |
|---|---|---|
|
| Whether the webhook succeeded |
|
| Error code |
|
| Error message |