Skip to content

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

License

Notifications You must be signed in to change notification settings

plus24-library/react-native-appmetrica

 
 

Repository files navigation

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' });
AppMetrica.reportEvent('My event', { event1: { event2: { event3 : { event4: 'value' } } } });

// reportRevenue
AppMetrica.reportRevenue("500", "value");

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 75.1%
  • Java 10.7%
  • JavaScript 9.4%
  • Python 2.7%
  • C 2.1%