React Native Tracker API Reference
High level overview of all the APIs available in the React Native Tracker.
Providers
React Context Providers are used to propagate Tracker instances and Location Contexts to all Tracked components.
Higher-level
Lower-level
Tracked Components
These Components are automatically wrapped in an appropriate LocationWrapper and automate event Tracking whenever possible.
- TrackedActivityIndicator
- TrackedButton
- TrackedFlatList
- TrackedKeyboardAvoidingView
- TrackedModal
- TrackedPressable
- TrackedSafeAreaView
- TrackedScrollView
- TrackedSectionList
- TrackedSwitch
- TrackedText
- TrackedTextInput
- TrackedTouchableHighlight
- TrackedTouchableNativeFeedback
- TrackedTouchableOpacity
- TrackedTouchableWithoutFeedback
- TrackedView
- TrackedVirtualizedList
Location Wrappers
Fragments wrapping their children in a Context.Provider. This allows the ReactNativeTracker to reconstruct their Location in the UI.
The combination of Location Wrappers and Low-level Event Trackers is how we build Tracked Components.
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 and contexts 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