@hitkeep/tracker 2.16.0 → 2.17.0
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/core.d.cts +1 -0
- package/dist/core.d.ts +1 -0
- package/dist/index.cjs +7 -1
- package/dist/index.js +7 -1
- package/dist/version.d.cts +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/core.d.cts
CHANGED
|
@@ -35,6 +35,7 @@ export interface TrackerHandle {
|
|
|
35
35
|
export type HitKeepWindow = Window & typeof globalThis & {
|
|
36
36
|
hk?: {
|
|
37
37
|
event?: EventSender;
|
|
38
|
+
getSessionId?: () => string | undefined;
|
|
38
39
|
_bootstrapped?: boolean;
|
|
39
40
|
_webVitals?: WebVitalsTrackerContext;
|
|
40
41
|
_webVitalsLoaded?: boolean;
|
package/dist/core.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export interface TrackerHandle {
|
|
|
35
35
|
export type HitKeepWindow = Window & typeof globalThis & {
|
|
36
36
|
hk?: {
|
|
37
37
|
event?: EventSender;
|
|
38
|
+
getSessionId?: () => string | undefined;
|
|
38
39
|
_bootstrapped?: boolean;
|
|
39
40
|
_webVitals?: WebVitalsTrackerContext;
|
|
40
41
|
_webVitalsLoaded?: boolean;
|
package/dist/index.cjs
CHANGED
|
@@ -235,6 +235,7 @@ function createTracker(win, config) {
|
|
|
235
235
|
if (isTrackerBlocked(location.hostname, navigator.userAgent, navigator.doNotTrack, config.collectDnt, config.captureOnLocalhost) || isTrackingOptedOut(win)) {
|
|
236
236
|
if (config.bindToWindow) {
|
|
237
237
|
win.hk.event = noop;
|
|
238
|
+
win.hk.getSessionId = () => void 0;
|
|
238
239
|
}
|
|
239
240
|
return null;
|
|
240
241
|
}
|
|
@@ -544,8 +545,10 @@ function createTracker(win, config) {
|
|
|
544
545
|
}
|
|
545
546
|
bindAutoTracking(document, () => new URL(location.href), config, emitEvent, on);
|
|
546
547
|
const track2 = (name, properties) => emitEvent(name, properties ?? {});
|
|
548
|
+
const currentSessionId = () => active && !awaitingActivation && !isTrackingOptedOut(win) ? sessionId : void 0;
|
|
547
549
|
if (config.bindToWindow) {
|
|
548
550
|
win.hk.event = track2;
|
|
551
|
+
win.hk.getSessionId = currentSessionId;
|
|
549
552
|
}
|
|
550
553
|
const cleanup2 = () => {
|
|
551
554
|
if (!active) {
|
|
@@ -565,6 +568,9 @@ function createTracker(win, config) {
|
|
|
565
568
|
if (win.hk.event === track2) {
|
|
566
569
|
delete win.hk.event;
|
|
567
570
|
}
|
|
571
|
+
if (win.hk.getSessionId === currentSessionId) {
|
|
572
|
+
delete win.hk.getSessionId;
|
|
573
|
+
}
|
|
568
574
|
win.hk._bootstrapped = false;
|
|
569
575
|
}
|
|
570
576
|
};
|
|
@@ -621,7 +627,7 @@ function bindAutoTracking(document, getCurrentUrl, options, emitEvent, on) {
|
|
|
621
627
|
}
|
|
622
628
|
|
|
623
629
|
// src/tracker/version.ts
|
|
624
|
-
var TRACKER_VERSION = "2.
|
|
630
|
+
var TRACKER_VERSION = "2.17.0";
|
|
625
631
|
|
|
626
632
|
// src/tracker/package.ts
|
|
627
633
|
var MAX_PRE_INIT_EVENTS = 32;
|
package/dist/index.js
CHANGED
|
@@ -198,6 +198,7 @@ function createTracker(win, config) {
|
|
|
198
198
|
if (isTrackerBlocked(location.hostname, navigator.userAgent, navigator.doNotTrack, config.collectDnt, config.captureOnLocalhost) || isTrackingOptedOut(win)) {
|
|
199
199
|
if (config.bindToWindow) {
|
|
200
200
|
win.hk.event = noop;
|
|
201
|
+
win.hk.getSessionId = () => void 0;
|
|
201
202
|
}
|
|
202
203
|
return null;
|
|
203
204
|
}
|
|
@@ -507,8 +508,10 @@ function createTracker(win, config) {
|
|
|
507
508
|
}
|
|
508
509
|
bindAutoTracking(document, () => new URL(location.href), config, emitEvent, on);
|
|
509
510
|
const track2 = (name, properties) => emitEvent(name, properties ?? {});
|
|
511
|
+
const currentSessionId = () => active && !awaitingActivation && !isTrackingOptedOut(win) ? sessionId : void 0;
|
|
510
512
|
if (config.bindToWindow) {
|
|
511
513
|
win.hk.event = track2;
|
|
514
|
+
win.hk.getSessionId = currentSessionId;
|
|
512
515
|
}
|
|
513
516
|
const cleanup2 = () => {
|
|
514
517
|
if (!active) {
|
|
@@ -528,6 +531,9 @@ function createTracker(win, config) {
|
|
|
528
531
|
if (win.hk.event === track2) {
|
|
529
532
|
delete win.hk.event;
|
|
530
533
|
}
|
|
534
|
+
if (win.hk.getSessionId === currentSessionId) {
|
|
535
|
+
delete win.hk.getSessionId;
|
|
536
|
+
}
|
|
531
537
|
win.hk._bootstrapped = false;
|
|
532
538
|
}
|
|
533
539
|
};
|
|
@@ -584,7 +590,7 @@ function bindAutoTracking(document, getCurrentUrl, options, emitEvent, on) {
|
|
|
584
590
|
}
|
|
585
591
|
|
|
586
592
|
// src/tracker/version.ts
|
|
587
|
-
var TRACKER_VERSION = "2.
|
|
593
|
+
var TRACKER_VERSION = "2.17.0";
|
|
588
594
|
|
|
589
595
|
// src/tracker/package.ts
|
|
590
596
|
var MAX_PRE_INIT_EVENTS = 32;
|
package/dist/version.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const TRACKER_VERSION = "2.
|
|
1
|
+
export declare const TRACKER_VERSION = "2.17.0";
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const TRACKER_VERSION = "2.
|
|
1
|
+
export declare const TRACKER_VERSION = "2.17.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hitkeep/tracker",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.17.0",
|
|
4
4
|
"description": "Typed, cookieless web analytics tracker for React, Vue, Angular, and Astro. Official browser SDK for HitKeep, a privacy-friendly, self-hostable Google Analytics alternative.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|