SignalFox Docs

Purchases / Monetization tracking

Track purchase activity from RevenueCat or react-native-iap.

SignalFox can track monetization events from supported React Native purchase libraries. Use this when you want to understand how purchase attempts, completions, cancellations, failures, and restores relate to the rest of the user journey.

Configure purchase integrations inside SignalFox.init({ integrations: [...] }).

RevenueCat

Use revenueCatIntegration if your app uses react-native-purchases.

If your app also uses react-native-purchases-ui, pass it as revenueCatUI so SignalFox can better understand paywall activity.

import Purchases from 'react-native-purchases';
import RevenueCatUI from 'react-native-purchases-ui';
import { SignalFox, revenueCatIntegration } from '@asgami-digital/signalfox-react-native';

void SignalFox.init({
  apiKey: signalFoxApiKey,
  integrations: [
    revenueCatIntegration({
      purchases: Purchases,
      revenueCatUI: RevenueCatUI,
    }),
  ],
});

SignalFox can track purchase started, completed, cancelled, failed, and restore activity when RevenueCat exposes that information. Price and currency are included when available.

react-native-iap

Use reactNativeIapIntegration if your app uses react-native-iap.

import * as ReactNativeIap from 'react-native-iap';
import { SignalFox, reactNativeIapIntegration } from '@asgami-digital/signalfox-react-native';

void SignalFox.init({
  apiKey: signalFoxApiKey,
  integrations: [
    reactNativeIapIntegration({
      reactNativeIap: ReactNativeIap,
    }),
  ],
});

SignalFox can track supported purchase requests, completed purchases, errors, and restores from react-native-iap.

Nitro support was introduced in react-native-iap@14.4.0. If your app uses react-native-iap before 14.4.0, purchase_started is not captured automatically by the integration. In that case, call notifyPurchaseStarted() manually immediately before starting the purchase request.

react-native-iap legacy / pre-Nitro fallback

Use this fallback when your app uses react-native-iap before 14.4.0.

Use this manual fallback right before starting the purchase:

import { notifyPurchaseStarted } from '@asgami-digital/signalfox-react-native';

notifyPurchaseStarted();
await ReactNativeIap.requestPurchase({ sku: 'pro_monthly' });

You can call notifyPurchaseStarted() with no arguments for this fallback.

Manual purchase tracking

Use the manual purchase functions only when your purchase path is not covered by RevenueCat or react-native-iap, or when you have a custom purchase flow.

import {
  notifyPurchaseStarted,
  notifyPurchaseCancelled,
  notifyPurchaseCompleted,
  notifyPurchaseFailed,
  notifyRestoreCompleted,
} from '@asgami-digital/signalfox-react-native';

Example:

notifyPurchaseCompleted({
  productId: 'pro_monthly',
  productType: 'subscription',
  price: 7.99,
  currency: 'USD',
  environment: 'production',
});

notifyRestoreCompleted({
  restoredProductIds: ['pro_monthly'],
});

Supported fields include productId, productType, price, currency, hasTrial, trialDays, transactionId, originalTransactionId, environment, restoredProductIds, errorCode, and errorMessage.

Do not manually notify the same purchase events that an automatic integration is already tracking.