Respectlytics Respect lytics
Menu
React Native Social login Privacy-first

How to track social login (Google / Apple) in React Native without personal data

Social login flows hand off authentication to a third party (Apple, Google, Facebook), and most analytics SDKs use the redirect-back as a trigger to ingest the provider's user data. Respectlytics helps developers avoid collecting personal data in the first place: in React Native, the social login event is the same single named call as a regular login, with the provider encoded in the event name. The OAuth token, provider account ID, email, and profile picture all stay in your authentication code path. Below: the React Native pattern, why the provider goes in the event name, and what to leave behind.

Fire the call in the success branch of your post-OAuth handoff — after your backend verifies the provider's token and creates / fetches the user record. Don't pass any of the provider's payload. Distinct event names per provider handle the segmentation.

Install the React Native SDK

bash Respectlytics
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

js Respectlytics
// 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

js Respectlytics
import Respectlytics from '@respectlytics/react-native';
import { GoogleSignin } from '@react-native-google-signin/google-signin';

export async function googleSignIn() {
  await GoogleSignin.hasPlayServices();
  const { idToken } = await GoogleSignin.signIn();
  const response = await api.exchangeGoogleToken(idToken);
  if (response.ok) {
    Respectlytics.track('login_google');
  }
}

Same pattern works for Apple via @invertase/react-native-apple-authentication and Facebook via react-native-fbsdk-next — distinct event_name per provider.

Privacy & implementation notes

OAuth tokens, refresh tokens, and provider account IDs are credentials. They belong in your authentication code path with proper access controls — not in your product analytics pipeline. Respectlytics's API rejects them at the boundary. If a teammate adds them by reflex, the integration test fails.

Don't write track('login', { provider: 'google' }) — Respectlytics rejects the parameter. Instead write track('login_google'). Aggregation buckets it automatically; the funnel auto-discovery picks it up; the breakdown is queryable without any custom configuration.

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

Social login eventFirebase AnalyticsMixpanelRespectlytics
Provider account ID storedYesYesNever
Provider email / name storedCommonCommonNever
OAuth token / refresh tokenYes (server-side)Yes (server-side)Never
Provider as event parameterRecommendedRecommendedUse distinct event_name
Per-provider login rateYesYesYes (default aggregation)

Frequently asked questions

What event name should we use per provider?

login_google, login_apple, login_facebook, etc. — one per provider you support. Most apps have 2–3 providers; that's a comfortable taxonomy size. The aggregation gives you per-provider login rate without storing provider account IDs.

Should we track the difference between first-time social login and returning?

Yes, with distinct event names: account_created_google (first-time) and login_google (returning). The two answer different product questions — acquisition vs retention — and conflating them blurs both.

What about Sign in with Apple's hide-my-email relay?

Doesn't change anything from Respectlytics's perspective — the event you fire is login_apple regardless of whether the user used a real email or the relay. Apple's hide-my-email is between the user and your auth backend; Respectlytics wasn't going to receive an email anyway.

Should we instrument social login button views?

Useful for funnel diagnosis. login_screen_viewed + login_google gives you the per-button conversion rate. Don't bother with hover / focus events on mobile — they don't carry signal.

Related guides

Track what matters. Collect nothing you don't.

Five-field event schema, RAM-only event queue, no IDFA, no AAID, no persistent user IDs. Helps developers avoid collecting personal data in the first place.