React Native tracker for Heap.
npm install @heap/react-native-heap
For autotrack, add the following plugins to your .babelrc
or babel.config.js
file (not required for manual tracking):
{
"plugins": [
"add-react-displayname",
"./node_modules/@heap/react-native-heap/instrumentor/src/index.js"
]
}
// Import Heap.
import Heap from '@heap/react-native-heap';
// Identify your user.
Heap.identify('123456');
Heap.addUserProperties({ name: 'John', age: 54 });
// Add event properties (these persist across sessions).
Heap.addEventProperties({ isLoggedIn: true });
// You can remove a specific property or clear everything.
Heap.removeEventProperty('isLoggedIn');
Heap.clearEventProperties();
// To track an event, use:
Heap.track('signed-up', { isPaid: true, amount: 20 });
Thank you to Mark Miyashita for creating negativetwelve/react-native-heap-analytics, which was the initial basis for this library!