Skip to content

Latest commit

 

History

History
33 lines (27 loc) · 760 Bytes

File metadata and controls

33 lines (27 loc) · 760 Bytes

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: EventParams | (context: Context) => EventParams - Impression event parameters
  • options?: ImpressionOptions - Optional configuration (overrides global options)