Impression
Tracks impression events using the Intersection Observer API.
import { createTracker } from "@offlegacy/event-tracker";
const [Track] = createTracker({
impression: {
onImpression: (params, context) => {
// Handle impression event
},
options: {
threshold: 0.5,
},
},
});
function App() {
return (
<Track.Provider initialContext={{}}>
<Track.Impression params={{ elementId: "hero" }} options={{ threshold: 0.8 }}>
<div>Tracked content</div>
</Track.Impression>
</Track.Provider>
);
}
Props
params: unknown
- Impression event parametersoptions?: ImpressionOptions
- Optional configuration (overrides global options)
Last updated on