React Tracker API Reference
High level overview of all the APIs available in the React Tracker.
Providers
React Context Providers are used to propagate Tracker instances and Location Contexts to all Tracked components.
Higher-level
Lower-level
Tracked Elements
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.
- TrackedAnchor
- TrackedButton
- TrackedDiv
- TrackedFooter
- TrackedHeader
- TrackedInput
- TrackedInputCheckbox
- TrackedInputRadio
- TrackedMain
- TrackedSelect
- TrackedNav
- TrackedSection
Tracked Contexts
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.
- TrackedContentContext
- TrackedExpandableContext
- TrackedInputContext
- TrackedLinkContext
- TrackedMediaPlayerContext
- TrackedNavigationContext
- TrackedOverlayContext
- TrackedPressableContext
- TrackedRootLocationContext
Location Wrappers
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.
Higher-level
- ContentContextWrapper
- ExpandableContextWrapper
- InputContextWrapper
- LinkContextWrapper
- MediaPlayerContextWrapper
- NavigationContextWrapper
- OverlayContextWrapper
- PressableContextWrapper
- RootLocationContextWrapper
Low-level
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.
- useApplicationLoadedEventTracker
- useFailureEventTracker
- useHiddenEventTracker
- useInputChangeEventTracker
- useMediaLoadEventTracker
- useMediaPauseEventTracker
- useMediaStartEventTracker
- useMediaStopEventTracker
- usePressEventTracker
- useSuccessEventTracker
- useVisibilityTracker
- useVisibleEventTracker
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.
- trackApplicationLoadedEvent
- trackPressEvent
- trackInputChangeEvent
- trackMediaLoadEvent
- trackMediaPauseEvent
- trackMediaStartEvent
- trackMediaStopEvent
- trackFailureEvent
- trackSuccessEvent
- trackHiddenEvent
- trackVisibility
- trackVisibleEvent
Hooks
A collection of hooks the SDK uses internally for event instrumentation.
Consumers
Lifecycle
- useOnMount
- useOnMountOnce
- useOnUnmount
- useOnUnmountOnce
- useTrackOnMount
- useTrackOnMountOnce
- useTrackOnUnmount
- useTrackOnUnmountOnce