@splicer97/react-native-mytracker

This is unofficial React Native wrapper for myTrackerSDK

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@splicer97/react-native-mytracker
400.11.017 days ago2 years agoMinified + gzip package size for @splicer97/react-native-mytracker in KB

Readme

react-native-mytracker npm version Downloads
This is unofficial React Native wrapper for myTrackerSDK

Installation

npm install @splicer97/react-native-mytracker

or
yarn add @splicer97/react-native-mytracker

then install pod
cd ios && pod install

Usage

import MyTracker from '@splicer97/react-native-mytracker';

// ...

MyTracker.initTracker('SDK_KEY');

//MyTracker Parameters
MyTracker.setCustomUserId('USER_ID');

//MyTracker Configurations
MyTracker.trackLaunchEnable(true);

MyTracker.autotrackPurchase(true);

MyTracker.trackLaunchTimeout(30);

MyTracker.bufferingPeriod(30);

MyTracker.forcingPeriod(30);

//for IOS:
// 0 = MRLocationTrackingModeNone — location is not tracked
// 1 = MRLocationTrackingModeCached — uses the system's cached value
// 2 = MRLocationTrackingModeActive — uses a request for the current location (default)
// for Android:
// 0 = false - do not track the user's location (default)
// 1 or 2 = true - track the user's location
MyTracker.trackLocation(0);

//for IOS:
// 0 = MRRegionNotSet — default value
// 1 = MRRegionRu — server located on the territory of the Russian Federation
// 2 = MRRegionEu — server located in Europe
// for Android:
// 0 - default value
// 1 = Region.RU — server located on the territory of the Russian Federation
// 2 = Region.EU — server located in Europe
MyTracker.region(0);

MyTracker.setDebugMode(false);

//MyTracker Events
MyTracker.trackEvent('name');

MyTracker.trackEventWithParams('name', {
  param1: 'name1',
  param2: 'name2',
});

MyTracker.trackLoginEvent('userId', 'vkConnectId');

MyTracker.trackLoginEventWithParams('userId', 'vkConnectId', {
  param1: 'name1',
  param2: 'name2',
});

MyTracker.trackInviteEvent();

MyTracker.trackInviteEventWithParams({
  param1: 'name1',
  param2: 'name2',
});

MyTracker.flush();

MyTracker.trackRegistrationEvent('userId', 'vkConnectId');

MyTracker.trackRegistrationEventWithParams('userId', 'vkConnectId', {
  param1: 'name1',
  param2: 'name2',
});

MyTracker.trackLevel();

MyTracker.trackLevelWithLevel(1);

MyTracker.trackLevelWithLevelWithParams(1, {
  param1: 'name1',
  param2: 'name2',
});

const instanceId = await MyTracker.getInstanceId();

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT
Made with create-react-native-library