React Tracker API Reference
High level overview of all the APIs available in the React Tracker.
React Context Providers are used to propagate Tracker instances and Location Contexts to all Tracked components.
These Components are ready-to-use TrackedContexts HOCs. They are supposed to be used as drop-in replacement of commonly used HTML semantic tags.
If you need more complexity or control over the inner workings, Tracked Context HOCs are the next logical step.
These Components are HOCs wrapping the given
Component in a LocationWrapper and automatically triggering Events.
Some of them may also infer required properties from native attributes, such as Pressable and Link identifiers and hrefs.
Fragments wrapping their children in a Context.Provider. This allows the ReactTracker to reconstruct their Location in the UI.
The combination of Location Wrappers and Low-level Event Trackers is how we build Tracked Contexts and Elements.
Take a loot at this how to build your own Custom Tracked Components guide for more info.
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.
A collection of hooks the SDK uses internally for event instrumentation.