Quickstart

React Native

Prerequisites

Expo

Expo SDK 58

  • Use vexo-analytics 1.14.0 or later on Expo SDK 58. Earlier versions record nothing on SDK 58. See Upgrading to Expo SDK 58 for the support table and the upgrade checklist.
  • Keep the vexo() call at module scope of the root layout (app/_layout.tsx, or src/app/_layout.tsx in the SDK 58 template).

Install

  1. Create an account.

  2. When prompted, create an app and give it a name (you can change it later). Vexo generates the app's API key. You can copy it again later from the app's settings.

  3. Install the package.

    With Expo:

    npx expo install vexo-analytics
    

    With bare React Native, install it with npm (or yarn add vexo-analytics), then install the iOS pods:

    npm install vexo-analytics
    cd ios && pod install
    
  4. Call vexo() with your API key in your app's entry file: usually index.js or App.js, or the root layout (app/_layout.tsx) with Expo Router.

    import { vexo } from 'vexo-analytics';
    
    vexo('YOUR_API_KEY');
    
    Call vexo() at module scope, outside any component or useEffect, so tracking starts when the app starts.
  5. Rebuild the app, because vexo-analytics includes native code. A JavaScript reload or an over-the-air update isn't enough.

    • With Expo: run npx expo run:ios or npx expo run:android, or make a new development build with eas build --profile development.
    • With bare React Native: run npx react-native run-ios or npx react-native run-android.

Verify your first event

  1. Open the app on a device or simulator, and move between two screens.
  2. Wait about 5 seconds. The SDK sends events in batches: when it has 20 events, or 5 seconds after the first one, whichever comes first.
  3. Open your app in Vexo and reload the page. Your device is listed under People, and the "Your app doesn't have data yet" banner is gone. (If you haven't verified your email address, the email verification banner shows there instead.) 🎉

Wait, that's it? Yes! From here, Vexo tracks sessions, screens, taps, and errors with no more code. Go check out the features.

No events?

Check these, most common first:

  • Expo Go. Expo Go can't load the SDK's native code. Use a development build (step 5).
  • A __DEV__ guard. If you wrapped vexo() in if (!__DEV__), a development build never calls it. Remove the guard while you test.
  • A wrong or invalid API key. Events sent with an invalid key are dropped. In a development build, the console shows Vexo: API key rejected (401). Copy the key again from the app's settings.
  • Native code not rebuilt. After you install or upgrade vexo-analytics, rebuild the app (step 5).
  • Simulator networking. The simulator or emulator must be able to reach https://api.vexo.co. Check that it has network access and that a VPN, proxy, or firewall isn't blocking it.
  • Expo SDK 58. Use vexo-analytics 1.14.0 or later. See Upgrading to Expo SDK 58.

Before you ship

Decide whether your development sessions should count in your analytics. To leave them out, or to send them to a staging app, see Development & staging. Before you publish, check App Store & Play Compliance.

Web

  1. Create an account.

  2. Create a web app:

    • On your dashboard, click + Add Application.
    • Enter a name, such as your website's name.
    • Add the domain of your website, such as example.com.
  3. Add the Vexo script. To start collecting web analytics data, paste this script into your site's <head> tag:

    <script src="https://www.vexo.co/analytics.js" defer></script>
    

    With Next.js, use the Script component instead, as shown in Next.js integration.

  4. Optional: track custom events and identify devices.

    Custom event:

    globalThis.vexo?.customEvent('purchase-completed', { amount: 24.99 });
    

    Identify a device:

    globalThis.vexo?.identifyDevice('user@example.com');
    

That's it! Once the script is live on your site, Vexo starts capturing user sessions, session replays, custom events, and more, just like it does on mobile.