forked from near/create-near-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtracking.js
30 lines (27 loc) · 950 Bytes
/
tracking.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const MIXPANEL_TOKEN = 'df164f13212cbb0dfdae991da60e87f2'
const chalk = require('chalk')
const mixpanel = require('mixpanel').init(MIXPANEL_TOKEN)
const track = async (frontendType, contractType) => {
// prevents logging from CI
if (process.env.IS_GITHUB_ACTION) {
console.log('Mixpanel logging is skipped in CI env')
return
}
try {
console.log(chalk`
NEAR collects basic information on the type of commands used to improve developer experiences. All data are anonymous, therefore, no personal information that could identify you will be shared. `)
const mixPanelProperties = {
frontend: frontendType,
contract: contractType,
os: process.platform,
timestamp: new Date().toString()
}
mixpanel.track('track create near app', mixPanelProperties)
} catch (e) {
console.error(
'Warning: problem while sending tracking data. Error: ',
e
)
}
}
exports.track = track