0.6.0 • Published 2 years ago

react-native-appmetrica-yandex v0.6.0

Weekly downloads
145
License
MIT
Repository
github
Last release
2 years ago

react-native-appmetrica-yandex

Install
yarn add react-native-appmetrica-yandex
  1. IOS

    RN<0.60:

    react-native link react-native-appmetrica-yandex

    With CocoaPods, add the following line to your Podfile:

    pod 'react-native-appmetrica-yandex', :path => '../node_modules/react-native-appmetrica-yandex'
    pod 'YandexMobileMetrica', '3.8.2'

    Then run pod install.

    RN>=0.60: With React Native 0.60 and later, linking of pods is done automatically

    cd ios
    pod install
  2. Android

    RN<0.60:

    2.1. Open up android/app/src/main/java/[...]/MainApplication.java

    • Add import com.codeard.yandexmetrica.YandexAppmetricaPackage; to the imports at the top of the file
    • Add new YandexAppmetricaPackage() to the list returned by the getPackages() method

    2.2. Append the following lines to android/settings.gradle:

    	include ':react-native-appmetrica-yandex'
    	project(':react-native-appmetrica-yandex').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-appmetrica-yandex/android')
    	```
    
    2.3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
    	```
     implementation project(':react-native-appmetrica-yandex')
    	```
    
    **RN>=0.60**:
    With React Native 0.60 and later, linking is done automatically

Usage

import { YandexMetrica } from 'react-native-appmetrica-yandex';

// Initialize
YandexMetrica.activateWithApiKey('KEY');

// OR
YandexMetrica.activateWithConfig({
  apiKey: 'KEY',
  sessionTimeout: 120,
  firstActivationAsUpdate: true,
});


YandexMetrica.setUserProfileID('12345');

YandexMetrica.setUserProfileAttributes({ ... })

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

// Send a custom error event and additional parameters (optional).
YandexMetrica.reportError('My error');
YandexMetrica.reportError('My error', 'Test');
YandexMetrica.reportError('My error', { foo: 'bar' });
YandexMetrica.reportError('My error', new Error('test'));
0.6.0

2 years ago

0.5.0

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago