React Native in five steps
The shortest path to a working React Native integration. Every step is the minimum that works, with no options. For anything beyond that, each step links to the React Native SDK reference, which is where the detail lives.
1. Install
Section titled “1. Install”npm install @tolinku/react-native-sdk @react-native-async-storage/async-storageOn Expo, use npx expo install @react-native-async-storage/async-storage for
the second one.
2. Set up Universal Links and App Links
Section titled “2. Set up Universal Links and App Links”Both platforms need native configuration: Universal Links (iOS) and App Links (Android). Neither is done by installing the package.
3. Configure
Section titled “3. Configure”import { Tolinku } from '@tolinku/react-native-sdk';
Tolinku.init({ apiKey: 'tolk_pub_your_key' });Tolinku.configure() is the same call under the name the other SDKs use. Both
work.
Get the key from the dashboard under API keys. The publishable key
(tolk_pub_) is the right one for an app.
4. Claim the deferred link on first launch
Section titled “4. Claim the deferred link on first launch”This is what recovers the link somebody tapped before they had your app.
const link = await Tolinku.deferred.claimDeferredLink({ appspaceId: '64f0a1b2c3d4e5f60718',});if (link) { // Route to link.deep_link_path, then step 5.}Call it once, on the first launch after install. The claim is spent the first time it succeeds. One call covers both platforms.
Note the field is deep_link_path, in snake case, unlike the iOS, Android and
Flutter models.
appspaceId is the Appspace ID from Settings, not your subdomain. Passing
the subdomain makes every call return null. See
finding your Appspace ID.
5. Report the open
Section titled “5. Report the open”Two calls, and they are not the same event.
An ordinary open arrives in two places, and both need reporting:
import { Linking } from 'react-native';
const initial = await Linking.getInitialURL();if (initial) Tolinku.trackLinkOpen(initial);
Linking.addEventListener('url', ({ url }) => Tolinku.trackLinkOpen(url));Or pass autoTrackLinkOpens: true to init and both are handled for you. It
is off by default because a reported open bills as a click.
The open that follows the claim in step 4, which is the last step of the install funnel:
if (link.url) await Tolinku.trackLinkOpen(link.url, true);Report link.url, never the path. A path is dropped before it leaves the SDK,
silently. This needs SDK 0.8.1 or later.
Whether these are counted, and what they cost, is an Appspace setting: Attributing app opens.
That is a working integration. For referrals, in-app messages, ecommerce events, custom events and every option on the calls above, go to the React Native SDK reference.