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

@fixture-inc/tracker-react

v0.1.2

Published

React hooks and provider for Fixture tracking

Readme

@fixture-inc/tracker-react

React hooks and provider for Fixture tracking.

Installation

pnpm add @fixture-inc/tracker-react

Usage

Provider Setup

Wrap your app with FixtureProvider:

import { FixtureProvider } from '@fixture-inc/tracker-react'

function App() {
  return (
    <FixtureProvider propertyId="your-property-id">
      <YourApp />
    </FixtureProvider>
  )
}

Page tracking happens automatically - no additional setup needed.

Track Events

Use the useFixture hook to track custom events:

import { useFixture } from '@fixture-inc/tracker-react'

function SignupButton() {
  const { trackEvent } = useFixture()

  return (
    <button onClick={() => trackEvent('signup_click', { plan: 'pro' })}>
      Sign Up
    </button>
  )
}

Convenience Hooks

import { useTrackEvent, useVisitorId } from '@fixture-inc/tracker-react'

function Component() {
  // Stable callback for tracking (good for event handlers)
  const trackClick = useTrackEvent('button_click', { location: 'header' })

  // Get current visitor ID
  const visitorId = useVisitorId()

  return <button onClick={trackClick}>Click ({visitorId})</button>
}

API

FixtureProvider

interface FixtureProviderProps {
  children: ReactNode
  propertyId: string
  apiUrl?: string              // Default: 'https://api.fixture.app'
  debug?: boolean
  cookieName?: string          // Default: 'fxid'
  cookieDays?: number          // Default: 365
  cookieDomain?: string        // For cross-subdomain tracking
  trackSpaNavigation?: boolean // Default: true
  trackDomEvents?: boolean     // Default: true
}

useFixture

const {
  trackEvent,    // (name: string, properties?: object) => void
  trackPageview, // () => void
  getVisitorId,  // () => string | null
  tracker,       // BrowserTracker | null (for advanced use)
} = useFixture()

useTrackEvent

// Returns a stable callback
const trackClick = useTrackEvent('event_name', { optional: 'properties' })

useVisitorId

const visitorId = useVisitorId() // string | null

SSR Safety

The provider handles SSR automatically:

  • No window access during server render
  • Tracker initializes on client mount only
  • Hooks return no-op functions during SSR

Features

  • Automatic page tracking - SPA navigation detected via history API
  • SSR safe - Works with Next.js, Remix, etc.
  • TypeScript - Full type definitions included
  • Minimal - 2.2 KB, zero dependencies beyond tracker-browser