@deriv-com/analytics 1.5.8 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/analytics.d.ts +2 -2
- package/lib/analytics.js +4 -4
- package/package.json +8 -4
package/lib/analytics.d.ts
CHANGED
@@ -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
|
73
|
-
if (
|
74
|
-
_rudderstack === null || _rudderstack === void 0 ? void 0 : _rudderstack.identifyEvent(
|
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.
|
3
|
+
"version": "1.6.0",
|
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",
|
@@ -12,9 +12,10 @@
|
|
12
12
|
"types": "lib/index.d.ts",
|
13
13
|
"scripts": {
|
14
14
|
"test": "./node_modules/.bin/jest",
|
15
|
-
"build": "tsc",
|
15
|
+
"build": "tsc && npm run build:webpack",
|
16
16
|
"prepare": "npm run build && husky install",
|
17
|
-
"prepublishOnly": "npm test"
|
17
|
+
"prepublishOnly": "npm test",
|
18
|
+
"build:webpack": "webpack"
|
18
19
|
},
|
19
20
|
"files": [
|
20
21
|
"lib/**/*"
|
@@ -33,7 +34,10 @@
|
|
33
34
|
"lint-staged": "^15.0.1",
|
34
35
|
"prettier": "^3.0.3",
|
35
36
|
"ts-jest": "^29.1.1",
|
36
|
-
"
|
37
|
+
"ts-loader": "^9.5.1",
|
38
|
+
"typescript": "^4.9.5",
|
39
|
+
"webpack": "^5.91.0",
|
40
|
+
"webpack-cli": "^5.1.4"
|
37
41
|
},
|
38
42
|
"dependencies": {
|
39
43
|
"@growthbook/growthbook": "^0.36.0",
|