millarm / react-native-heap

A React Native integration for Heap

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

react-native-heap

npm npm npm

React Native tracker for Heap.

Getting Started

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"
  ]
}

Installation & Setup

Usage

// 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 });

Acknowledgements

Thank you to Mark Miyashita for creating negativetwelve/react-native-heap-analytics, which was the initial basis for this library!

About

A React Native integration for Heap

License:MIT License


Languages

Language:JavaScript 66.8%Language:TypeScript 21.0%Language:Ruby 4.7%Language:Java 4.7%Language:Objective-C 2.8%