@deriv-com/analytics 1.5.7 → 1.5.9
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 +5 -5
- package/package.json +1 -1
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
@@ -56,7 +56,7 @@ function createAnalyticsInstance(options) {
|
|
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(); };
|
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
|
*
|
@@ -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.5.
|
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",
|