Skip to main content

Advanced usage

Removing a tracker at runtime

The React Native tracker provides two functions that allow you to remove a tracker (or all of them) at runtime.

removeTracker

As each tracker is identified by its namespace, in order to remove a tracker at runtime, you need to pass its namespace to the removeTracker function.

For example, assuming an existing tracker with namespace sp1 :

import { newTracker, removeTracker } from '@snowplow/react-native-tracker';

// ...

removeTracker('sp1');

removeAllTrackers

The function removeAllTrackers, which accepts no arguments, will remove all trackers created in your app.

import { removeAllTrackers } from '@snowplow/react-native-tracker';

removeAllTrackers();