forked from KhalisFoundation/sttm-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalytics.js
More file actions
23 lines (21 loc) · 676 Bytes
/
Copy pathanalytics.js
File metadata and controls
23 lines (21 loc) · 676 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// eslint-disable-next-line import/no-unresolved
const { trackEvent } = require('@aptabase/electron/main');
const isOnline = require('is-online');
require('dotenv').config();
class Analytics {
trackEvent({ category, action, label, value }) {
// TODO: need to add variable that stops statistics collection
isOnline().then((online) => {
// TODO: for offline users, come up with a way of storing and send when online.
if (online) {
console.log('action', action, 'options', { category, label, value });
trackEvent(action, {
category,
label,
value,
});
}
});
}
}
module.exports = Analytics;