rozmova-analytics 1.1.14 → 1.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +10 -6
- package/dist/index.esm.js +34 -13
- package/dist/index.js +34 -13
- package/dist/index.umd.js +3 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { AnalyticsCommonParams, EventParams } from "./types";
|
|
2
|
+
type GConfig = {
|
|
3
|
+
userId?: string;
|
|
4
|
+
email?: string;
|
|
5
|
+
locale?: string;
|
|
6
|
+
};
|
|
2
7
|
declare class Analytics {
|
|
3
8
|
private initialized;
|
|
4
9
|
private locale;
|
|
5
10
|
private platform;
|
|
6
11
|
private dataLayer;
|
|
12
|
+
private lastGConfig;
|
|
13
|
+
isInitialized(): boolean;
|
|
7
14
|
init({ locale, platform, isClearly, }?: {
|
|
8
15
|
locale?: string;
|
|
9
16
|
platform?: string;
|
|
10
17
|
isClearly?: boolean;
|
|
11
|
-
}): void
|
|
18
|
+
}): Promise<void>;
|
|
12
19
|
private processDataLayer;
|
|
13
20
|
setUserTag(key: string, value: string): void;
|
|
14
21
|
trackEvent(eventName: string, properties?: EventParams, services?: {
|
|
@@ -16,11 +23,8 @@ declare class Analytics {
|
|
|
16
23
|
mixpanel?: boolean;
|
|
17
24
|
customerIO?: boolean;
|
|
18
25
|
}): Promise<void>;
|
|
19
|
-
setConfig(
|
|
20
|
-
|
|
21
|
-
email?: string;
|
|
22
|
-
locale?: string;
|
|
23
|
-
}): void;
|
|
26
|
+
setConfig(params?: GConfig): void;
|
|
27
|
+
getLastGConfig(): GConfig;
|
|
24
28
|
trackPageView(): void;
|
|
25
29
|
setUser(userId: string, userParams: {
|
|
26
30
|
email: string;
|
package/dist/index.esm.js
CHANGED
|
@@ -12003,7 +12003,7 @@ const GA_ECOMMERCE_EVENTS = [
|
|
|
12003
12003
|
"begin_checkout",
|
|
12004
12004
|
"add_payment_info",
|
|
12005
12005
|
];
|
|
12006
|
-
const INTERNAL_USER_EMAILS = ["rozmova.me", "
|
|
12006
|
+
const INTERNAL_USER_EMAILS = ["rozmova.me", "clearly.help"];
|
|
12007
12007
|
|
|
12008
12008
|
const setQueryParam = (name, value) => {
|
|
12009
12009
|
const url = new URL(window.location.href);
|
|
@@ -12544,7 +12544,11 @@ class Analytics {
|
|
|
12544
12544
|
locale = "uk";
|
|
12545
12545
|
platform = "web";
|
|
12546
12546
|
dataLayer = [];
|
|
12547
|
-
|
|
12547
|
+
lastGConfig = {};
|
|
12548
|
+
isInitialized() {
|
|
12549
|
+
return this.initialized;
|
|
12550
|
+
}
|
|
12551
|
+
async init({ locale, platform, isClearly, } = {}) {
|
|
12548
12552
|
if (this.initialized)
|
|
12549
12553
|
return;
|
|
12550
12554
|
insertCustomerIOScript();
|
|
@@ -12568,7 +12572,7 @@ class Analytics {
|
|
|
12568
12572
|
});
|
|
12569
12573
|
// init microsoft clarity
|
|
12570
12574
|
Clarity.init(CLARITY_ID);
|
|
12571
|
-
const userProperties = this.getCommonParams();
|
|
12575
|
+
const userProperties = await this.getCommonParams();
|
|
12572
12576
|
mixpanel.register(userProperties);
|
|
12573
12577
|
this.setConfig();
|
|
12574
12578
|
this.trackPageView();
|
|
@@ -12650,22 +12654,39 @@ class Analytics {
|
|
|
12650
12654
|
}
|
|
12651
12655
|
}
|
|
12652
12656
|
}
|
|
12653
|
-
setConfig(
|
|
12654
|
-
|
|
12655
|
-
|
|
12656
|
-
this.
|
|
12657
|
-
|
|
12658
|
-
|
|
12659
|
-
|
|
12657
|
+
setConfig(params = {
|
|
12658
|
+
userId: getProfileId(),
|
|
12659
|
+
email: getProfileEmail(),
|
|
12660
|
+
locale: this.locale,
|
|
12661
|
+
}) {
|
|
12662
|
+
this.lastGConfig = params;
|
|
12663
|
+
const { userId, email, locale } = params;
|
|
12664
|
+
const eventParams = {
|
|
12665
|
+
user_id: userId,
|
|
12666
|
+
is_logged: userId ? "yes" : "no",
|
|
12667
|
+
locale: locale,
|
|
12660
12668
|
platform: this.platform,
|
|
12661
|
-
user_type: getUserType(
|
|
12669
|
+
user_type: getUserType(email),
|
|
12670
|
+
};
|
|
12671
|
+
mixpanel.track("g_config", eventParams);
|
|
12672
|
+
window.dataLayer.push({
|
|
12673
|
+
event: "g_config",
|
|
12674
|
+
...eventParams,
|
|
12662
12675
|
});
|
|
12663
12676
|
}
|
|
12677
|
+
getLastGConfig() {
|
|
12678
|
+
return this.lastGConfig;
|
|
12679
|
+
}
|
|
12664
12680
|
trackPageView() {
|
|
12665
|
-
|
|
12681
|
+
const eventParams = {
|
|
12666
12682
|
page_title: document.title,
|
|
12667
12683
|
page_location: window.location.href,
|
|
12668
|
-
page_referrer:
|
|
12684
|
+
page_referrer: getReferrer(),
|
|
12685
|
+
};
|
|
12686
|
+
mixpanel.track("page_view", eventParams);
|
|
12687
|
+
window.dataLayer.push({
|
|
12688
|
+
event: "page_view",
|
|
12689
|
+
...eventParams,
|
|
12669
12690
|
});
|
|
12670
12691
|
}
|
|
12671
12692
|
setUser(userId, userParams) {
|
package/dist/index.js
CHANGED
|
@@ -12005,7 +12005,7 @@ const GA_ECOMMERCE_EVENTS = [
|
|
|
12005
12005
|
"begin_checkout",
|
|
12006
12006
|
"add_payment_info",
|
|
12007
12007
|
];
|
|
12008
|
-
const INTERNAL_USER_EMAILS = ["rozmova.me", "
|
|
12008
|
+
const INTERNAL_USER_EMAILS = ["rozmova.me", "clearly.help"];
|
|
12009
12009
|
|
|
12010
12010
|
const setQueryParam = (name, value) => {
|
|
12011
12011
|
const url = new URL(window.location.href);
|
|
@@ -12546,7 +12546,11 @@ class Analytics {
|
|
|
12546
12546
|
locale = "uk";
|
|
12547
12547
|
platform = "web";
|
|
12548
12548
|
dataLayer = [];
|
|
12549
|
-
|
|
12549
|
+
lastGConfig = {};
|
|
12550
|
+
isInitialized() {
|
|
12551
|
+
return this.initialized;
|
|
12552
|
+
}
|
|
12553
|
+
async init({ locale, platform, isClearly, } = {}) {
|
|
12550
12554
|
if (this.initialized)
|
|
12551
12555
|
return;
|
|
12552
12556
|
insertCustomerIOScript();
|
|
@@ -12570,7 +12574,7 @@ class Analytics {
|
|
|
12570
12574
|
});
|
|
12571
12575
|
// init microsoft clarity
|
|
12572
12576
|
Clarity.init(CLARITY_ID);
|
|
12573
|
-
const userProperties = this.getCommonParams();
|
|
12577
|
+
const userProperties = await this.getCommonParams();
|
|
12574
12578
|
mixpanel.register(userProperties);
|
|
12575
12579
|
this.setConfig();
|
|
12576
12580
|
this.trackPageView();
|
|
@@ -12652,22 +12656,39 @@ class Analytics {
|
|
|
12652
12656
|
}
|
|
12653
12657
|
}
|
|
12654
12658
|
}
|
|
12655
|
-
setConfig(
|
|
12656
|
-
|
|
12657
|
-
|
|
12658
|
-
this.
|
|
12659
|
-
|
|
12660
|
-
|
|
12661
|
-
|
|
12659
|
+
setConfig(params = {
|
|
12660
|
+
userId: getProfileId(),
|
|
12661
|
+
email: getProfileEmail(),
|
|
12662
|
+
locale: this.locale,
|
|
12663
|
+
}) {
|
|
12664
|
+
this.lastGConfig = params;
|
|
12665
|
+
const { userId, email, locale } = params;
|
|
12666
|
+
const eventParams = {
|
|
12667
|
+
user_id: userId,
|
|
12668
|
+
is_logged: userId ? "yes" : "no",
|
|
12669
|
+
locale: locale,
|
|
12662
12670
|
platform: this.platform,
|
|
12663
|
-
user_type: getUserType(
|
|
12671
|
+
user_type: getUserType(email),
|
|
12672
|
+
};
|
|
12673
|
+
mixpanel.track("g_config", eventParams);
|
|
12674
|
+
window.dataLayer.push({
|
|
12675
|
+
event: "g_config",
|
|
12676
|
+
...eventParams,
|
|
12664
12677
|
});
|
|
12665
12678
|
}
|
|
12679
|
+
getLastGConfig() {
|
|
12680
|
+
return this.lastGConfig;
|
|
12681
|
+
}
|
|
12666
12682
|
trackPageView() {
|
|
12667
|
-
|
|
12683
|
+
const eventParams = {
|
|
12668
12684
|
page_title: document.title,
|
|
12669
12685
|
page_location: window.location.href,
|
|
12670
|
-
page_referrer:
|
|
12686
|
+
page_referrer: getReferrer(),
|
|
12687
|
+
};
|
|
12688
|
+
mixpanel.track("page_view", eventParams);
|
|
12689
|
+
window.dataLayer.push({
|
|
12690
|
+
event: "page_view",
|
|
12691
|
+
...eventParams,
|
|
12671
12692
|
});
|
|
12672
12693
|
}
|
|
12673
12694
|
setUser(userId, userParams) {
|