Skip to content
This repository was archived by the owner on Sep 2, 2023. It is now read-only.

Commit d7f539a

Browse files
enable trackjs
1 parent fac3368 commit d7f539a

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

src/index.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,24 @@ import './_utils/validateExtend';
1010
// import { whyDidYouUpdate } from 'why-did-you-update';
1111
// whyDidYouUpdate(React, { exclude: [/^Connect/, /IntlProvider/, /BootProvider/] });
1212

13-
const appName = window.location.hostname === 'app.binary.com' && 'binary-next-gen' ||
14-
window.cordova && 'next-gen-mobile' ||
15-
'???';
13+
const appName = (/app.binary.com/i.test(window.location.hostname) && 'binary-next-gen') ||
14+
(window.cordova && 'next-gen-mobile') ||
15+
'???';
16+
const version = config.version;
17+
const userId = (JSON.parse(storage.getItem('account')) || {}).loginid;
18+
1619
window._trackJs = { // eslint-disable-line no-underscore-dangle
17-
token: '346262e7ffef497d85874322fff3bbf8',
18-
application: appName,
19-
enabled: appName !== '???',
20-
version: config.version,
21-
userId: (JSON.parse(storage.getItem('account')) || {}).loginid,
22-
onError: function (payload) { // eslint-disable-line
23-
if (payload.message.toLowerCase().indexOf('out of memory') !== -1) {
24-
window.location.reload();
25-
}
26-
return false;
27-
},
20+
token: '346262e7ffef497d85874322fff3bbf8',
21+
application: appName,
22+
enabled: appName !== '???',
23+
onError: function (payload) { // eslint-disable-line
24+
if (payload.message.toLowerCase().indexOf('out of memory') !== -1) {
25+
window.location.reload();
26+
}
27+
payload.customer.userId = userId;
28+
payload.customer.version = version;
29+
return true;
30+
},
2831
};
2932
require('trackjs');
3033

0 commit comments

Comments
 (0)