Layers

SDK — Expo

Config plugin wrapper around @layers/react-native.

View as Markdown

Status: alpha. @layers/expo is published to npm (current version at the time of writing: 2.2.0). It is a convenience wrapper that depends on @layers/react-native and ships an Expo config plugin.

Install

npx expo install @layers/expo

Configure the plugin

Add to app.json / app.config.ts:

{
  "expo": {
    "plugins": [
      ["@layers/expo", {
        "appId": "app_xxx",
        "iosUserTrackingUsageDescription": "We use this to personalize your experience."
      }]
    ]
  }
}

The plugin wires the iOS NSUserTrackingUsageDescription Info.plist key and the Android permissions required by the underlying @layers/react-native native module.

Use the SDK

Initialization and runtime APIs come from @layers/react-native — see the React Native guide for the full API surface.

import Layers from '@layers/expo';

await Layers.init({
  apiKey: 'unused-but-required-by-type',
  appId: 'app_xxx',
  environment: __DEV__ ? 'development' : 'production',
});

await Layers.track('purchase_success', { revenue: 9.99, currency: 'USD' });

ATT

import Layers from '@layers/expo';
await Layers.requestTracking();

Expo Go

The underlying React Native package has native modules (ATT, SKAN), so full functionality requires a development build. Expo Go can still run track, screen, and setUserProperties — anything that doesn't touch native APIs.

EAS Build

EAS Build picks up the config plugin automatically — no extra steps.

eas build --platform ios
eas build --platform android

On this page