useTrackEvent()
Use the useTrackEvent() hook to track an event
Track a custom event
The useTrackEvent() hook is used to track a custom event. You can track any event that you want to track in your application.
import { useTrackEvent } from '@journium/nextjs';
function ProductPage() {
const trackEvent = useTrackEvent();
const handlePurchase = () => {
trackEvent('purchase_started', {
product_id: 'prod_123',
page: 'product_detail',
value: 29.99
});
};
return (
<button onClick={handlePurchase}>Buy Now</button>
);
}Last updated on