rn-yandex-appmetrica
v2.0.1
Published
React Native plugin for AppMetrica analytics tool
Downloads
7
Maintainers
Readme
rn-yandex-appmetrica
React Native bridge to the AppMetrica on both iOS and Android.
About package
This is a temporary solution. This repository includes pull requests from the main repository and will be supported until all critical updates are included. Added updates:
Installation
yarn add rn-yandex-appmetrica
Integration into a pure React Native project
npm install react-native-appmetrica --save
- If React Native version <= 0.59:
react-native link react-native-appmetrica
- iOS only
- if
${PROJECT_DIR}/ios/Podfile
exists:npx pod-install
- if
${PROJECT_DIR}/ios/Podfile
don't exists:
Setup AppMetrica and placed frameworks at${PROJECT_DIR}/ios/Frameworks
Integrate into an Expo managed project
- Install
expo-dev-client
:
expo install expo-dev-client
- Add
rn-yandex-appmetrica
into theplugins
array inside theapp.json
file of your app:
"plugins": [
["rn-yandex-appmetrica", {}],
],
Usage
import AppMetrica from 'rn-yandex-appmetrica';
// Starts the statistics collection process.
AppMetrica.activate({
apiKey: '...KEY...',
sessionTimeout: 120,
firstActivationAsUpdate: false,
});
// 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');