Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@vyro-x/react-insights-client

Package Overview
Dependencies
Maintainers
6
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vyro-x/react-insights-client

Insights client for React

latest
npmnpm
Version
0.39.0
Version published
Weekly downloads
260
42.08%
Maintainers
6
Weekly downloads
 
Created
Source

@vyro-x/react-insights-client

Client-side insights system integration for React & Next.js

Usage

Install

npm i @vyro-x/react-insights-client

or

pnpm i @vyro-x/react-insights-client

InsightsProvider

Wrap your app with the InsightsProvider

import { InsightsProvider, CollectorApi } from '@vyro-x/react-insights-client';
import { authService } from '@vyro-x/react-auth';
import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { App } from './App';

const container = document.getElementById('root');
if (!container) throw new Error('Failed to find the root element');
const root = ReactDOM.createRoot(container);

const collectorApi = new CollectorApi({
  endpoint: process.env.REACT_APP_COLLECTOR_API_URL,
  getAccessToken: authService.tokens.getAccessToken,
});

root.render(
  <React.StrictMode>
    <InsightsProvider collectorApi={collectorApi}>
      <App />
    </InsightsProvider>
  </React.StrictMode>,
);

Track

Track events using the useInsights hook.

import { useInsights, EventInput } from '@vyro-x/react-insights-client';

export default function Page() {
  const { trackEvent } = useInsights();

  return (
    <button
      onClick={() =>
        trackEvent({
          type: EventInput.type.CLICK,
          // ...
        })
      }
    >
      My button
    </button>
  );
}

Config

The collector-api is deployed to the following URLs:

REACT_APP_COLLECTOR_API_URL=http://127.0.0.1:3020

For the dev env these are:

REACT_APP_COLLECTOR_API_URL=https://collector-api.vyrolabs.net

And in production they are:

REACT_APP_COLLECTOR_API_URL=https://collector-api.vyro.com.au

FAQs

Package last updated on 15 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts