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

@calico/analytics

v1.0.1

Published

Analytics SDK for Calico Dashboard - Easy integration for tracking user interactions and configurations

Readme

@calico/analytics

Official Analytics SDK for Calico Dashboard - Track user interactions, configurations, and e-commerce events with ease.

Features

  • 🚀 Easy Integration - Simple setup with auto-tracking capabilities
  • 📊 Comprehensive Event Tracking - Track views, interactions, configurations, and purchases
  • 🔄 Automatic Batching - Efficiently batch events to reduce API calls
  • 🎯 Session Management - Automatic session tracking and user identification
  • 🛡️ Type-Safe - Full TypeScript support with type definitions
  • Performance Optimized - Minimal bundle size with smart event queuing
  • 🔌 Self-Registration - Apps can auto-register to get API keys

Installation

npm install @calico/analytics

or

yarn add @calico/analytics

or

pnpm add @calico/analytics

Quick Start

Basic Setup

import { init, track } from '@calico/analytics'

// Initialize the SDK with your API key
const analytics = init({
  apiKey: 'your-api-key-here',
  debug: true // Enable debug logging in development
})

// Track a page view
track('VIEW')

// Track an interaction with metadata
track('INTERACT', {
  button: 'add-to-cart',
  product: 'custom-chair'
})

// Track a purchase with value
track('PURCHASE', {
  orderId: '12345',
  products: ['chair', 'table']
}, 299.99)

Auto-Registration (for new apps)

If you don't have an API key yet, you can auto-register your app:

import { autoRegister, init } from '@calico/analytics'

// Auto-register your app
const apiKey = await autoRegister('My Awesome App', 'https://myapp.com')

// Initialize with the received API key
const analytics = init({ apiKey })

Configuration Options

interface CalicoAnalyticsConfig {
  apiKey: string           // Required: Your API key
  endpoint?: string        // Optional: Custom endpoint (default: Calico Dashboard)
  debug?: boolean          // Optional: Enable debug logging (default: false)
  autoTrack?: boolean      // Optional: Auto-track page views and clicks (default: true)
  batchSize?: number       // Optional: Events per batch (default: 10)
  flushInterval?: number   // Optional: Auto-flush interval in ms (default: 30000)
}

Event Types

The SDK supports the following event types:

  • VIEW - Page or screen views
  • INTERACT - User interactions (clicks, taps, etc.)
  • CONFIGURE - Product configuration changes
  • SHARE - Social sharing actions
  • EXPORT - Data or configuration exports
  • AR_VIEW - Augmented Reality views
  • ADD_TO_CART - E-commerce cart additions
  • PURCHASE - Completed purchases

API Reference

init(config: CalicoAnalyticsConfig)

Initialize the analytics SDK with your configuration.

const analytics = init({
  apiKey: 'your-api-key',
  debug: true,
  batchSize: 20,
  flushInterval: 60000 // 1 minute
})

track(event: AnalyticsEvent, metadata?: object, value?: number)

Track an event with optional metadata and value.

// Simple event
track('VIEW')

// Event with metadata
track('INTERACT', {
  element: 'button',
  action: 'click',
  label: 'Subscribe'
})

// Event with value (e.g., purchase amount)
track('PURCHASE', { orderId: '123' }, 99.99)

identify(userId: string, traits?: object)

Identify a user and optionally set their traits.

identify('user-123', {
  name: 'John Doe',
  email: '[email protected]',
  plan: 'premium'
})

flush()

Manually flush the event queue to send all pending events.

await flush()

reset()

Clear the current session and user data.

reset()

Advanced Usage

Custom Event Tracking

// Track a complex configuration
track('CONFIGURE', {
  product: 'custom-furniture',
  configuration: {
    material: 'oak',
    color: 'natural',
    dimensions: {
      width: 120,
      height: 75,
      depth: 60
    }
  },
  price: 599.99
}, 599.99)

Manual Session Management

import { init, track, reset } from '@calico/analytics'

const analytics = init({ apiKey: 'your-api-key' })

// Start a new session
reset()

// Track events in the session
track('VIEW', { page: '/products' })
track('INTERACT', { action: 'filter', category: 'chairs' })

// End session and flush events
await flush()

Disable Auto-Tracking

const analytics = init({
  apiKey: 'your-api-key',
  autoTrack: false // Disable automatic tracking
})

// Now you have full control over what gets tracked
document.getElementById('cta-button').addEventListener('click', () => {
  track('INTERACT', {
    button: 'cta',
    location: 'hero-section'
  })
})

React Integration Example

import { useEffect } from 'react'
import { init, track, identify } from '@calico/analytics'

function App() {
  useEffect(() => {
    // Initialize on app mount
    init({ apiKey: process.env.REACT_APP_CALICO_API_KEY })

    // Identify user if logged in
    const user = getCurrentUser()
    if (user) {
      identify(user.id, {
        name: user.name,
        email: user.email
      })
    }
  }, [])

  const handlePurchase = (product, price) => {
    track('PURCHASE', {
      productId: product.id,
      productName: product.name
    }, price)
  }

  return (
    // Your app components
  )
}

Next.js Integration Example

// pages/_app.js or app/layout.tsx
import { useEffect } from 'react'
import { init } from '@calico/analytics'

export default function MyApp({ Component, pageProps }) {
  useEffect(() => {
    init({
      apiKey: process.env.NEXT_PUBLIC_CALICO_API_KEY,
      debug: process.env.NODE_ENV === 'development'
    })
  }, [])

  return <Component {...pageProps} />
}

Browser Support

The SDK supports all modern browsers:

  • Chrome/Edge 80+
  • Firefox 75+
  • Safari 13.1+
  • Opera 67+

License

MIT

Support

For issues, questions, or feature requests, please visit our GitHub repository or contact [email protected].