Event Trackers

Tracking events manually can be done using either Event Tracking Hooks or Event Tracking Functions.

Which one to use?

  • Hooks are the easiest, and recommended, way of tracking Events in React components. They fully automate the retrieval of the Tracker instance and LocationStack and offer mechanisms to customize the Event's payload even further.

  • Functions are low level primitives. Full flexibility comes at the price of being much harder to use and to make mistakes with. They require all the Events' attributes to be specified manually and are primarily meant for building custom components.

Event tracking hooks

These hooks can be used to obtain ready-to-trigger callbacks for all Events. They can be preconfigured with custom locations, contexts and options both at creation and when triggering them.

Event tracking functions

These are the low level primitives directly exposed from Core Tracker.
They are not really meant for inline calling, but more for building one's own hooks and components.

Make sure you have a deep understanding of how Location Stacks are composed before using them.