1 | 'use strict';
|
2 |
|
3 |
|
4 | const config = require('./config');
|
5 | const Analytics = require('analytics-node');
|
6 |
|
7 | const analytics = new Analytics('sJOSIGKa5x5rJEGsaOlCjrgozAf7FnVY', { flushAt: 1 });
|
8 | const testimCustomToken = require('./testimCustomToken');
|
9 |
|
10 | function identify(data) {
|
11 | if (config.IS_ON_PREM) {
|
12 | return;
|
13 | }
|
14 | analytics.identify(data);
|
15 | }
|
16 |
|
17 | function trackWithCIUser(eventName, properties) {
|
18 | return track('ci', eventName, properties);
|
19 | }
|
20 |
|
21 | function track(userId, eventName, properties) {
|
22 | if (config.IS_ON_PREM) {
|
23 | return;
|
24 | }
|
25 | analytics.track({
|
26 | userId,
|
27 | event: eventName,
|
28 | properties,
|
29 | });
|
30 | }
|
31 |
|
32 | module.exports = {
|
33 | identify,
|
34 | track,
|
35 | trackWithCIUser,
|
36 | };
|