
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
react-analytics-trackers
Advanced tools
A powerful, lightweight, and customizable analytics tracking solution for React applications. Automatically track page views, clicks, errors, web vitals, and custom events with minimal setup.
# Using npm
npm install react-analytics-trackers
# Using yarn
yarn add react-analytics-trackers
# Using pnpm
pnpm add react-analytics-trackers
import { AnalyticsProvider } from "react-analytics-trackers";
function App() {
const config = {
endpoint: "https://your-analytics-api.com/events",
debug: process.env.NODE_ENV === "development",
includeWebVitals: true,
};
return (
<AnalyticsProvider config={config}>
<YourApp />
</AnalyticsProvider>
);
}
import { useAnalytics } from "react-analytics-trackers";
function MyComponent() {
const { trackEvent } = useAnalytics();
const handleButtonClick = () => {
trackEvent({
name: "button_click",
properties: {
buttonId: "submit-form",
location: "homepage",
},
});
};
return <button onClick={handleButtonClick}>Click me</button>;
}
interface AnalyticsConfig {
// Required: API endpoint to send analytics events
endpoint: string;
// Optional: Enable debug mode to log events to console
debug?: boolean;
// Optional: Enable Web Vitals tracking
includeWebVitals?: boolean;
// Optional: Custom headers for API requests
customHeaders?: Record<string, string>;
// Optional: Transform or filter events before sending
beforeSend?: (event: AnalyticsEvent) => AnalyticsEvent | null;
}
useAnalytics(): Main hook for tracking events
trackEvent(event: AnalyticsEvent): Track custom eventstrackPageView(path: string, title?: string): Track page viewstrackError(error: Error, errorInfo?: React.ErrorInfo): Track errorstrackClick(element: HTMLElement): Track element clicksWeb Vitals tracking is automatically included when includeWebVitals is enabled in the config. It tracks:
When debug is enabled in the config:
import { AnalyticsProvider, useAnalytics } from "react-analytics-trackers";
// Configure the provider
const config = {
endpoint: "https://api.example.com/analytics",
debug: true,
includeWebVitals: true,
beforeSend: (event) => {
// Add common properties to all events
return {
...event,
properties: {
...event.properties,
appVersion: "1.0.0",
environment: process.env.NODE_ENV,
},
};
},
};
// Wrap your app with the provider
function App() {
return (
<AnalyticsProvider config={config}>
<Router>
<YourRoutes />
</Router>
</AnalyticsProvider>
);
}
// Use in components
function FeatureComponent() {
const { trackEvent } = useAnalytics();
const handleFeatureUse = () => {
trackEvent({
name: "feature_used",
properties: {
featureId: "awesome-feature",
userId: "user-123",
},
});
};
return (
<div>
<button onClick={handleFeatureUse}>Use Feature</button>
</div>
);
}
MIT
Contributions are welcome!
FAQs
Analytics tracking solution for React applications
We found that react-analytics-trackers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

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.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.