React Native bridge to the AppMetrica on both iOS and Android.
Branch: master
Clone or download
Latest commit 6eaf160 Sep 10, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
android add activation config Aug 30, 2018
example Update pkg in examaple project Sep 30, 2017
ios/RCTAppMetrica Merge pull request #15 from hssrrw/use-pods Sep 10, 2018
.eslintignore Add ESLint Sep 18, 2017
.eslintrc.json Add flow annotation Sep 30, 2017
.flowconfig Add flow annotation Sep 30, 2017
.gitignore gitignore Sep 18, 2017
.npmignore Add example project to npmignore Sep 30, 2017
.travis.yml Enable travis Sep 18, 2017
LICENSE Initial commit Sep 18, 2017
README.md add activation config Aug 30, 2018
index.js add activation config Aug 30, 2018
package-lock.json 1.1.0 Sep 10, 2018
package.json 1.1.0 Sep 10, 2018

README.md

Build Status NPM version

react-native-appmetrica

React Native bridge to the AppMetrica on both iOS and Android.

Installation

  1. Only for iOS: setup AppMetrica. YandexMobileMetrica.framework should be placed at <project_dir>/ios/ or <project_dir>/ios/Frameworks/. Otherwise you'll get build error.
  2. npm install --save react-native-appmetrica
  3. react-native link react-native-appmetrica

iOS notice: If you build failed after installing SDK and react-native-appmetrica make sure YandexMobileMetrica.framework and libRCTAppMetrica.a are included at Build Phase -> Link Binary With Libraries

Example

import AppMetrica from 'react-native-appmetrica';

AppMetrica.activateWithApiKey('2dee16d2-1143-4cd3-a904-39ce10ac2755');

AppMetrica.reportEvent('Hello world');

Usage

import AppMetrica from 'react-native-appmetrica';

// Starts the statistics collection process.
AppMetrica.activateWithApiKey('...KEY...');
// OR
AppMetrica.activateWithConfig({
  apiKey: '...KEY...',
  sessionTimeout: 120,
  firstActivationAsUpdate: true,
});

// Sends a custom event message and additional parameters (optional).
AppMetrica.reportEvent('My event');
AppMetrica.reportEvent('My event', { foo: 'bar' });

// Send a custom error event.
AppMetrica.reportError('My error');