Quick Start
Here’s a simple example of how to use event-tracker:
import { createTracker } from "@offlegacy/event-tracker";
// Create a tracker instance
const [Track, useTracker] = createTracker({
DOMEvents: {
onClick: (params, context) => {
log("Click event:", params, context);
},
},
});
// Use in your app
function App() {
return (
<Track.Provider initialContext={{ userId: "user-123" }}>
<Track.Click params={{ buttonId: "submit" }}>
<button>Submit</button>
</Track.Click>
</Track.Provider>
);
}
Last updated on