npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@murga/react-native-formo-analytics

v1.0.0

Published

Formo Analytics SDK for React Native - Track wallet events and user analytics in mobile dApps

Readme

@formo/react-native-analytics

Formo Analytics SDK for React Native - Track wallet events and user analytics in mobile dApps.

Installation

npm install @formo/react-native-analytics @react-native-async-storage/async-storage

# or with yarn
yarn add @formo/react-native-analytics @react-native-async-storage/async-storage

# or with pnpm
pnpm add @formo/react-native-analytics @react-native-async-storage/async-storage

iOS Setup

cd ios && pod install

Quick Start

1. Wrap your app with the provider

import AsyncStorage from '@react-native-async-storage/async-storage';
import { FormoAnalyticsProvider } from '@formo/react-native-analytics';

function App() {
  return (
    <FormoAnalyticsProvider
      writeKey="your-write-key"
      asyncStorage={AsyncStorage}
      options={{
        app: {
          name: 'MyApp',
          version: '1.0.0',
        },
      }}
    >
      <YourApp />
    </FormoAnalyticsProvider>
  );
}

2. Use the hook in your components

import { useFormo } from '@formo/react-native-analytics';
import { useEffect } from 'react';

function HomeScreen() {
  const formo = useFormo();

  useEffect(() => {
    // Track screen view
    formo.screen('Home');
  }, []);

  const handleSignUp = () => {
    // Track custom event
    formo.track('Sign Up Button Pressed', {
      screen: 'Home',
    });
  };

  return <Button onPress={handleSignUp}>Sign Up</Button>;
}

Wagmi Integration

For dApps using Wagmi for wallet connections, you can enable automatic wallet event tracking:

import { QueryClient } from '@tanstack/react-query';
import { createConfig } from 'wagmi';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { FormoAnalyticsProvider } from '@formo/react-native-analytics';

const queryClient = new QueryClient();
const wagmiConfig = createConfig({
  // your wagmi config
});

function App() {
  return (
    <FormoAnalyticsProvider
      writeKey="your-write-key"
      asyncStorage={AsyncStorage}
      options={{
        wagmi: {
          config: wagmiConfig,
          queryClient: queryClient,
        },
      }}
    >
      <YourApp />
    </FormoAnalyticsProvider>
  );
}

This automatically tracks:

  • Wallet connections and disconnections
  • Chain changes
  • Signature requests (with QueryClient)
  • Transaction events (with QueryClient)

API Reference

FormoAnalyticsProvider Props

| Prop | Type | Required | Description | |------|------|----------|-------------| | writeKey | string | Yes | Your Formo write key | | asyncStorage | AsyncStorageInterface | Yes | AsyncStorage instance | | options | Options | No | Configuration options | | disabled | boolean | No | Disable analytics |

Options

interface Options {
  // Wagmi integration
  wagmi?: {
    config: any;      // Wagmi config from createConfig()
    queryClient?: any; // TanStack QueryClient for mutation tracking
  };

  // App information
  app?: {
    name?: string;
    version?: string;
    build?: string;
    bundleId?: string;
  };

  // Event batching
  flushAt?: number;       // Batch size (default: 20)
  flushInterval?: number; // Flush interval in ms (default: 30000)
  retryCount?: number;    // Retry count (default: 3)
  maxQueueSize?: number;  // Max queue size in bytes (default: 500KB)

  // Autocapture control
  autocapture?: boolean | {
    connect?: boolean;
    disconnect?: boolean;
    signature?: boolean;
    transaction?: boolean;
    chain?: boolean;
  };

  // Tracking control
  tracking?: boolean | {
    excludeChains?: number[];
  };

  // Logging
  logger?: {
    enabled?: boolean;
    levels?: ('debug' | 'info' | 'warn' | 'error' | 'log')[];
  };

  // Custom API host
  apiHost?: string;

  // Ready callback
  ready?: (formo: IFormoAnalytics) => void;
}

useFormo Hook Methods

screen(name, properties?, context?, callback?)

Track a screen view.

formo.screen('Profile', { userId: '123' });

track(event, properties?, context?, callback?)

Track a custom event.

formo.track('Purchase Completed', {
  revenue: 99.99,
  currency: 'USD',
  productId: 'nft-001',
});

identify(params, properties?, context?, callback?)

Identify a user by their wallet address.

formo.identify({
  address: '0x1234...',
  userId: 'user-123',
  providerName: 'MetaMask',
  rdns: 'io.metamask',
});

connect(params, properties?, context?, callback?)

Track wallet connection.

formo.connect({
  chainId: 1,
  address: '0x1234...',
});

disconnect(params?, properties?, context?, callback?)

Track wallet disconnection.

formo.disconnect({
  chainId: 1,
  address: '0x1234...',
});

chain(params, properties?, context?, callback?)

Track chain change.

formo.chain({
  chainId: 137,
  address: '0x1234...',
});

signature(params, properties?, context?, callback?)

Track signature event.

import { SignatureStatus } from '@formo/react-native-analytics';

formo.signature({
  status: SignatureStatus.CONFIRMED,
  chainId: 1,
  address: '0x1234...',
  message: 'Sign this message',
  signatureHash: '0xabcd...',
});

transaction(params, properties?, context?, callback?)

Track transaction event.

import { TransactionStatus } from '@formo/react-native-analytics';

formo.transaction({
  status: TransactionStatus.BROADCASTED,
  chainId: 1,
  address: '0x1234...',
  to: '0x5678...',
  value: '1000000000000000000',
  transactionHash: '0xdef...',
});

Consent Management

// Opt out of tracking (GDPR compliance)
formo.optOutTracking();

// Check opt-out status
const isOptedOut = formo.hasOptedOutTracking();

// Opt back in
formo.optInTracking();

Event Types

The SDK automatically enriches events with mobile-specific context:

  • Device information (OS, version, model)
  • Screen dimensions and density
  • Locale and timezone
  • App information (if provided)
  • Anonymous ID (persistent across sessions)

Offline Support

Events are queued locally and sent when the device has network connectivity. Events are automatically flushed when:

  • The batch size is reached (default: 20 events)
  • The flush interval passes (default: 30 seconds)
  • The app goes to background

License

MIT