react-native-appmetrica/README.md

34 lines
1005 B
Markdown
Raw Normal View History

2020-06-08 22:14:06 +03:00
# react-native-appmetrica
React Native bridge to the [AppMetrica](https://appmetrica.yandex.com/) on both iOS and Android.
## Installation
1. `npm install react-native-appmetrica --save`
2. If React Native version <= 0.59: \
`react-native link react-native-appmetrica`
3. iOS only
* if `${PROJECT_DIR}/ios/Podfile` exists: \
`npx pod-install`
* if `${PROJECT_DIR}/ios/Podfile` don't exists: \
[Setup AppMetrica](https://appmetrica.yandex.com/docs/mobile-sdk-dg/tasks/ios-quickstart.html) and placed frameworks at `${PROJECT_DIR}/ios/Frameworks`
## Usage
```js
import AppMetrica from 'react-native-appmetrica';
// Starts the statistics collection process.
2020-07-17 15:22:23 +03:00
AppMetrica.activate({
2020-06-08 22:14:06 +03:00
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');
```