Skip to main content
This guide walks you through installing and configuring the Tappd Mobile SDK from scratch. By the end, your React Native app will be tracking app lifecycle events, screen views, and custom events — with users identified by their account data.

Prerequisites

Before you begin, make sure you have the following ready:
  • A Tappd account and your App ID
  • A React Native project running version 0.60 or later
  • iOS: Xcode and CocoaPods installed
  • Android: Android Studio installed
1
Get Your App ID
2
Your App ID connects the SDK to your Tappd project. Retrieve it from the dashboard before writing any code.
3
  • Log into your Tappd Dashboard
  • Navigate to Settings → Apps
  • Create a new mobile app or select an existing one
  • Copy your App ID — it looks like a1b2c3d4-e5f6-7890-abcd-ef1234567890
  • 4
    Keep your App ID close by — you’ll need it in the next step. Treat it like an API key and avoid committing it directly to source control. Use environment variables in production.
    5
    Install Dependencies
    6
    Install the SDK package and its required peer dependency.
    7
    npm
    npm install @tappd/mobile-sdk @react-native-async-storage/async-storage
    
    yarn
    yarn add @tappd/mobile-sdk @react-native-async-storage/async-storage
    
    8
    Optionally, install react-native-device-info to capture richer device metadata such as device model and app version. This package is recommended but not required.
    9
    npm
    npm install react-native-device-info
    
    yarn
    yarn add react-native-device-info
    
    10
    For iOS, link the native dependencies by running CocoaPods after installing.
    11
    cd ios && pod install && cd ..
    
    12
    Android requires no additional linking. The SDK works out of the box on Android after the npm install.
    13
    Initialize the SDK
    14
    Initialize the SDK at the top level of your app, before the root component mounts. Open App.js or App.tsx and add the following.
    15
    import React from 'react';
    import TappdSDK from '@tappd/mobile-sdk';
    
    const tappd = new TappdSDK({
      appId: 'YOUR_APP_ID',
      apiUrl: 'https://sdk.gotappd.com/api/v1/sdk',
      autoTrack: true,
      sessionTimeout: 30,
      enableAutoScreenTracking: true,
      debug: false
    });
    
    // Make it available throughout your app
    global.tappd = tappd;
    
    function App() {
      return (
        // Your app content
      );
    }
    
    export default App;
    
    16
    Replace YOUR_APP_ID with the App ID you copied from the dashboard. See the Configuration reference for a full breakdown of every available option.
    17
    Identify Users
    18
    Call identify() whenever a user logs in or signs up so that all future events are linked to their profile.
    19
    async function handleLogin(userId, email, name) {
      await tappd.identify({
        external_id: userId,  // Recommended: your own user ID
        name: name,
        email: email,
        phone: '+1234567890',
        // Any additional attributes you want to store
        plan: 'premium',
        age: 28
      });
    }
    
    20
    At least one identifier is required — external_id, email, phone, or alias. Using external_id (your own user ID from your auth system) is recommended for the most reliable customer matching. The SDK handles its own internal tracking identifier automatically.
    21
    After identify() is called, all subsequent track() and trackScreen() calls are automatically associated with that user. You only need to call identify() once per login.
    22
    Track Screens
    23
    Record screen views so you can see which parts of your app users visit most. Use useFocusEffect from React Navigation to fire a screen event each time a screen comes into focus.
    24
    import React from 'react';
    import { View } from 'react-native';
    import { useFocusEffect } from '@react-navigation/native';
    
    function HomeScreen() {
      useFocusEffect(
        React.useCallback(() => {
          global.tappd.trackScreen('HomeScreen', {
            category: 'main',
            section: 'dashboard'
          });
        }, [])
      );
    
      return <View>{/* screen content */}</View>;
    }
    
    25
    When autoTrack: true is set in your config, the SDK also automatically records these app lifecycle events without any additional code:
    26
    EventTriggered Whenapp.openedThe app is launchedapp.foregroundThe app returns from the backgroundapp.backgroundThe app moves to the backgroundapp.closedThe app is closed via cleanup()
    27
    Track Custom Events
    28
    Fire custom events to capture any user action that matters to your business — purchases, button clicks, form completions, and more.
    29
    // Track a purchase
    await global.tappd.track('purchase', {
      amount: 99.99,
      currency: 'USD',
      productId: 'prod_123'
    });
    
    // Track a button click
    await global.tappd.track('button_click', {
      buttonId: 'signup',
      location: 'onboarding'
    });
    
    30
    Pass any JSON-serializable properties as the second argument. These properties appear in your Tappd dashboard alongside each event.

    Project Setup Patterns

    Choose the pattern that best fits how your project is structured. All three approaches produce the same result — pick the one that matches your team’s conventions.

    Verify Installation

    Enable debug: true when you first set up the SDK to confirm everything is working. With debug mode on, the SDK prints detailed logs to your React Native console.
    const tappd = new TappdSDK({
      appId: 'YOUR_APP_ID',
      debug: true
    });
    
    Open your Metro bundler console or device logs and look for output like this:
    [Tappd SDK] Initialized with App ID: a1b2c3d4...
    [Tappd SDK] New session started: sess_abc123
    [Tappd SDK] Event tracked: app.opened
    
    Disable debug: true before releasing to production. Debug logging can expose sensitive data in device logs and may affect performance.

    Next Steps

    Configuration

    Customize every SDK option — session timeouts, polling intervals, in-app messages, and environment-based config.

    React Navigation

    Integrate automatic screen tracking with your React Navigation stack.

    Push Notifications

    Register FCM and APNs push tokens and manage notification subscriptions.

    API Reference

    Browse every method available on the TappdSDK instance with full parameter documentation.