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

webjoy-analytics-mobile

v1.0.1

Published

Mobile analytics SDK for Webjoy - Track installs, sessions, events, and more

Downloads

21

Readme

webjoy-analytics-mobile

Comprehensive mobile analytics SDK for React Native apps. Track installs, sessions, events, screen views, and crashes with just 2 lines of code.

🔐 Security

Your Supabase credentials are SAFE:

  • ✅ Anon key is public (protected by Row Level Security)
  • ✅ Each project is isolated
  • ✅ Clients can only write to their own project_id
  • ✅ Service key never exposed

📦 Installation

npm install webjoy-analytics-mobile

# Or with yarn
yarn add webjoy-analytics-mobile

Peer Dependencies

npm install @supabase/supabase-js @react-native-async-storage/async-storage react-native-device-info expo-application expo-device

🚀 Quick Start

1. Get Your Project ID

Log into your Webjoy dashboard and copy your project ID.

2. Initialize SDK (2 lines!)

// App.tsx or App.js
import { useEffect } from 'react';
import WebjoyAnalytics from 'webjoy-analytics-mobile';

export default function App() {
  useEffect(() => {
    WebjoyAnalytics.init({
      projectId: 'your-project-id-from-dashboard',
      supabaseUrl: 'https://your-project.supabase.co',
      supabaseKey: 'your-anon-key'
    });
  }, []);

  return <YourApp />;
}

That's it! The SDK now automatically tracks:

  • ✅ App installs
  • ✅ App opens/closes
  • ✅ Session duration
  • ✅ Daily/Monthly active users
  • ✅ Crashes

📊 What Gets Tracked Automatically

App Installs

  • First launch only (never duplicated)
  • Platform (iOS/Android)
  • App version
  • OS version
  • Device model & brand
  • Country code

Sessions

  • App opens/closes
  • Session duration
  • Active users (DAU/MAU)

Crashes

  • Unhandled errors
  • Stack traces
  • Screen where crash occurred

🎯 Manual Tracking (Optional)

Track Custom Events

import WebjoyAnalytics from 'webjoy-analytics-mobile';

// Simple event
WebjoyAnalytics.trackEvent('button_clicked');

// Event with properties
WebjoyAnalytics.trackEvent('purchase_completed', {
  amount: 29.99,
  item: 'Premium Plan',
  currency: 'USD'
});

WebjoyAnalytics.trackEvent('user_signup', {
  method: 'email',
  plan: 'free'
});

Track Screen Views

// In your screen components
import { useEffect } from 'react';
import WebjoyAnalytics from 'webjoy-analytics-mobile';

function HomeScreen() {
  useEffect(() => {
    WebjoyAnalytics.trackScreen('HomeScreen');
  }, []);

  return <View>...</View>;
}

Track Errors Manually

try {
  // Your code
} catch (error) {
  WebjoyAnalytics.trackCrash(error);
}

⚙️ Configuration Options

WebjoyAnalytics.init({
  projectId: 'your-project-id',
  supabaseUrl: 'https://your-project.supabase.co',
  supabaseKey: 'your-anon-key',
  
  // Optional settings
  enableAutoTracking: true,      // Auto-track sessions (default: true)
  enableCrashReporting: true,    // Auto-track crashes (default: true)
  debug: false                   // Enable debug logs (default: false)
});

📈 View Analytics

Log into your Webjoy dashboard to see:

  • 📥 Total Downloads
  • 👥 Daily Active Users (DAU)
  • 📊 Monthly Active Users (MAU)
  • ⏱️ Average Session Duration
  • 📱 Platform Breakdown (iOS vs Android)
  • 🎯 Top Events
  • 🔥 Most Viewed Screens
  • 💥 Crash Reports

🔒 Privacy & GDPR Compliance

  • No personal data collected by default
  • Device IDs are anonymized
  • You control all data (stored in your Supabase)
  • Easy to implement data deletion requests

🛠️ Advanced Usage

Get Current Session ID

const sessionId = WebjoyAnalytics.getSessionId();

Get Device ID

const deviceId = WebjoyAnalytics.getDeviceId();

Clean Up

// Call when unmounting or logging out
WebjoyAnalytics.destroy();

📝 TypeScript Support

Fully typed with TypeScript definitions included.

import WebjoyAnalytics, { WebjoyConfig, EventProperties } from 'webjoy-analytics-mobile';

🐛 Troubleshooting

"Analytics not initialized"

Make sure you call init() before any other methods.

Data not showing in dashboard

  • Check your project ID is correct
  • Verify Supabase URL and anon key
  • Enable debug: true to see logs

Duplicate install tracking

The SDK prevents this automatically using device ID + project ID unique constraint.

📚 Examples

E-commerce App

// Track product views
WebjoyAnalytics.trackEvent('product_viewed', {
  productId: '123',
  category: 'Electronics',
  price: 299.99
});

// Track purchases
WebjoyAnalytics.trackEvent('purchase_completed', {
  orderId: 'ORD-456',
  total: 299.99,
  items: 3
});

Social App

// Track posts
WebjoyAnalytics.trackEvent('post_created', {
  type: 'photo',
  hasCaption: true
});

// Track engagement
WebjoyAnalytics.trackEvent('post_liked', {
  postId: '789'
});

🤝 Support

Need help? Contact [email protected]

📄 License

MIT