React Native SDK
Create and manage deep links in your React Native iOS & Android apps
Installation
Install the SDK:
npm install @baxcloud/react-native-linksOptional but recommended — install react-native-device-info for full automatic device analytics (device model, unique device ID):
npm install react-native-device-info && cd ios && pod installWithout it, the SDK falls back to Platform.OS and Platform.Version.
Quick Start
1. Initialize the SDK
1import { BaxCloudLinksClient } from '@baxcloud/react-native-links';
2
3const links = new BaxCloudLinksClient({
4 projectId: 'your-project-id',
5 apiKey: 'your-api-key',
6});2. Create a Deep Link
iOS/Android store URLs are configured once in the Dashboard → BaxLinks → Setup. You only pass link-specific data:
1const link = await links.createLink({
2 fallbackUrl: 'https://yourapp.com/invite?code=ABC123',
3 deepLinkPath: '/invite/ABC123',
4 deepLinkParams: { inviteCode: 'ABC123', referrer: 'john' },
5 title: 'Join us on MyApp!',
6});
7
8// Short URL from project subdomain (e.g. https://xxxxx.baxcloud.link/abc123)
9console.log(link.shortUrl);3. Track Install (device info auto-collected)
1// Device ID, model, OS, OS version collected automatically
2await links.trackInstall({ appVersion: '1.0.0' });4. Get Deferred Deep Link
1// On first launch — device fingerprint matched automatically
2const result = await links.getDeferredLink();
3
4if (result?.found && result.deepLinkPath) {
5 navigation.navigate(result.deepLinkPath, result.deepLinkParams ?? {});
6}Event Tracking
Device info (ID, model, OS, version) is collected automatically — no manual deviceId needed
Convenience Methods
1// First launch — attributes install to a link click
2await links.trackInstall({ appVersion: '1.0.0' });
3
4// Every app open
5await links.trackOpen({ appVersion: '1.0.0' });
6
7// After signup
8await links.trackSignup();
9
10// After a purchase
11await links.trackPurchase(29.99, { eventData: { planId: 'pro' } });
12
13// Custom event
14await links.trackCustomEvent('level_complete', { eventValue: 5 });Low-level trackEvent
1// Use trackEvent() for full control
2await links.trackEvent({
3 eventType: 'CUSTOM',
4 eventName: 'level_complete',
5 eventValue: 5,
6 linkSlug: 'invite-john', // attribute to a specific link
7 platform: 'react_native',
8});Event Types: INSTALLOPENREINSTALLSIGNUPPURCHASECUSTOM
Deferred Deep Linking
Navigate users to the right screen after install
Call getDeferredLink() on first launch. BaxCloud fingerprints the device IP and matches it to a recent link click (48-hour window).
Full Implementation
1import AsyncStorage from '@react-native-async-storage/async-storage';
2
3const checkDeferredLink = async () => {
4 const alreadyChecked = await AsyncStorage.getItem('bax_deferred_checked');
5 if (alreadyChecked) return;
6 await AsyncStorage.setItem('bax_deferred_checked', 'true');
7
8 // Track install (device info auto-collected)
9 await links.trackInstall({ appVersion: '1.0.0' });
10
11 // Check for deferred deep link
12 const result = await links.getDeferredLink();
13 if (result?.found && result.deepLinkPath) {
14 navigation.navigate(result.deepLinkPath, result.deepLinkParams ?? {});
15 }
16};How it works: Device IP is matched to a recent click within 48 hours. Returns deepLinkPath + deepLinkParams.
Attribution & Install Tracking
Query attributed installs for referral rewards
When an INSTALL event is reported, BaxCloud matches it to a link click via IP fingerprinting (7-day window).
Query Attributed Installs
1const result = await links.getAttributedInstalls();
2console.log(result.pagination.total);
3
4// Filter by link
5const linkInstalls = await links.getAttributedInstalls({
6 linkId: 'your-link-id',
7 page: 1,
8 limit: 20,
9});Attribution Webhook
A link.install.attributed webhook fires on your server when attribution succeeds:
1// Node.js webhook handler
2app.post('/webhooks/baxcloud', (req, res) => {
3 const { event, linkSlug, deepLinkParams, install } = req.body;
4
5 if (event === 'link.install.attributed') {
6 const referralCode = deepLinkParams?.referralCode;
7 if (referralCode) rewardUser(referralCode, install.country);
8 }
9
10 res.sendStatus(200);
11});API Reference
Link Management
createLink(options)Create a new deep linkgetLink(linkId)Get a link by IDlistLinks(params?)List project linksupdateLink(id, options)Update a linkdeleteLink(id)Delete a linkEvent Tracking
trackInstall({appVersion?})Track first install — auto device infotrackOpen({appVersion?})Track app open — auto device infotrackSignup({eventData?})Track signup — auto device infotrackPurchase(value, {eventData?})Track purchase — auto device infotrackCustomEvent(name, {value?, eventData?})Track custom eventtrackEvent(TrackEventOptions)Low-level event trackingDeep Linking & Attribution
getDeferredLink()Retrieve deferred deep link (auto device ID)getAttributedInstalls(opts?)Query attributed installsgetAppConfig()Get project config + shortLinkBasegetShortUrl(link)Returns link.shortUrl (e.g. https://xxxxx.baxcloud.link/slug)getShortUrlFromSlug(slug)Build short URL after getAppConfig() is calledPlatform Setup
Required native configuration for deep link handling. Get your subdomain from Dashboard → BaxLinks → Setup.
Android — AndroidManifest.xml
Inside your <activity> tag:
<!-- URI Scheme -->
<intent-filter>
<data android:scheme="@string/baxcloud_links_scheme" android:host="open" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<!-- App Links (HTTPS) -->
<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="@string/baxcloud_links_default_url" />
</intent-filter>Android — res/values/strings.xml
<resources>
<string name="app_name">YourApp</string>
<!-- Your URI scheme, e.g. "myapp" -->
<string name="baxcloud_links_scheme">myapp</string>
<!-- Replace xxxxx with YOUR project subdomain from Dashboard → BaxLinks → Setup -->
<string name="baxcloud_links_default_url">xxxxx.baxcloud.link</string>
</resources>iOS — Associated Domains (Xcode)
- Open project in Xcode
- Select your target → Signing & Capabilities
- Click + Capability → Associated Domains
- Add
applinks:*.baxcloud.link(iOS 14+ wildcard — covers all project subdomains)
iOS — URI Scheme in Info.plist
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>myapp</string>
</array>
</dict>
</array>