Index of every page on this site: llms.txt
All skills
software-mansion-labs avatar

/detour-onboarding

@43cde80
Run it yourself

Complete onboarding guide for developers who are new to Detour, the open-source deferred deep linking SDK by Software Mansion. Use this skill whenever a user asks what Detour is, how to get started with Detour, how to set up deep linking with Detour, how to install the Detour SDK, how to configure the Detour dashboard, or how deferred deep linking works. Also use it when the user has no prior deep linking setup and wants to add deep links to their app. Covers everything from zero to production: account setup, dashboard configuration, Universal Links and App Links, platform SDK integration for React Native, iOS, Android, and Flutter, analytics, and architecture.

Use this Skill: https://skilld.dev/gh/software-mansion-labs/skills/detour-onboarding

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesreact-native.md

≈1.8k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Detour — React Native SDK Reference

Contents

  • Installation
  • Universal / App Links
  • SDK Setup
  • Expo Router Integration
  • Analytics
  • Keeping this reference current

Installation

npm install @swmansion/react-native-detour
# or: yarn add / pnpm add / bun add @swmansion/react-native-detour

Peer dependencies

Expo (managed or bare with expo-modules):

npx expo install expo-application expo-clipboard expo-constants expo-device expo-localization @react-native-async-storage/async-storage

Bare React Native (no expo-modules-core): Install peer deps manually:

npm install expo-application expo-clipboard expo-constants expo-device expo-localization @react-native-async-storage/async-storage

async-storage version note: The official peer dep is >=2.0.0. Version 3.x technically satisfies this but uses KMP and requires an Android artifact (org.asyncstorage.shared_storage:storage-android) that may not be available on Maven Central — if you hit build errors with 3.x, pin to ^2.x:

npm install "@react-native-async-storage/async-storage@^2"

babel-preset warning (bare React Native)

Do not add babel-preset-expo to a bare React Native project — it causes Metro errors like Unable to determine event arguments for "onModeChange". Bare RN should use @react-native/babel-preset only.


Universal / App Links

Expo (app.json)

iOS:

{
  "expo": {
    "ios": {
      "associatedDomains": ["applinks:YOUR_ORG.godetour.link"]
    }
  }
}

Android:

{
  "expo": {
    "android": {
      "intentFilters": [
        {
          "action": "VIEW",
          "autoVerify": true,
          "data": [{ "scheme": "https", "host": "YOUR_ORG.godetour.link" }],
          "category": ["BROWSABLE", "DEFAULT"]
        }
      ]
    }
  }
}

Bare React Native — iOS

<AppTarget>.entitlements:

<key>com.apple.developer.associated-domains</key>
<array>
  <string>applinks:YOUR_ORG.godetour.link</string>
</array>

AppDelegate.mm:

- (BOOL)application:(UIApplication *)application
    continueUserActivity:(NSUserActivity *)userActivity
    restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> *))restorationHandler {
  return [RCTLinkingManager application:application
                   continueUserActivity:userActivity
                     restorationHandler:restorationHandler];
}

Bare React Native — Android

Copy the exact snippet from the Detour Dashboard (App Configuration tab) — it includes the unique pathPrefix for your app. Never write the intent-filter by hand. It will look like:

<activity android:name=".MainActivity" android:exported="true">

  <!-- App Links — COPY FROM DETOUR DASHBOARD, do not write manually -->
  <intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="https"
          android:host="YOUR_ORG.godetour.link"
          android:pathPrefix="/YOUR_APP_HASH" />
  </intent-filter>

  <!-- Optional: custom URI scheme -->
  <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="yourapp" />
  </intent-filter>

</activity>

SDK Setup

1. Config

// detour.config.ts
import { type Config } from "@swmansion/react-native-detour";

export const detourConfig: Config = {
  apiKey: process.env.EXPO_PUBLIC_DETOUR_API_KEY!,
  appID: process.env.EXPO_PUBLIC_DETOUR_APP_ID!,
  shouldUseClipboard: true,
  linkProcessingMode: "all" as const,
};

