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

react-edgee

v1.3.1

Published

React component to use the Edgee SDK

Readme

react-edgee Component

react-edgee is a React component that injects the Edgee SDK script into a React application.

It also sets up listeners to track page navigations via history.pushState and history.replaceState to automatically call the edgee.page method, ensuring page views are tracked during SPA navigations, and provides a React Hook (useEdgeeDataCollection) to simplify event tracking (track, user, page, consent).

NPM NPM Downloads

Install

using npm:

npm install react-edgee

using yarn:

yarn add react-edgee

Usage

import using:

import { EdgeeSdk, EdgeeDataLayer, EdgeeDataLayerObject } from 'react-edgee';

Edgee Data Layer configuration

The Data Layer provides you with fine-grained control over the data sent to various analytics. It is a structured data format used to define and send detailed information about user interactions and page characteristics. By including a Data Layer, you can instruct Edgee on what data to collect, how to process it, and where to send it.

import { EdgeeDataLayerObject, EdgeeDataLayer } from "react-edgee";

const edgeeDataLayer: EdgeeDataLayerObject = {
  // your Data Layer configuration here
};

To learn more about the Data Layer object, visit the Edgee Data Layer docs.

When using app folder structure

Add the EdgeeSdk and EdgeeDataLayer components inside the <body> tag of your RootLayout component:

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        {children}
        <EdgeeDataLayer data={edgeeDataLayer} />
        <EdgeeSdk src={"<YOUR_SDK_URL>"} />
      </body>
    </html>
  );
}

When using pages folder structure

Add the EdgeeSdk and EdgeeDataLayer components in your MyApp component:

export default function MyApp({ Component, pageProps }) {
  return (
    <>
      <Component {...pageProps} />
      <EdgeeDataLayer data={edgeeDataLayer} />
      <EdgeeSdk src="<YOUR_SDK_URL>" />
    </>
  );
}

When using Vite or other frameworks

Add the EdgeeSdk and EdgeeDataLayer component inside the <Router> component in your App:

import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';

const App = () => {
  return (
    <div>
      <Router>
        <EdgeeDataLayer data={edgeeDataLayer} />
        <EdgeeSdk src="<YOUR_SDK_URL>" />
        <Routes>
          {/* Your Routes Here */}
        </Routes>
      </Router>
    </div>
  );
}

export default App;

🔥 Using the React Hook (useEdgeeDataCollection)

The useEdgeeDataCollection hook simplifies event tracking by providing direct access to the Edgee SDK methods.

import { useEdgeeDataCollection } from 'react-edgee';

const MyComponent = () => {
  const { track, user, page, consent } = useEdgeeDataCollection();

  return (
    <>
      <button onClick={() => track({ name: 'button_click' })}>Click Me</button>
      <button onClick={() => user({ user_id: '12345', edgee_id: 'edgee-abc' })}>Identify User</button>
      <button onClick={() => page({ name: 'HomePage', url: 'https://example.com' })}>Track Page</button>
      <button onClick={() => consent('granted')}>Accept Consent</button>
    </>
  );
};

To learn more about the Edgee SDK, visit the Edgee SDK documentation.