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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@chain1/analytics-wrapper

v1.0.1

Published

Analytics wrapper for Airbridge and custom tracking

Readme

@chain1/analytics-wrapper

Analytics tracking wrapper for React Native with Airbridge SDK integration.

Installation

npm install @chain1/analytics-wrapper
npm install airbridge-react-native-sdk

iOS Setup

cd ios && pod install

Add to ios/Podfile:

pod 'AirBridge', '~> 4.7.0'

Android Setup

Add to android/build.gradle:

allprojects {
  repositories {
    maven { url 'https://jitpack.io' }
  }
}

Initialization

import { Analytics } from '@chain1/analytics-wrapper';

// Initialize in App.tsx or index.js
Analytics.initialize('YOUR_AIRBRIDGE_APP_TOKEN');

Features

  • Wallet lifecycle tracking
  • Transaction event monitoring
  • User action analytics
  • Custom event tracking
  • Airbridge SDK integration
  • TypeScript support

Usage

Wallet Events

import { Analytics } from '@chain1/analytics-wrapper';

// Track wallet creation
Analytics.trackWalletCreate('internal'); // or 'metamask', 'walletconnect'

// Track wallet import
Analytics.trackWalletImport('mnemonic'); // or 'private_key'

// Track wallet connection
Analytics.trackWalletConnect('walletconnect');

Transaction Events

// Track swap transaction
Analytics.trackSwap({
  fromToken: 'BNB',
  toToken: 'USDT',
  amount: '1.5',
  dex: 'pancakeswap'
});

// Track transfer
Analytics.trackTransfer({
  token: 'BNB',
  amount: '0.5',
  recipient: '0x...'
});

// Track transaction success
Analytics.trackTransactionSuccess('0x...');

// Track transaction failure
Analytics.trackTransactionFail('0x...', 'Insufficient gas');

User Actions

// Track screen view
Analytics.trackScreenView('WalletScreen');

// Track button click
Analytics.trackButtonClick('send_button');

// Track feature usage
Analytics.trackFeatureUsage('dex_swap');

Custom Events

// Track custom event with properties
Analytics.trackEvent('custom_event', {
  category: 'engagement',
  label: 'feature_x',
  value: 100
});

Event Types

Predefined Events

| Event | Method | Description | |-------|--------|-------------| | wallet_link | trackWalletCreate | Wallet creation completed | | wallet_import | trackWalletImport | Wallet import completed | | wallet_connect | trackWalletConnect | External wallet connected | | swap_execute | trackSwap | Token swap executed | | transfer_send | trackTransfer | Token transfer sent | | tx_success | trackTransactionSuccess | Transaction confirmed | | tx_fail | trackTransactionFail | Transaction failed | | screen_view | trackScreenView | Screen viewed | | button_click | trackButtonClick | Button clicked | | feature_use | trackFeatureUsage | Feature used |

API Reference

Analytics Class

Static methods for event tracking:

class Analytics {
  static initialize(appToken: string): void;
  static trackWalletCreate(chainType?: string): void;
  static trackWalletImport(importType?: string): void;
  static trackWalletConnect(walletType?: string): void;
  static trackSwap(params: SwapParams): void;
  static trackTransfer(params: TransferParams): void;
  static trackTransactionSuccess(txHash: string): void;
  static trackTransactionFail(txHash: string, error?: string): void;
  static trackScreenView(screenName: string): void;
  static trackButtonClick(buttonName: string): void;
  static trackFeatureUsage(featureName: string): void;
  static trackEvent(eventName: string, properties?: object): void;
}

TypeScript Types

interface SwapParams {
  fromToken: string;
  toToken: string;
  amount: string;
  dex?: string;
}

interface TransferParams {
  token: string;
  amount: string;
  recipient: string;
}

Best Practices

Event Naming

Use consistent naming conventions:

// Good
Analytics.trackEvent('wallet_create', { action: 'completed' });

// Avoid
Analytics.trackEvent('CreateWallet', { action: 'done' });

Data Privacy

Never track sensitive information:

// Bad - Don't do this
Analytics.trackEvent('wallet', { privateKey: '0x...' });

// Good
Analytics.trackEvent('wallet_create', { chainType: 'bsc' });

Error Tracking

Track errors for debugging:

try {
  await executeSwap();
  Analytics.trackTransactionSuccess(txHash);
} catch (error) {
  Analytics.trackTransactionFail(txHash, error.message);
}

Advanced Usage

User Identification

import Airbridge from 'airbridge-react-native-sdk';

// Set user ID
Airbridge.setUserID('user_12345');

// Set user alias
Airbridge.setUserEmail('[email protected]');

// Set user attributes
Airbridge.setUserAttribute('plan', 'premium');

Custom Properties

// Add context to events
Analytics.trackEvent('purchase', {
  product_id: 'bnb_100',
  price: 100,
  currency: 'USD',
  payment_method: 'credit_card'
});

Platform Support

  • iOS 10.0+
  • Android API 21+
  • React Native 0.60.0+

License

MIT

Repository

https://github.com/stochain/packages