.env:

EXPO_PUBLIC_DETOUR_API_KEY=your_publishable_key
EXPO_PUBLIC_DETOUR_APP_ID=your_app_id

2. Wrap root with DetourProvider

// app/_layout.tsx (or App.tsx)
import { DetourProvider } from "@swmansion/react-native-detour";
import { detourConfig } from "./detour.config";

export default function RootLayout() {
  return (
    <DetourProvider config={detourConfig}>
      <YourNavigator />
    </DetourProvider>
  );
}

One provider per app tree. On Expo Web it becomes a no-op automatically.

3. Handle resolved links

import { useDetourContext } from "@swmansion/react-native-detour";

export default function Navigator() {
  const { isLinkProcessed, link, clearLink } = useDetourContext();
  const router = useRouter();
  const pathname = usePathname();

  useEffect(() => {
    if (!isLinkProcessed || !link) return;

    // link.type:     'deferred' | 'verified' | 'scheme'
    // link.route:    "/articles/2?ref=campaign"
    // link.pathname: "/articles/2"
    // link.params:   { ref: "campaign" }

    if (pathname !== link.pathname) {
      router.replace({ pathname: link.pathname, params: link.params });
    }
    clearLink();
  }, [isLinkProcessed, link, pathname]);

  return <YourScreens />;
}

Wait for isLinkProcessed before navigating — it turns true once the SDK has finished its initial link resolution (whether or not a link was found).


Expo Router Integration (recommended if someone already has expo router setup)

Create app/+native-intent.tsx to resolve links before the first render:

import { createDetourNativeIntentHandler } from "@swmansion/react-native-detour/expo-router";

export const redirectSystemPath = createDetourNativeIntentHandler({
  config: {
    apiKey: process.env.EXPO_PUBLIC_DETOUR_API_KEY!,
    appID: process.env.EXPO_PUBLIC_DETOUR_APP_ID!,
  },
});

When using this pattern, limit the provider to deferred-only:

export const detourConfig: Config = {
  apiKey: process.env.EXPO_PUBLIC_DETOUR_API_KEY!,
  appID: process.env.EXPO_PUBLIC_DETOUR_APP_ID!,
  shouldUseClipboard: true,
  linkProcessingMode: "deferred-only" as const,
};

Analytics

logEvent only accepts values from the DetourEventNames enum for standard events. Do not pass arbitrary strings like "article_opened" — they are not valid event names and will not be tracked correctly.

import {
  DetourAnalytics,
  DetourEventNames,
} from "@swmansion/react-native-detour";

// Standard event — use enum
DetourAnalytics.logEvent(DetourEventNames.Purchase, {
  revenue: 29.99,
  currency: "USD",
});
DetourAnalytics.logEvent(DetourEventNames.ViewItem, { item_id: "article_2" });

// Custom / non-standard activity — use logRetention with a descriptive string
DetourAnalytics.logRetention("article_opened");
DetourAnalytics.logRetention("app_open");

Keeping this reference current

If the user asks about the latest version, installation steps, or you suspect anything above may be outdated, fetch the live README:

https://github.com/software-mansion-labs/react-native-detour/blob/main/README.md

Cross-reference against the sections above and prefer the live README if they conflict.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning4mo3 checks · Risk SAFE
  • Gen Agent Trust Hub4mo

    The skill is a comprehensive and safe onboarding guide for the Detour deep linking SDK by Software Mansion. It provides standard configuration steps, code integration examples, and testing procedures for Android, iOS, Flutter, and React Native platforms. All external resources, including GitHub repositories and package dependencies, are official vendor-owned assets, and the skill follows security best practices for credential management.

  • Socket4mo

    No alerts

  • Snyk4mo

    Risk: MEDIUM · 1 issue

Signed by skilld at 43cde80. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated 5 months ago

README badge

README badge for software-mansion-labs/skills/detour-onboarding