
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Connect your first-party data from any source to any destination for websites and mobile apps with server-side.
An official plugin to add the Hardal tracking to your web project with automatic pageview tracking, click tracking, and privacy-first analytics.
Hardal is a privacy-first, server-side analytics platform that helps you:
npm install hardal
# or
bun add hardal
# or
yarn add hardal
// app/providers.tsx
'use client';
import { HardalProvider } from 'hardal/react';
export function Providers({ children }: { children: React.ReactNode }) {
return (
<HardalProvider
config={{
website: // Your Hardal Signal ID,
hostUrl: // Your Hardal Signal Domain,
}}
autoPageTracking={true} // ✅ Tracks all route changes
>
{children}
</HardalProvider>
);
}
<script
defer
src="<YOUR_SIGNAL_ENDPOINT>/hardal"
data-website-id="<YOUR_SIGNAL_ID>"
data-host-url="<YOUR_SIGNAL_ENDPOINT>"
data-auto-track="true"
></script>
'use client';
import { useHardal } from 'hardal/react';
export function ContactForm() {
const { track, distinct } = useHardal();
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
const formData = new FormData(e.currentTarget);
const email = formData.get('email') as string;
// Track the submission
await track('form_submitted', {
formType: 'contact',
source: 'landing_page',
});
// Identify the user
await distinct({
email,
source: 'contact_form',
});
};
return <form onSubmit={handleSubmit}>{/* form fields */}</form>;
}
<HardalProvider
config={{
website: 'your-website-id', // Required: Your Hardal website ID
hostUrl: 'https://your-host.com', // Required: Your Hardal server URL
}}
autoPageTracking={true} // Optional: Auto-track route changes (default: false)
disabled={process.env.NODE_ENV === 'development'} // Optional: Disable tracking
>
{children}
</HardalProvider>
const hardal = new Hardal({
website: 'your-website-id',
hostUrl: 'https://your-hardal-server.com',
autoTrack: true, // Auto-track pageviews and history changes
});
// Identify a user with custom properties
hardal?.distinct({
userId: 'user-123',
email: 'user@example.com',
plan: 'premium',
});
// Track a pageview manually
hardal?.trackPageview();
new Hardal(config)Creates a new Hardal instance.
Config Options:
website (required): Your Hardal website IDhostUrl (optional): Custom host URL for your Hardal serverautoTrack (optional): Auto-track pageviews (default: true)track(eventName, data?)Track a custom event.
hardal.track('event_name', { custom: 'data' });
distinct(data)Identify a user with custom properties.
hardal.distinct({ userId: '123', email: 'user@example.com' });
trackPageview()Manually track a pageview.
hardal.trackPageview();
const { track, distinct } = useHardal();
// Track which variant user sees
track('experiment_viewed', {
experimentId: 'pricing_test_v1',
variant: 'B',
});
// Associate user with variant
distinct({
experiments: {
pricing_test_v1: 'B',
},
});
const { track } = useHardal();
try {
await riskyOperation();
} catch (error) {
track('error_occurred', {
errorType: error.name,
errorMessage: error.message,
page: window.location.pathname,
});
}
'use client';
import { useEffect } from 'react';
import { useHardal } from 'hardal/react';
export function TimeTracker() {
const { track } = useHardal();
useEffect(() => {
const startTime = Date.now();
return () => {
const timeSpent = Math.round((Date.now() - startTime) / 1000);
track('time_on_page', {
seconds: timeSpent,
page: window.location.pathname,
});
};
}, [track]);
return null;
}
<HardalProvider
config={{
website: // Your Hardal Signal ID,
hostUrl: // Your Hardal Signal Domain,
}}
disabled={process.env.NODE_ENV === 'development'} // Don't track in dev
autoPageTracking={true}
>
{children}
</HardalProvider>
✅ DO:
checkout_completed, not event1)❌ DON'T:
distinct() for user identificationautoPageTracking insteadHardal automatically:
Check the examples/ directory for complete examples:
examples/nextjs-app-router.tsxexamples/nextjs-pages-router.tsxexamples/react-spa.tsxexamples/data-attributes.htmlautoTrack: true in the config for React appsautoPageTracking={true} in HardalProvider insteadhostUrl in your confighttp:// or https://hostUrl and website ID are correcthardal/reactnpm install to ensure dependencies are installed// ❌ Old way (v2.x)
const hardal = new Hardal({
endpoint: 'https://server.com',
autoPageview: true,
});
// ✅ New way (v3.x)
<HardalProvider
config={{
website: 'your-id',
hostUrl: 'https://server.com',
}}
autoPageTracking={true}
>
Breaking changes:
endpoint → hostUrlautoPageview → removed (use autoPageTracking prop instead)fetchFromGA4, fetchFromFBPixel, fetchFromRTB, fetchFromDataLayer → removedHardalProvider wrapperThis project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
FAQs
Connect your first-party data from any source to any destination for websites and mobile apps with server-side.
We found that hardal demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.