BlueWallet/analytics.js

31 lines
826 B
JavaScript
Raw Normal View History

2019-07-20 15:27:36 +02:00
import amplitude from 'amplitude-js';
2019-11-29 00:16:04 +01:00
import { getVersion } from 'react-native-device-info';
import { Platform } from 'react-native';
2019-07-20 15:27:36 +02:00
amplitude.getInstance().init('8b7cf19e8eea3cdcf16340f5fbf16330', null, {
useNativeDeviceInfo: true,
2019-11-29 00:16:04 +01:00
platform: Platform.OS,
2019-07-20 15:27:36 +02:00
});
2019-11-29 00:16:04 +01:00
amplitude.getInstance().setVersionName(getVersion());
2019-08-04 08:42:05 +02:00
let A = async event => {
2019-11-30 21:12:35 +01:00
console.log('posting analytics...', event);
2019-08-04 08:42:05 +02:00
try {
2019-11-30 21:12:35 +01:00
amplitude.getInstance().logEvent(event);
2019-08-04 08:42:05 +02:00
} catch (err) {
console.log(err);
}
};
A.ENUM = {
INIT: 'INIT',
GOT_NONZERO_BALANCE: 'GOT_NONZERO_BALANCE',
2019-11-29 00:16:04 +01:00
GOT_ZERO_BALANCE: 'GOT_ZERO_BALANCE',
CREATED_WALLET: 'CREATED_WALLET',
CREATED_LIGHTNING_WALLET: 'CREATED_LIGHTNING_WALLET',
2019-11-29 00:16:04 +01:00
APP_UNSUSPENDED: 'APP_UNSUSPENDED',
NAVIGATED_TO_WALLETS_HODLHODL: 'NAVIGATED_TO_WALLETS_HODLHODL',
};
module.exports = A;