Skip to main content

Expo SDK

Deep linking and mobile attribution for Expo apps. The SDK is JavaScript on top of Expo modules -- no config plugin or ejecting required.

React Native CLI?

If you're using React Native CLI (not Expo), use the React Native SDK instead.

Faster setup with AI

Using Claude Code, Cursor or Codex? Copy this prompt and paste it into your agent from the root of your project. It installs the SDK, wires deep links through your router (asking you which screen each link should open), adds one event, and verifies the install in your LinkForty dashboard.

Install the LinkForty SDK in an Expo app
Expo SDK install, deferred and direct deep links through Expo Router, and a first in-app event.
Show the prompt
I use LinkForty (https://linkforty.com), a deep-linking and mobile attribution platform: short links that route each click to the app, the app store or the web, and record clicks, installs and in-app events per link.

Before writing any code, read the LinkForty documentation index at https://docs.linkforty.com/llms-full.txt and the pages listed under "Docs" below. Work from what the docs say, not from assumptions about how similar products work. If something you need is not in the docs or in this prompt — an ID, a token, a URL — stop and ask me for it rather than inventing a placeholder that looks real.

## Task: install the LinkForty Expo SDK

Add the LinkForty SDK to this app so that an install that follows a click on one of my links is attributed to that link, a link's deep-link path opens the right screen on first launch (deferred deep linking) and on later opens (Universal Links / App Links), and one key in-app event is recorded.

## Values

- **App token**: shown in the LinkForty dashboard under Workspace Settings → App Token (it starts with `at_`). Ask me for it; put it in the app's config or environment, not hard-coded in a committed source file.
- **Base URL**: `https://api.linkforty.com` for LinkForty Cloud. (Only a self-hosted LinkForty server uses a different origin — ask if you are not sure which this is.)
- **Link host**: the host my links are on, shown in the dashboard under Settings → Domains — the workspace's own host (it looks like `something.toapp.me`) and any verified custom domain listed there. Ask me for it. This is the domain the app must claim for Universal Links / App Links.
- **LinkForty MCP server** (optional): if it is configured in this environment (https://mcp.linkforty.com/mcp, or the `linkforty-mcp` command), use `get_app_config` to read the workspace's app settings and `create_link` to make a test link at the end. Do not set it up for me if it is not.

## How to work

1. **Look before you change anything.** Identify the framework, its version, the navigation/router library and where the app initializes at launch. List the screens (routes) you found, and **ask me which screen each incoming link should open and what parameter it needs** — for example "a link with `productId` opens the product screen". Wait for my answer before editing; do not guess routes.
2. **Work on a new git branch.** If the working tree has uncommitted changes, stop and tell me instead of building on top of them.
3. **Follow the docs pages named below, not memory.** Package names, method names and config keys come from those pages; LinkForty's SDKs are not the same as other attribution SDKs you may know.
4. **Do not invent values.** Anything in "Values" that says "ask me" is something you ask for. Never commit a token to source.
5. **Keep the app working without a link.** A launch with no matching click must behave exactly as before: no crash, no error surfaced to the user, no blocked start-up.
6. **Finish with a summary**: every file you changed and why; the manual steps that remain for me (Apple Team ID and bundle ID, Play signing SHA-256 fingerprint, store listing, a rebuild and reinstall) and where in the LinkForty dashboard each one goes (Workspace Settings → App Configuration); and anything you were unsure about.
7. **Verify.** Run the app once, then check the LinkForty dashboard: the SDK Doctor badge in the sidebar (https://docs.linkforty.com/guides/attribution/sdk-health) should report the SDK as installed. If the MCP server is available, create a test link with `create_link` and open it on a device or simulator; the click and the deep link should reach the screen we agreed on.

## Steps

1. **Install** with `npx expo install @linkforty/mobile-sdk-expo expo-device expo-application expo-localization expo-linking @react-native-async-storage/async-storage` (https://docs.linkforty.com/sdks/expo#installation). The Expo modules are peer dependencies, so list them all: `npx expo install` picks the versions that match the app's Expo SDK (51 or later). AsyncStorage must be 1.23.1 or a later 2.x; AsyncStorage 3 is not supported. Note: deep links do not work in Expo Go; a development build is needed to test them.
2. **Initialize once at launch** in the root layout or App component, guarded by `if (LinkForty.isInitialized) return;` (fast refresh re-runs effects, and a second call throws ALREADY_INITIALIZED): `await LinkForty.initialize({ baseUrl, appToken, debug: __DEV__ })`, where `LinkForty` is the package's default export (`import LinkForty from '@linkforty/mobile-sdk-expo'`; there is no named `LinkForty` export), with the base URL and app token from "Values" (https://docs.linkforty.com/sdks/expo#initialize-the-sdk). Leave `apiKey` out — it is only for creating links from the app.
3. **Claim the link host** so the OS opens the app instead of the browser (https://docs.linkforty.com/sdks/expo#platform-configuration): add `applinks:<link host>` to `ios.associatedDomains` and an `android.intentFilters` entry with `autoVerify: true` for `https://<link host>` in `app.json` / `app.config.*`, then regenerate the native projects if this app prebuilds. LinkForty serves the AASA and assetlinks.json files on that host itself; nothing to upload. Tell me the Apple Team ID / bundle ID and Android package / signing SHA-256 must be entered in LinkForty under Workspace Settings → App Configuration, or the OS will not verify the domain.
4. **Deferred deep link**: register `LinkForty.onDeferredDeepLink((data) => …)` right after initialize. When `data` is non-null, route to the screen we agreed on using its `deepLinkPath` / `customParameters`; when it is null (organic install) do nothing (https://docs.linkforty.com/sdks/expo#deep-linking).
5. **Direct deep links**: register `LinkForty.onDeepLink((url, data) => …)` after initialize resolves (the SDK handles the link that launched the app itself and holds it for the first callback registered, so don't also pass the launch URL to `handleDeepLink`) and route the same way. Use the app's existing Expo Router / React Navigation navigation for both — do not add a second navigation system. If the app uses Expo Router, add `app/+native-intent.tsx` exporting `redirectSystemPath({ path, initial })` that returns `initial ? '/' : null` when `new URL(path).hostname` is a link host and `path` otherwise (inside try/catch), so a short link like `/abc123` doesn't show "Unmatched Route" (https://docs.linkforty.com/sdks/expo#expo-router-short-links).
6. **One in-app event**: at the obvious success moment in this app (sign-up completed, purchase, or the first key action — tell me which you chose) call `LinkForty.trackEvent('signup')` or the purchase equivalent with amount and ISO currency (https://docs.linkforty.com/sdks/expo#track-events). No personal data in properties.

## Docs

- Expo SDK: https://docs.linkforty.com/sdks/expo (Installation, Platform Configuration, Expo Router short links, Initialize the SDK, Deep Linking, Track Events)
- SDK integration overview: https://docs.linkforty.com/guides/attribution/sdk-integration
- Deferred deep linking: https://docs.linkforty.com/guides/attribution/deferred-deep-linking
- Link hosts and app association files: https://docs.linkforty.com/guides/links/custom-domains#your-linkforty-domain
- SDK Doctor: https://docs.linkforty.com/guides/attribution/sdk-health

## Done when

- Opening one of my links on a device without the app, installing it and launching it lands on the screen we agreed on, and the install appears under Installs in the LinkForty dashboard attributed to that link.
- Opening the same link with the app installed goes straight to that screen without a browser stop.
- The in-app event shows under Events, attached to that install.
- SDK Doctor in the dashboard sidebar reports the SDK as installed.

When you are done, tell me: exactly which files changed and why, how I can verify it worked end to end (what to tap or run, and what I should see in the LinkForty dashboard), and anything you were unsure about.

It needs your app token; the prompt asks you for it, and the MCP server can supply it if you have that set up.

Features​

  • Deferred deep linking -- route new users to specific content after install
  • Direct deep linking -- handle links when the app is already installed
  • Install attribution -- exact from the Google Play install referrer on Android; otherwise probabilistic fingerprint matching
  • Event tracking -- log in-app events tied to attribution data
  • Revenue tracking -- structured purchase tracking with dedicated method
  • Offline event queue -- failed events persist across app restarts and are sent at launch, on return to the foreground, after the next successful event, or on a manual flush
  • Programmatic link creation -- create short links from your app
  • Typed errors -- LinkFortyError with specific error codes
  • Pure Expo modules -- uses expo-device, expo-application, expo-localization, expo-linking
  • No config plugin -- the SDK adds no native code of its own (it uses the Expo modules above); runs in development builds and EAS builds. (Expo Go can't claim your link domains, so links won't open the app there; see Troubleshooting.)

Requirements​

  • Expo SDK 51 or later (built and tested against Expo SDK 58), React Native 0.74 or later, React 18 or later
  • The Expo modules the SDK runs on, installed in your app: expo-device, expo-application, expo-localization, expo-linking and @react-native-async-storage/async-storage 1.23.1 or later 2.x (AsyncStorage 3 is not supported). They are peer dependencies, so your app's versions are the ones the SDK uses
  • A development or EAS build to test links (Expo Go can't claim your link domains)
  • Optional: @react-navigation/native 6 or later, only for automatic screen tracking
Upgrading from 1.9.x or earlier

Up to 1.9.x, the package's own dependencies pinned the Expo SDK 52 versions of these modules, so on any other Expo SDK npm installed a second copy inside the package and Expo autolinking reported duplicates. From 1.10.0 they are peer dependencies: run the install command below, or npx expo install --check, so your app has versions that match its Expo SDK.

Installation​

npx expo install @linkforty/mobile-sdk-expo expo-device expo-application expo-localization expo-linking @react-native-async-storage/async-storage

List the Expo modules in the command, as above: they are peer dependencies, and npx expo install adds the versions that match your app's Expo SDK. A plain npm install of the package alone installs the newest versions of missing peers, which may not match your Expo SDK; npx expo install --check reports any that don't.

No config plugin is needed. After installing, rebuild your development build if it doesn't already include these modules.

Platform Configuration​

Universal Links (iOS) and App Links (Android) need the app to claim your link host. In Expo that is app config, not native project files — app.json or app.config.*:

{
"expo": {
"ios": {
"associatedDomains": ["applinks:acme.toapp.me"]
},
"android": {
"intentFilters": [
{
"action": "VIEW",
"autoVerify": true,
"data": [{ "scheme": "https", "host": "acme.toapp.me" }],
"category": ["BROWSABLE", "DEFAULT"]
}
]
}
}
}

Use your LinkForty domain as the host, and add an entry for each custom domain. Your LinkForty server automatically hosts the Apple App Site Association and Digital Asset Links files on every one of those hosts. Rebuild after changing this (npx expo prebuild if you manage native projects, or an EAS / development build) — Expo Go cannot claim domains.

Expo Router routes an incoming URL's path itself, so a short link like https://acme.toapp.me/abc123 becomes the route /abc123 and shows "Unmatched Route". Add an app/+native-intent.tsx that leaves your link hosts to the SDK; your onDeepLink callback then navigates:

// app/+native-intent.tsx
const LINK_HOSTS = ['acme.toapp.me']; // the hosts in app.json

export function redirectSystemPath({ path, initial }: { path: string; initial: boolean }) {
try {
const { hostname } = new URL(path);
if (LINK_HOSTS.includes(hostname)) {
// The SDK delivers this link to onDeepLink. On launch, start at the home
// screen; while running, stay where the user is.
return initial ? '/' : null;
}
} catch {
// Not an absolute URL (a scheme link or plain path): let Expo Router handle it.
}
return path;
}

Keep it free of anything that can throw: Expo Router calls it before your app's components run.


Quick Start​

Initialize the SDK​

import LinkForty from '@linkforty/mobile-sdk-expo';
import { useEffect } from 'react';

function App() {
useEffect(() => {
async function setup() {
if (LinkForty.isInitialized) return; // fast refresh re-runs effects
await LinkForty.initialize({
baseUrl: 'https://api.linkforty.com',
apiKey: 'your-api-key', // optional -- required for link creation
appToken: 'at_your_app_token', // required for Cloud: matches installs to your workspace's links only
debug: __DEV__,
attributionWindowHours: 168, // 7 days (default)
});

// Handle deferred deep links (new installs)
LinkForty.onDeferredDeepLink((data) => {
if (data) {
console.log('Attributed install:', data.shortCode);
navigateToContent(data);
}
});

// Handle direct deep links (app already installed)
LinkForty.onDeepLink((url, data) => {
console.log('Deep link opened:', url);
if (data) {
navigateToContent(data);
}
});
}

setup().catch((error) => console.warn('LinkForty setup failed', error));
}, []);

return null; // your app
}

Track Events​

import LinkForty from '@linkforty/mobile-sdk-expo';

// Custom event
await LinkForty.trackEvent('add_to_cart', {
productId: '123',
category: 'electronics',
});

// Revenue event
await LinkForty.trackRevenue(29.99, 'USD', {
productId: '123',
productName: 'Wireless Headphones',
});
import LinkForty from '@linkforty/mobile-sdk-expo';

const result = await LinkForty.createLink({
deepLinkParameters: { route: 'PRODUCT', id: '123' },
title: 'Check out this product',
utmParameters: { source: 'app', medium: 'share' },
});

console.log(result.url); // https://go.yourdomain.com/abc123
console.log(result.shortCode); // abc123
console.log(result.linkId); // uuid
warning

Link creation requires an API key and works on LinkForty Cloud only. Without templateId the SDK calls /api/sdk/v1/links, which self-hosted Core doesn't serve; with templateId it calls /api/links, which on Core requires an originalUrl the SDK doesn't send.


API Reference​

Initialization​

initialize(config)​

Initialize the SDK. Must be called before any other method.

await LinkForty.initialize(config: LinkFortyConfig): Promise<InstallAttributionResponse>

Returns an install attribution response on every launch. On the launch that reports the install it is the server's answer. On later launches it is rebuilt from saved data: attributed is true when install link data was saved, confidenceScore is 100 or 0, matchedFactors is empty, and attributionMethod / competingLinks are absent. If the install report fails, it resolves as organic (attributed: false, empty installId) rather than rejecting, and onDeferredDeepLink receives null on that launch. The install stays unreported, so the next launch reports it again; when that report succeeds, that launch delivers the deferred deep link.

Upgrading from 1.9.0 or earlier

Those versions marked a device as launched even when its first-launch install report failed, so the device never got an install ID and its events were rejected. On the first launch after upgrading, such a device reports its install once, and that report only restores the install ID. It is not a new install: onDeferredDeepLink isn't called, initialize() resolves with attributed: false, and any link the server matches is neither saved as install data (getInstallData() stays null) nor credited for later events. These installs appear dated at the upgrade, and are usually organic, because the original click has fallen out of the attribution window.

ParameterTypeRequiredDefaultDescription
baseUrlstringYes--https://api.linkforty.com on LinkForty Cloud; your server's URL if you self-host
apiKeystringNo--API key for link creation and Cloud features
appTokenstringCloud: yes--Public workspace token (at_…). Required for Cloud: installs are matched only to your workspace's links, and organic installs appear in your analytics. Safe to ship in your app bundle. See App token.
debugbooleanNofalseEnable verbose logging
attributionWindowHoursnumberNo168Attribution window in hours (1--2160)
autoTrackNavigationboolean | objectNooffAuto-emit screen_view events from React Navigation. Requires navigationRef. See Automatic Screen Tracking.
navigationRefrefNo--Your React Navigation container ref. Required when autoTrackNavigation is enabled.

isInitialized​

Boolean getter indicating whether the SDK has been initialized.

if (LinkForty.isInitialized) { /* ... */ }

Deep Linking​

onDeferredDeepLink(callback)​

Register a callback for deferred deep links. Called once, on the launch that reports the install: with the link's data, or null for an organic install (no attribution match). Registered after initialize() on that launch, it fires immediately. Later launches don't call it; use getInstallData() for the install's link data. A launch whose install report failed also calls it, with null, and the next launch reports the install again (see initialize(config)).

LinkForty.onDeferredDeepLink(callback: (data: DeepLinkData | null) => void): void

On Android, the SDK sends the Google Play install referrer with the install, so an install from Google Play is matched to the exact click (attributionMethod "install_referrer", competingLinks 0). Any other deferred match is made from device signals, not an ID, so two people on the same network can be confused. The deferred deep link reports how the match was made: confidenceScore (0–100), matchedFactors, attributionMethod ("install_referrer" or "fingerprint") and competingLinks, the number of other links that had a click from the same network good enough to match. At 0 no other link was in contention. Above 0, another person's tap may be what led to this install, so before acting on a single-use link (a sign-in or gift link), ask the user to confirm. The fields are empty on a direct open, and from a server that doesn't report them. See Single-use links.

LinkForty.onDeferredDeepLink((data) => {
if (!data) return;
if ((data.competingLinks ?? 0) > 0) {
confirmBeforeSignIn(data); // another link was in contention
} else {
signIn(data);
}
});

onDeepLink(callback)​

Register a callback for direct deep links. The SDK resolves LinkForty links server-side for enriched data.

The SDK listens for incoming links itself (expo-linking), including the link that launched the app. Register the callback after initialize() resolves; nothing is lost in between: a link handled while no onDeepLink callback is registered, such as the launch link, is held and delivered once to the first callback you register.

A LinkForty link is an http(s) URL on your baseUrl host or, with appToken set, on one of your workspace's link hosts: its toapp.me label and verified custom domains. The SDK learns those hosts at launch and saves them for the next one. Any other URL reaches the callback with data set to null. With appToken set, every request carries it, and a lookup answers only with your own workspace's links.

LinkForty.onDeepLink(callback: (url: string, data: DeepLinkData | null) => void): void

handleDeepLink(url)​

Manually pass a URL for the SDK to process. Use it only for URLs that reach your app another way: passing it the launch URL or a URL from your own Linking listener delivers that link to your callbacks twice.

LinkForty.handleDeepLink(url: string): void

Event Tracking​

trackEvent(name, properties?)​

Track a custom in-app event. Rejects when the send fails, even though the event has been queued (see Offline Resilience), so catch the error. Rejects with NOT_INITIALIZED, without queuing, when the SDK has no install ID.

await LinkForty.trackEvent(name: string, properties?: Record<string, unknown>): Promise<void>

trackRevenue(amount, currency, properties?)​

Track a revenue event with structured amount and currency.

await LinkForty.trackRevenue(
amount: number,
currency: string,
properties?: Record<string, unknown>
): Promise<void>

Event Queue​

flushEvents()​

Manually send all queued events.

await LinkForty.flushEvents(): Promise<void>

clearEventQueue()​

Remove queued events without sending them.

await LinkForty.clearEventQueue(): Promise<void>

queuedEventCount​

Getter returning the number of events waiting to be sent.

const count = LinkForty.queuedEventCount;

createLink(options)​

Create a short link programmatically. Requires an API key.

await LinkForty.createLink(options: CreateLinkOptions): Promise<CreateLinkResult>
OptionTypeRequiredDescription
templateIdstringNoTemplate UUID (uses organization's default template if omitted)
templateSlugstringNoTemplate slug for building the URL; used only with templateId
deepLinkParametersRecord<string, string>NoIn-app routing parameters
titlestringNoLink title
descriptionstringNoLink description
customCodestringNoCustom short code, up to 20 characters; must not already be used in your workspace (409 SHORT_CODE_TAKEN)
utmParametersUTMParametersNoCampaign tracking parameters
externalUserIdstringNoUser ID for deduplication and share attribution
webFallbackUrlstringNoWeb fallback URL, used when the app isn't installed or on desktop

User Identity​

setExternalUserId(id)​

Set the external user ID for share attribution. This ID is automatically attached to all createLink() calls unless overridden per-call. Pass null to clear.

LinkForty.setExternalUserId(id: string | null): void

getExternalUserId()​

Returns the current external user ID, or null if not set.

LinkForty.getExternalUserId(): string | null

getSessionId()​

Current session id: rotates on cold start and on each deep-link open.

LinkForty.getSessionId(): string | null

Data Access​

getInstallId()​

await LinkForty.getInstallId(): Promise<string | null>

getInstallData()​

await LinkForty.getInstallData(): Promise<DeepLinkData | null>

isFirstLaunch()​

await LinkForty.isFirstLaunch(): Promise<boolean>

Data Management​

clearData()​

Wipe all locally stored SDK data.

await LinkForty.clearData(): Promise<void>

reset()​

Return the SDK to an uninitialized state so it can be re-initialized.

LinkForty.reset(): void

Error Handling​

All errors are LinkFortyError instances with a .code property for programmatic handling:

import LinkForty, { LinkFortyError, LinkFortyErrorCode } from '@linkforty/mobile-sdk-expo';

try {
await LinkForty.createLink({ title: 'Test' });
} catch (error) {
if (error instanceof LinkFortyError) {
switch (error.code) {
case LinkFortyErrorCode.MISSING_API_KEY:
console.log('API key required for link creation');
break;
case LinkFortyErrorCode.NOT_INITIALIZED:
console.log('Call initialize() first');
break;
case LinkFortyErrorCode.NETWORK_ERROR:
console.log('Network unavailable');
break;
}
}
}

Error Codes​

CodeTrigger
NOT_INITIALIZEDMethod called before initialize()
ALREADY_INITIALIZEDDuplicate initialize() call
INVALID_CONFIGURATIONInvalid config parameters (e.g., non-HTTPS URL, out-of-range attribution window)
NETWORK_ERRORNetwork request failed after 3 attempts (network errors and 5xx are retried; 4xx is not)
INVALID_RESPONSENon-2xx server response
DECODING_ERRORFailed JSON parsing
INVALID_EVENT_DATAEmpty event name or negative revenue amount
MISSING_API_KEYcreateLink() called without an API key
INVALID_DEEP_LINK_URLDefined; not currently thrown

Offline Resilience​

An event that fails to send (offline, or any error after retries) is queued in AsyncStorage:

  • Maximum queue size: 100 events; when full, new failed events are dropped
  • Queue persists across app restarts
  • Queued events are sent, in order, once initialize() has reported the install, each time the app returns to the foreground, after the next event that sends successfully, and when you call flushEvents(). A send that fails leaves the rest of the queue for the next of these. The SDK doesn't watch connectivity
  • Each event carries a clientEventId, kept with it in the queue, so every send of an event has the same ID. LinkForty Cloud, and a self-hosted server on @linkforty/core 1.36.0 or later, store an event they have already received once, so an event whose send reached the server but whose response was lost isn't counted twice. Older servers ignore the field
  • Use clearEventQueue() to discard queued events without sending
  • Check queuedEventCount to monitor queue depth

TypeScript Types​

import { LinkFortySDK, LinkFortyError, LinkFortyErrorCode } from '@linkforty/mobile-sdk-expo';

import type {
LinkFortyConfig,
DeepLinkData,
InstallAttributionResponse,
AttributionMethod,
AutoTrackNavigationOptions,
NavigationContainerRefLike,
UTMParameters,
DeviceFingerprint,
CreateLinkOptions,
CreateLinkResult,
EventRequest,
DeferredDeepLinkCallback,
DeepLinkCallback,
} from '@linkforty/mobile-sdk-expo';

Configuration Validation​

The Expo SDK validates configuration at initialization:

  • Base URL must use HTTPS (except localhost, 127.0.0.1, 0.0.0.0 and 10.0.2.2, the Android emulator's host, for local development)
  • Attribution window must be between 1 and 2160 hours (90 days)
  • Invalid configuration throws a LinkFortyError with code INVALID_CONFIGURATION

Automatic Screen Tracking​

Enable autoTrackNavigation to emit a screen_view event on every React Navigation transition automatically — no per-screen trackEvent calls. Screen views flow through the normal event pipeline and carry the active deep-link attribution context, feeding App Analytics and the SDK health signal.

It requires a navigation container ref:

import { createNavigationContainerRef, NavigationContainer } from '@react-navigation/native';
import LinkForty from '@linkforty/mobile-sdk-expo';

export const navigationRef = createNavigationContainerRef();

await LinkForty.initialize({
baseUrl: 'https://api.linkforty.com',
appToken: 'at_your_app_token',
autoTrackNavigation: true, // screen names only — privacy-safe default
navigationRef, // no cast needed, also under strict TypeScript
});

<NavigationContainer ref={navigationRef}>
{/* ...screens... */}
</NavigationContainer>

Capturing route params​

autoTrackNavigation: true captures screen names only. To capture specific, non-PII params, pass an options object with an explicit allow-list:

await LinkForty.initialize({
baseUrl: 'https://api.linkforty.com',
navigationRef,
autoTrackNavigation: {
captureParams: ['productId', 'category'], // only these keys
debounceMs: 350, // default 350ms
},
});
OptionTypeDefaultDescription
captureParamsstring[][] (none)Allow-list of route param keys to capture. Never list keys that can hold personal data.
debounceMsnumber350Debounce window for rapid transitions, in milliseconds.

What gets sent​

Each transition emits a screen_view event with screen (active route name), previousScreen (when available), and params (only allow-listed keys). Rapid transitions are debounced and duplicates dropped. If autoTrackNavigation is enabled without a navigationRef, screen tracking is disabled (a warning is logged in debug mode).

Expo Router

Expo Router is built on React Navigation but renders no NavigationContainer of yours. Get the ref with useNavigationContainerRef() from expo-router in your root layout, and pass it as navigationRef. Both refs assign to navigationRef without a cast under strict TypeScript (SDK 1.10.0 or later; earlier versions needed as NavigationContainerRefLike).


Self-Hosted Configuration​

For self-hosted LinkForty Core, set baseUrl to your server and omit apiKey (createLink() isn't supported on Core). Core doesn't serve the list of link hosts, so only URLs on the baseUrl host are looked up as links:

await LinkForty.initialize({
baseUrl: 'https://links.yourcompany.com',
debug: false,
});

Troubleshooting​

Expo Go has limitations with Universal Links / App Links. For full deep linking support, use a development build or EAS Build.

ALREADY_INITIALIZED error​

The SDK guards against double initialization. If you need to reinitialize (e.g., after changing configuration), call reset() first:

LinkForty.reset();
await LinkForty.initialize(newConfig);

Add the +native-intent file from Expo Router short links.

Events not appearing in analytics​

  1. Check queuedEventCount -- events may be queued due to network issues
  2. Call flushEvents() to manually send queued events
  3. Ensure the SDK has a valid install ID (check with getInstallId()). If the install report failed there is none yet, and trackEvent() rejects with NOT_INITIALIZED without queuing; the next launch reports the install again.

Next Steps​

Resources​