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

@cookieless-tech/react

v0.0.0

Published

Framework-agnostic React package for integrating Cookieless Analytics

Downloads

92

Readme

@cookieless-tech/react

A framework-agnostic React package for integrating Cookieless Analytics into any React application (Vite, Remix, Create React App, etc.).

This package acts as a lightweight wrapper around the core cookieless tracking script, automatically injecting it into your app and providing type-safe React hooks for custom interactions.

Installation

To install the package from npm:

npm install @cookieless-tech/react

Setup

Wrap your application (or the part of your application you want to track) with the <Analytics> provider. This component will dynamically inject the tracking script into the DOM.

import { Analytics } from '@cookieless-tech/react';

function App() {
  return (
    <Analytics 
      siteId="YOUR_SITE_ID"
      // Optional configurations:
      // debug={true}
      // blockSelectors=".sensitive-data, #payment-form"
      // customProperties={{ plan: 'pro' }}
    >
      <YourAppComponents />
    </Analytics>
  );
}

Configuration Options

| Prop | Type | Default | Description | |------|------|---------|-------------| | siteId | string | Required | Your Cookieless Analytics Site ID | | scriptSrc | string | https://cdn.cookieless.tech/script.js | Override the tracking script URL | | debug | boolean | false | Enable console debug logging | | blockSelectors | string | undefined | CSS selectors for elements to block from session replay | | customProperties | Record<string, string> | undefined | Custom properties to attach globally via script attributes |

Usage

1. Tracking Page Views

For Single Page Applications (SPAs) where the URL changes without a full page load, you can trigger page views manually using the usePageView hook.

import { usePageView } from '@cookieless-tech/react';

function DashboardRoute() {
  // Triggers a pageview automatically when this component mounts!
  usePageView({ section: 'dashboard' });

  return <div>Dashboard content...</div>;
}

2. Tracking Custom Events

Use the useTrackEvent hook to send custom events when users interact with your app.

import { useTrackEvent } from '@cookieless-tech/react';

function SignupButton() {
  const trackEvent = useTrackEvent();

  const handleSignup = () => {
    // Sends a 'signup_completed' event
    trackEvent('signup_completed', { 
      plan: 'enterprise', 
      revenue: 299 // If revenue is attached, it will be aggregated
    });
  };

  return <button onClick={handleSignup}>Sign Up</button>;
}

3. Setting Global Properties

If you want to attach metadata (like user role or subscription tier) to all future events the user generates during their session, use the useCustomProperties hook.

import { useCustomProperties } from '@cookieless-tech/react';
import { useEffect } from 'react';

function UserProfile({ user }) {
  const setProperties = useCustomProperties();

  useEffect(() => {
    if (user) {
      setProperties({ 
        role: user.role, 
        workspaceId: user.workspaceId 
      });
    }
  }, [user, setProperties]);

  return <div>User Profile</div>;
}

Under the Hood

Unlike @repo/next which has server-side logic and Next.js router integrations, this package does not assume any specific routing framework.

When you use the <Analytics> provider, it dynamically injects the following into your <head>:

<script 
  src="https://cdn.cookieless.tech/script.js" 
  defer="" 
  data-site-id="YOUR_SITE_ID"
></script>

The React hooks (useTrackEvent, usePageView, useCustomProperties) simply pass data down to the globally exposed window.cookieless interface created by that script.