@deriv-com/analytics 1.5.8 → 1.5.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,7 +11,7 @@ type Options = {
11
11
  export declare function createAnalyticsInstance(options?: Options): {
12
12
  initialise: ({ growthbookKey, growthbookDecryptionKey, rudderstackKey, growthbookOptions }: Options) => void;
13
13
  setAttributes: ({ country, user_language, device_language, device_type, account_type, user_id, app_id, utm_source, utm_medium, utm_campaign, is_authorised, url, domain, }: TCoreAttributes) => void;
14
- identifyEvent: () => void;
14
+ identifyEvent: (user_id?: string) => void;
15
15
  getFeatureState: (id: string) => string | undefined;
16
16
  getFeatureValue: <K extends string | number, V extends GrowthbookConfigs[K]>(id: K, defaultValue: V) => import("@growthbook/growthbook").WidenPrimitives<V>;
17
17
  isFeatureOn: (key: string) => boolean;
@@ -28,7 +28,7 @@ export declare function createAnalyticsInstance(options?: Options): {
28
28
  export declare const Analytics: {
29
29
  initialise: ({ growthbookKey, growthbookDecryptionKey, rudderstackKey, growthbookOptions }: Options) => void;
30
30
  setAttributes: ({ country, user_language, device_language, device_type, account_type, user_id, app_id, utm_source, utm_medium, utm_campaign, is_authorised, url, domain, }: TCoreAttributes) => void;
31
- identifyEvent: () => void;
31
+ identifyEvent: (user_id?: string) => void;
32
32
  getFeatureState: (id: string) => string | undefined;
33
33
  getFeatureValue: <K extends string | number, V extends GrowthbookConfigs[K]>(id: K, defaultValue: V) => import("@growthbook/growthbook").WidenPrimitives<V>;
34
34
  isFeatureOn: (key: string) => boolean;
package/lib/analytics.js CHANGED
@@ -68,10 +68,10 @@ function createAnalyticsInstance(options) {
68
68
  return;
69
69
  _rudderstack === null || _rudderstack === void 0 ? void 0 : _rudderstack.pageView(current_page, platform, getId());
70
70
  };
71
- var identifyEvent = function () {
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' });
71
+ var identifyEvent = function (user_id) {
72
+ var stored_user_id = user_id || getId();
73
+ if (_rudderstack) {
74
+ _rudderstack === null || _rudderstack === void 0 ? void 0 : _rudderstack.identifyEvent(stored_user_id, { language: (core_data === null || core_data === void 0 ? void 0 : core_data.user_language) || 'en' });
75
75
  }
76
76
  };
77
77
  var reset = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deriv-com/analytics",
3
- "version": "1.5.8",
3
+ "version": "1.5.9",
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",