@deriv-com/analytics 1.5.6 → 1.5.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/lib/analytics.js +5 -4
  2. package/package.json +1 -1
package/lib/analytics.js CHANGED
@@ -50,13 +50,13 @@ function createAnalyticsInstance(options) {
50
50
  domain: domain,
51
51
  });
52
52
  }
53
- core_data = __assign(__assign(__assign(__assign(__assign(__assign(__assign({}, core_data), (user_language !== undefined && { user_language: user_language })), (account_type !== undefined && { account_type: account_type })), (app_id !== undefined && { app_id: app_id })), (device_type !== undefined && { device_type: device_type })), (user_identity !== undefined && { user_identity: user_identity })), (url !== undefined && { url: url }));
53
+ core_data = __assign(__assign(__assign(__assign(__assign(__assign({}, core_data), (user_language !== undefined && { user_language: user_language })), (account_type !== undefined && { account_type: account_type })), (app_id !== undefined && { app_id: app_id })), (device_type !== undefined && { device_type: device_type })), (url !== undefined && { url: url }));
54
54
  };
55
55
  var getFeatureState = function (id) { var _a, _b; return (_b = (_a = _growthbook === null || _growthbook === void 0 ? void 0 : _growthbook.getFeatureState(id)) === null || _a === void 0 ? void 0 : _a.experimentResult) === null || _b === void 0 ? void 0 : _b.name; };
56
56
  var getFeatureValue = function (id, defaultValue) { return _growthbook === null || _growthbook === void 0 ? void 0 : _growthbook.getFeatureValue(id, defaultValue); };
57
57
  var isFeatureOn = function (key) { return _growthbook === null || _growthbook === void 0 ? void 0 : _growthbook.isOn(key); };
58
58
  var setUrl = function (href) { return _growthbook === null || _growthbook === void 0 ? void 0 : _growthbook.setUrl(href); };
59
- var getId = function () { return (_rudderstack === null || _rudderstack === void 0 ? void 0 : _rudderstack.getUserId()) || (_rudderstack === null || _rudderstack === void 0 ? void 0 : _rudderstack.getAnonymousId()); };
59
+ var getId = function () { return (_rudderstack === null || _rudderstack === void 0 ? void 0 : _rudderstack.getUserId()) || ''; };
60
60
  /**
61
61
  * Pushes page view event to Rudderstack
62
62
  *
@@ -69,8 +69,9 @@ function createAnalyticsInstance(options) {
69
69
  _rudderstack === null || _rudderstack === void 0 ? void 0 : _rudderstack.pageView(current_page, platform, getId());
70
70
  };
71
71
  var identifyEvent = function () {
72
- if ((core_data === null || core_data === void 0 ? void 0 : core_data.user_identity) && _rudderstack) {
73
- _rudderstack === null || _rudderstack === void 0 ? void 0 : _rudderstack.identifyEvent(core_data === null || core_data === void 0 ? void 0 : core_data.user_identity, { language: (core_data === null || core_data === void 0 ? void 0 : core_data.user_language) || 'en' });
72
+ var user_identity = getId();
73
+ if (user_identity && _rudderstack) {
74
+ _rudderstack === null || _rudderstack === void 0 ? void 0 : _rudderstack.identifyEvent(user_identity, { language: (core_data === null || core_data === void 0 ? void 0 : core_data.user_language) || 'en' });
74
75
  }
75
76
  };
76
77
  var reset = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deriv-com/analytics",
3
- "version": "1.5.6",
3
+ "version": "1.5.8",
4
4
  "description": "The analytics package contains all the utility functions used for tracking user events and sending them to the respective platform such as Rudderstack.",
5
5
  "keywords": [
6
6
  "rudderstack",