danielkalen / mixpanel-react-native

Official React Native Tracking Library for Mixpanel Analytics

Home Page:https://mixpanel.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mixpanel React Native Library

Table of Contents

Introduction

Welcome to the official Mixpanel React Native library. The Mixpanel React Native library is an open-source project, and we'd love to see your contributions! We'd also love for you to come and work with us! Check out Jobs for details

Quick Start Guide

Mixpanel's React Native SDK is a wrapper around Mixpanel’s native iOS and Android SDKs and it supports offline tracking. Check out our official documentation for more in depth information on installing and using Mixpanel on React Native.

Installation

Prerequisite

Steps

  1. Under your app's root directory, install Mixpanel React Native SDK npm install mixpanel-react-native
  2. Under your application's ios folder, run pod install At this point, you are ready to use Mixpanel React Native SDK

Integration

Initialization

To start tracking with the library you must first initialize with your project token. To initialize the library, first add import { Mixpanel } and call Mixpanel.init(token) with your project token as it's argument.

import { Mixpanel } from 'mixpanel-react-native';
...
class YourClass extends React.Component {
    constructor(props) {
        super(props);
        this.configMixpanel();
    }

    configMixpanel = async () => {
        this.mixpanel = await Mixpanel.init("Your mixpanel token");
    }
...

Once you've called this method once, you can access mixpanel throughout the rest of your application.

Tracking

Once you've initialized the library, Mixpanel will automatically collect common mobile events. You can enable/ disable automatic collection through your project settings. With the mixpanel object created in the last step a call to track is all you need to send additional events to Mixpanel.

// Track with event-name
mixpanel.track('Sent Message');
// Track with event-name and property
mixpanel.track('Plan Selected', {'Plan': 'Premium'});;

You're done! You've successfully integrated the Mixpanel React Native SDK into your app. To stay up to speed on important SDK releases and updates, star or watch our repository on Github.

I want to know more!

No worries, here are some links that you will find useful:

Have any questions? Reach out to Mixpanel Support to speak to someone smart, quickly.

About

Official React Native Tracking Library for Mixpanel Analytics

https://mixpanel.com

License:Other


Languages

Language:JavaScript 49.8%Language:Java 23.5%Language:Swift 14.7%Language:Objective-C 8.4%Language:Starlark 1.4%Language:Python 1.3%Language:Ruby 1.0%Language:Shell 0.0%