@testim/testim-cli 3.243.0 → 3.244.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commons/testimAnalytics.js +8 -3
- package/npm-shrinkwrap.json +176 -176
- package/package.json +1 -1
- package/player/stepActions/scripts/doClick.js +3 -1
- package/player/stepActions/scripts/html5dragAction.js +3 -1
- package/player/stepActions/scripts/html5dragActionV2.js +3 -1
- package/player/stepActions/scripts/runCode.js +23 -6
- package/player/stepActions/scripts/scroll.js +1 -6
- package/player/stepActions/scripts/setText.js +4 -1
- package/utils.js +2 -6
- package/utils.test.js +1 -1
|
@@ -6,10 +6,15 @@ const Analytics = require('analytics-node');
|
|
|
6
6
|
|
|
7
7
|
const analytics = new Analytics('sJOSIGKa5x5rJEGsaOlCjrgozAf7FnVY', { flushAt: 1 });
|
|
8
8
|
|
|
9
|
+
const anonymousId = require('crypto').randomBytes(20).toString('hex');
|
|
10
|
+
|
|
9
11
|
function identify(data) {
|
|
10
12
|
if (config.IS_ON_PREM) {
|
|
11
13
|
return;
|
|
12
14
|
}
|
|
15
|
+
if (!data || !data.userId) {
|
|
16
|
+
data = { anonymousId };
|
|
17
|
+
}
|
|
13
18
|
analytics.identify(data);
|
|
14
19
|
}
|
|
15
20
|
|
|
@@ -21,11 +26,11 @@ function track(userId, eventName, properties) {
|
|
|
21
26
|
if (config.IS_ON_PREM) {
|
|
22
27
|
return;
|
|
23
28
|
}
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
const id = userId ? { userId } : { anonymousId };
|
|
30
|
+
analytics.track(Object.assign(id, {
|
|
26
31
|
event: eventName,
|
|
27
32
|
properties,
|
|
28
|
-
});
|
|
33
|
+
}));
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
module.exports = {
|