trackApplicationLoadedEvent

Tracks an ApplicationLoadedEvent.

trackApplicationLoadedEvent = (parameters: {
tracker: Tracker,
locationStack?: LocationStack,
globalContexts?: GlobalContexts
}) => Promise<TrackerEvent>
caution

This is a lower-level API.

Event Tracking Hooks are preferable as they automate retrieving both the Tracker instance and LocationStack. In fact, the do use these lower-level APIs internally.

info

Under normal circumstances ObjectivProvider tracks this event automatically, unless disabled via its options.

Parameters

type
requiredtrackerReactNativeTracker
optionallocationStackLocationStack
optionalglobalContextsGlobalContexts

Returns

Promise<TrackerEvent>

Usage

import { 
ReactNativeTracker,
trackApplicationLoadedEvent,
ObjectivProvider,
useOnMount
} from '@objectiv/tracker-react-native';

const App = ({ children }) => {
const tracker = new ReactNativeTracker({
endpoint: 'https://collector.app.dev',
applicationId: 'app-id'
})

useOnMount(() => {
trackApplicationLoadedEvent({ tracker });
})

return (
<ObjectivProvider tracker={tracker} options={{ trackApplicationLoaded: false }}>
{children}
</ObjectivProvider>
);
}
tip

The code above is actually very similar to what ObjectivProvider does internally. Check the source on GitHub.