API Reference
DetourProvider
Top-level React component that initializes link handling and analytics event transport.
Signature
function DetourProvider(props: {
config: Config;
children: React.ReactNode;
}): JSX.Element;
Config fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
appID | string | Yes | - | App identifier from Detour dashboard |
apiKey | string | Yes | - | Publishable API key from Detour dashboard |
shouldUseClipboard | boolean | No | true | iOS-only clipboard read for probabilistic matching |
linkProcessingMode | LinkProcessingMode | No | 'all' | Controls which link sources are handled |
storage | DetourStorage | No | AsyncStorage | Custom storage adapter for SDK persistence keys |
useDetourContext
Hook that returns link-processing state and the resolved link payload.
Signature
function useDetourContext(): DetourContextType;
Returned object
| Property | Type | Description |
|---|---|---|
isLinkProcessed | boolean | true when initial processing (or fallback) finished |
link | DetourLink | Resolved link object or null |
clearLink | () => void | Clears current link state |
DetourAnalytics
Analytics helper exported from the package root.
Methods
DetourAnalytics.logEvent(
eventName: DetourEventNames | `${DetourEventNames}`,
data?: any,
): void;
DetourAnalytics.logRetention(retentionEventName: string): void;
Expo Router helper
Available under subpath import:
import { createDetourNativeIntentHandler } from '@swmansion/react-native-detour/expo-router';
Signature
function createDetourNativeIntentHandler(
options?: DetourNativeIntentOptions,
): DetourNativeIntentHandler;
Key options
| Option | Type | Description |
|---|---|---|
fallbackPath | string | Returned when Detour host matches and resolve mode is disabled/fails |
hosts | Array<string | RegExp> | Host match patterns (default: *.godetour.link) |
config | { apiKey; appID; timeoutMs?; onResolveError? } | Enables short-link resolve mode |
mapToRoute | (value) => string | Custom route mapping after resolution |
Types
LinkProcessingMode
type LinkProcessingMode = 'all' | 'web-only' | 'deferred-only';
LinkType
type LinkType = 'deferred' | 'verified' | 'scheme';
DetourLink
type DetourLink = {
url: string | URL;
route: string;
pathname: string;
params: Record<string, string>;
type: LinkType;
} | null;
DetourContextType
type DetourContextType = {
isLinkProcessed: boolean;
link: DetourLink;
clearLink: () => void;
};
DetourStorage
interface DetourStorage {
getItem(key: string): Promise<string | null> | string | null;
setItem(key: string, value: string): Promise<void> | void;
removeItem?(key: string): Promise<void> | void;
}
DetourEventNames
| Category | Event Name | String Value |
|---|---|---|
| General | Login | login |
Search | search | |
Share | share | |
SignUp | sign_up | |
TutorialBegin | tutorial_begin | |
TutorialComplete | tutorial_complete | |
ReEngage | re_engage | |
Invite | invite | |
OpenedFromPushNotification | opened_from_push_notification | |
| Sales | AddPaymentInfo | add_payment_info |
AddShippingInfo | add_shipping_info | |
AddToCart | add_to_cart | |
RemoveFromCart | remove_from_cart | |
Refund | refund | |
ViewItem | view_item | |
BeginCheckout | begin_checkout | |
Purchase | purchase | |
AdImpression | ad_impression |