Fire the call inside the share-sheet completion callback when the user has actually completed the share (not when they open the sheet — abandonment is common). Encode the chosen channel into the event name.
▸Install the React Native SDK
npm install @respectlytics/react-native
# or
yarn add @respectlytics/react-native
JavaScript-only — no native modules, no auto-linking, no New Architecture migration concerns. Bundle size: ~14KB minified+gzipped. Works in any Expo project (managed or bare) without expo prebuild.
▸Initialize Respectlytics in React Native
// App.tsx (or App.js)
import { useEffect } from 'react';
import Respectlytics from '@respectlytics/react-native';
export default function App() {
useEffect(() => {
Respectlytics.configure({ appKey: '<YOUR_APP_KEY>' });
}, []);
return <YourApp />;
}
Initialize once in your top-level component. No native config; no Info.plist or AndroidManifest changes. The SDK is Hermes- and JSC-compatible.
▸Track the event in React Native
import Respectlytics from '@respectlytics/react-native';
import { Share } from 'react-native';
export async function shareContent(message) {
try {
const result = await Share.share({ message });
if (result.action === Share.sharedAction) {
// iOS fills in `activityType`; Android leaves it null.
const channel = result.activityType?.split('.').pop() ?? 'other';
Respectlytics.track(`share_${channel.toLowerCase()}`);
} else if (result.action === Share.dismissedAction) {
Respectlytics.track('share_cancelled');
}
} catch {}
}
iOS reports the chosen channel via activityType; Android does not (returns null). Fall back to share_other on Android — or fire individual platform-specific share intents for finer attribution.
✦Privacy & implementation notes
Putting the channel as a parameter ({ channel: 'twitter' }) is the natural first instinct and is exactly what Respectlytics's API rejects. Encode it as the event name — share_twitter — and you get the same downstream queryability without storing parameters.
Fire on share completion, not on share-sheet presentation. Share-sheet presentation is fairly common (the user is just exploring); actual completion is much rarer and is the meaningful signal. The two rates differ by 5–10× in most apps.
The React Native SDK is JavaScript-only — no Objective-C/Swift bridging on iOS, no Java/Kotlin bridging on Android. Side effects: no react-native link, no auto-linking, no New Architecture migration concerns, no platform-channel exception surfaces. Trade-off: no access to platform-only metadata (which we don't want to collect anyway).
Works in Expo managed workflow without expo prebuild. No config plugin is required. EAS Build users: nothing to configure. This is the smoothest integration path on RN — most analytics SDKs require ejecting from managed.
⇋How this compares to other analytics SDKs
| Share event | Firebase Analytics | Mixpanel | Respectlytics |
|---|---|---|---|
| Share channel as parameter | Recommended | Recommended | Use distinct event_name |
| Shared content ID | Recommended | Recommended | Out of scope (use content backend) |
| Recipient data (when accessible) | Possible | Possible | Forbidden (PII) |
| Per-user share count | Yes | Yes | Out of scope |
| Share rate by content / channel | Per-user | Per-user | Use distinct event_names + content backend |
❓Frequently asked questions
How do we know which channels are most popular?
Distinct event names per channel: share_imessage, share_email, share_twitter, share_copy_link. Aggregation gives per-channel rate. iOS's UIActivityViewController and Android's Intent chooser deliver the selected channel in the completion callback — encode it into the event name.
What about shared content metadata?
Stays in your content backend. The CMS or content database knows what was shared. Respectlytics tells you that a share happened in this session — the join to specific content is a backend concern.
Can we measure share-induced installs?
Server-side via deferred deep links and install attribution. App Store Connect / Play Console deliver the attribution; your backend correlates the shared link's tracking parameter with the resulting install. Respectlytics doesn't ingest install attribution — it's not the right system for that.
What if the share sheet completes but the user cancels?
iOS's UIActivityViewController and Android's Intent chooser both call back with a cancellation flag. Don't fire share_* on cancel — fire share_cancelled (a single event regardless of channel) if you want to track abandonment.