rozmova-analytics 1.1.43 → 1.1.45
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/README.md +2 -21
- package/dist/constants.d.ts +0 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.esm.js +1 -58
- package/dist/index.js +1 -58
- package/dist/index.umd.js +4 -4
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -166,20 +166,6 @@ Resets the current user across all analytics providers, clears stored user data,
|
|
|
166
166
|
Analytics.resetUser();
|
|
167
167
|
```
|
|
168
168
|
|
|
169
|
-
### `setUserTag(key, value)`
|
|
170
|
-
|
|
171
|
-
Sets a user tag in Microsoft Clarity for enhanced user identification and session analysis.
|
|
172
|
-
|
|
173
|
-
**Parameters:**
|
|
174
|
-
- `key: string` - The tag key
|
|
175
|
-
- `value: string` - The tag value
|
|
176
|
-
|
|
177
|
-
**Example:**
|
|
178
|
-
```javascript
|
|
179
|
-
Analytics.setUserTag("user_type", "premium");
|
|
180
|
-
Analytics.setUserTag("subscription_plan", "pro");
|
|
181
|
-
```
|
|
182
|
-
|
|
183
169
|
### `setConfig(params?)`
|
|
184
170
|
|
|
185
171
|
Updates the analytics configuration with new parameters. This is a private method but can be called indirectly through `setUser()` or `resetUser()`.
|
|
@@ -207,7 +193,7 @@ Analytics.setLocale("es");
|
|
|
207
193
|
Tracks a `page_scroll` event in Mixpanel when the user scrolls to the bottom of the page. Called automatically during `init()` unless `trackPageScroll` is set to `false`.
|
|
208
194
|
|
|
209
195
|
**Parameters:**
|
|
210
|
-
- `
|
|
196
|
+
- `customElement?: HTMLElement` - Optional scrollable HTML element to track. If not provided, defaults to tracking the window scroll against `document.body`.
|
|
211
197
|
|
|
212
198
|
**Returns:** `() => void` - A cleanup function that removes the scroll listener.
|
|
213
199
|
|
|
@@ -218,7 +204,7 @@ Analytics.init({ locale: "en", platform: "web" });
|
|
|
218
204
|
|
|
219
205
|
// Disable automatic tracking and call manually
|
|
220
206
|
Analytics.init({ locale: "en", trackPageScroll: false });
|
|
221
|
-
const cleanup = Analytics.trackPageScroll(".main-content");
|
|
207
|
+
const cleanup = Analytics.trackPageScroll(document.querySelector(".main-content"));
|
|
222
208
|
|
|
223
209
|
// Remove the scroll listener when no longer needed
|
|
224
210
|
cleanup();
|
|
@@ -433,10 +419,6 @@ console.log(attribution.funnelInfo, attribution.trackingParams);
|
|
|
433
419
|
// Get GA client ID
|
|
434
420
|
const gaClientId = await Analytics.getGAClientId();
|
|
435
421
|
|
|
436
|
-
// Set user tags for Clarity
|
|
437
|
-
Analytics.setUserTag("subscription", "premium");
|
|
438
|
-
Analytics.setUserTag("user_segment", "power_user");
|
|
439
|
-
|
|
440
422
|
// Update locale
|
|
441
423
|
Analytics.setLocale("fr");
|
|
442
424
|
|
|
@@ -452,7 +434,6 @@ Make sure to configure your analytics provider tokens in your constants file:
|
|
|
452
434
|
// constants.js
|
|
453
435
|
export const MIXPANEL_TOKEN = "your-mixpanel-token";
|
|
454
436
|
export const GOOGLE_ANALYTICS_ID = "your-ga-measurement-id";
|
|
455
|
-
export const CLARITY_ID = "your-clarity-project-id";
|
|
456
437
|
export const GA_SERVER_CONTAINER_URL = "your-server-container-url";
|
|
457
438
|
```
|
|
458
439
|
|
package/dist/constants.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ export declare const GOOGLE_ANALYTICS_ID = "G-GYQLL028VQ";
|
|
|
5
5
|
export declare const GA_SERVER_CONTAINER_URL = "https://tagging.clearly.help";
|
|
6
6
|
export declare const MIXPANEL_TOKEN = "9d4cb3d213e5aee689ea01dd68ad65ad";
|
|
7
7
|
export declare const CUSTOMER_IO_WRITE_KEY = "e6d009719c77519432c3";
|
|
8
|
-
export declare const CLARITY_ID = "irbqmnlbwz";
|
|
9
8
|
export declare const SUPPORTED_LANGUAGES: string[];
|
|
10
9
|
export declare const GA_ECOMMERCE_EVENTS: string[];
|
|
11
10
|
export declare const INTERNAL_USER_EMAILS: string[];
|
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,6 @@ declare class Analytics {
|
|
|
21
21
|
trackPageScroll?: boolean;
|
|
22
22
|
}): Promise<void>;
|
|
23
23
|
private processDataLayer;
|
|
24
|
-
setUserTag(key: string, value: string): void;
|
|
25
24
|
getGAClientId(): Promise<string | null>;
|
|
26
25
|
setGAClientId: (clientId: string) => void;
|
|
27
26
|
trackEvent(eventName: string, properties?: EventParams, services?: {
|
|
@@ -48,7 +47,7 @@ declare class Analytics {
|
|
|
48
47
|
resetUser(): void;
|
|
49
48
|
getUserId: () => string;
|
|
50
49
|
getAttributionProperties(forcedAttributionProperties?: ForcedAttributionProperties): Promise<UserAttributionProperties>;
|
|
51
|
-
trackPageScroll(
|
|
50
|
+
trackPageScroll(customElement?: HTMLElement): () => void;
|
|
52
51
|
trackFirstPartyEvent(eventName: string, properties?: EventParams, forcedAttributionProperties?: ForcedAttributionProperties): Promise<Response>;
|
|
53
52
|
}
|
|
54
53
|
declare const _default: Analytics;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,52 +1,3 @@
|
|
|
1
|
-
function injectScript(projectId){
|
|
2
|
-
try{
|
|
3
|
-
(function (c, l, a, r, i, t, y) {
|
|
4
|
-
if(l.getElementById("clarity-script")){
|
|
5
|
-
return;
|
|
6
|
-
}
|
|
7
|
-
c[a] = c[a] ||
|
|
8
|
-
function () {
|
|
9
|
-
(c[a].q = c[a].q || []).push(arguments);
|
|
10
|
-
};
|
|
11
|
-
t = l.createElement(r);
|
|
12
|
-
t.async = 1;
|
|
13
|
-
t.src = "https://www.clarity.ms/tag/" + i + "?ref=npm";
|
|
14
|
-
t.id = "clarity-script";
|
|
15
|
-
y = l.getElementsByTagName(r)[0];
|
|
16
|
-
y.parentNode.insertBefore(t, y);
|
|
17
|
-
})(window, document, "clarity", "script", projectId);
|
|
18
|
-
return;
|
|
19
|
-
}catch(error){
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const Clarity = {
|
|
25
|
-
init(projectId) {
|
|
26
|
-
injectScript(projectId);
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
setTag(key, value) {
|
|
30
|
-
window.clarity('set', key, value);
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
identify(customerId, customSessionId, customPageId, friendlyName) {
|
|
34
|
-
window.clarity('identify', customerId, customSessionId, customPageId, friendlyName);
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
consent(consent = true) {
|
|
38
|
-
window.clarity('consent', consent);
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
upgrade(reason) {
|
|
42
|
-
window.clarity('upgrade', reason);
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
event(eventName) {
|
|
46
|
-
window.clarity('event', eventName);
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
|
|
50
1
|
/*! js-cookie v3.0.5 | MIT */
|
|
51
2
|
/* eslint-disable no-var */
|
|
52
3
|
function assign (target) {
|
|
@@ -11993,7 +11944,6 @@ const UTM_KEYS = [
|
|
|
11993
11944
|
const GOOGLE_ANALYTICS_ID = "G-GYQLL028VQ";
|
|
11994
11945
|
const MIXPANEL_TOKEN = "9d4cb3d213e5aee689ea01dd68ad65ad";
|
|
11995
11946
|
const CUSTOMER_IO_WRITE_KEY = "e6d009719c77519432c3";
|
|
11996
|
-
const CLARITY_ID = "irbqmnlbwz";
|
|
11997
11947
|
const SUPPORTED_LANGUAGES = ["en", "uk", "pl", "es", "ru"];
|
|
11998
11948
|
const GA_ECOMMERCE_EVENTS = [
|
|
11999
11949
|
"view_item_list",
|
|
@@ -12698,8 +12648,6 @@ class Analytics {
|
|
|
12698
12648
|
batch_requests: false,
|
|
12699
12649
|
loaded: (mixpanel) => (this.mxDistinctId = mixpanel.get_distinct_id()),
|
|
12700
12650
|
});
|
|
12701
|
-
// init microsoft clarity
|
|
12702
|
-
Clarity.init(CLARITY_ID);
|
|
12703
12651
|
this.setConfig(config);
|
|
12704
12652
|
this.trackPageView();
|
|
12705
12653
|
// const userProperties = this.getCommonParams();
|
|
@@ -12729,9 +12677,6 @@ class Analytics {
|
|
|
12729
12677
|
this.trackEvent(event?.eventName, event?.eventParams);
|
|
12730
12678
|
}
|
|
12731
12679
|
}
|
|
12732
|
-
setUserTag(key, value) {
|
|
12733
|
-
Clarity.setTag(key, value);
|
|
12734
|
-
}
|
|
12735
12680
|
async getGAClientId() {
|
|
12736
12681
|
return await getGAClientId();
|
|
12737
12682
|
}
|
|
@@ -12926,9 +12871,7 @@ class Analytics {
|
|
|
12926
12871
|
},
|
|
12927
12872
|
};
|
|
12928
12873
|
}
|
|
12929
|
-
trackPageScroll(
|
|
12930
|
-
const customElement = bodyElementQuerySelector &&
|
|
12931
|
-
document.querySelector(bodyElementQuerySelector);
|
|
12874
|
+
trackPageScroll(customElement) {
|
|
12932
12875
|
const handleScroll = () => {
|
|
12933
12876
|
const scrollTop = customElement
|
|
12934
12877
|
? customElement.scrollTop
|
package/dist/index.js
CHANGED
|
@@ -1,54 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function injectScript(projectId){
|
|
4
|
-
try{
|
|
5
|
-
(function (c, l, a, r, i, t, y) {
|
|
6
|
-
if(l.getElementById("clarity-script")){
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
c[a] = c[a] ||
|
|
10
|
-
function () {
|
|
11
|
-
(c[a].q = c[a].q || []).push(arguments);
|
|
12
|
-
};
|
|
13
|
-
t = l.createElement(r);
|
|
14
|
-
t.async = 1;
|
|
15
|
-
t.src = "https://www.clarity.ms/tag/" + i + "?ref=npm";
|
|
16
|
-
t.id = "clarity-script";
|
|
17
|
-
y = l.getElementsByTagName(r)[0];
|
|
18
|
-
y.parentNode.insertBefore(t, y);
|
|
19
|
-
})(window, document, "clarity", "script", projectId);
|
|
20
|
-
return;
|
|
21
|
-
}catch(error){
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const Clarity = {
|
|
27
|
-
init(projectId) {
|
|
28
|
-
injectScript(projectId);
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
setTag(key, value) {
|
|
32
|
-
window.clarity('set', key, value);
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
identify(customerId, customSessionId, customPageId, friendlyName) {
|
|
36
|
-
window.clarity('identify', customerId, customSessionId, customPageId, friendlyName);
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
consent(consent = true) {
|
|
40
|
-
window.clarity('consent', consent);
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
upgrade(reason) {
|
|
44
|
-
window.clarity('upgrade', reason);
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
event(eventName) {
|
|
48
|
-
window.clarity('event', eventName);
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
3
|
/*! js-cookie v3.0.5 | MIT */
|
|
53
4
|
/* eslint-disable no-var */
|
|
54
5
|
function assign (target) {
|
|
@@ -11995,7 +11946,6 @@ const UTM_KEYS = [
|
|
|
11995
11946
|
const GOOGLE_ANALYTICS_ID = "G-GYQLL028VQ";
|
|
11996
11947
|
const MIXPANEL_TOKEN = "9d4cb3d213e5aee689ea01dd68ad65ad";
|
|
11997
11948
|
const CUSTOMER_IO_WRITE_KEY = "e6d009719c77519432c3";
|
|
11998
|
-
const CLARITY_ID = "irbqmnlbwz";
|
|
11999
11949
|
const SUPPORTED_LANGUAGES = ["en", "uk", "pl", "es", "ru"];
|
|
12000
11950
|
const GA_ECOMMERCE_EVENTS = [
|
|
12001
11951
|
"view_item_list",
|
|
@@ -12700,8 +12650,6 @@ class Analytics {
|
|
|
12700
12650
|
batch_requests: false,
|
|
12701
12651
|
loaded: (mixpanel) => (this.mxDistinctId = mixpanel.get_distinct_id()),
|
|
12702
12652
|
});
|
|
12703
|
-
// init microsoft clarity
|
|
12704
|
-
Clarity.init(CLARITY_ID);
|
|
12705
12653
|
this.setConfig(config);
|
|
12706
12654
|
this.trackPageView();
|
|
12707
12655
|
// const userProperties = this.getCommonParams();
|
|
@@ -12731,9 +12679,6 @@ class Analytics {
|
|
|
12731
12679
|
this.trackEvent(event?.eventName, event?.eventParams);
|
|
12732
12680
|
}
|
|
12733
12681
|
}
|
|
12734
|
-
setUserTag(key, value) {
|
|
12735
|
-
Clarity.setTag(key, value);
|
|
12736
|
-
}
|
|
12737
12682
|
async getGAClientId() {
|
|
12738
12683
|
return await getGAClientId();
|
|
12739
12684
|
}
|
|
@@ -12928,9 +12873,7 @@ class Analytics {
|
|
|
12928
12873
|
},
|
|
12929
12874
|
};
|
|
12930
12875
|
}
|
|
12931
|
-
trackPageScroll(
|
|
12932
|
-
const customElement = bodyElementQuerySelector &&
|
|
12933
|
-
document.querySelector(bodyElementQuerySelector);
|
|
12876
|
+
trackPageScroll(customElement) {
|
|
12934
12877
|
const handleScroll = () => {
|
|
12935
12878
|
const scrollTop = customElement
|
|
12936
12879
|
? customElement.scrollTop
|