For AI agents: a Markdown version of this page is at https://docs.snowplow.io/docs/sources/react-native-tracker/advanced-usage.md. The index of all documentation pages is at https://docs.snowplow.io/llms.txt, and the index for this section is at https://docs.snowplow.io/docs/cdi/llms.txt.
Remove the React Native 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 :
javascript
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.
javascript
import { removeAllTrackers } from '@snowplow/react-native-tracker';
removeAllTrackers();