sdk changes

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-02-11 21:31:12 +01:00
parent 484a6b1d41
commit 447fa5896e
65 changed files with 9428 additions and 723 deletions

View File

@@ -8,6 +8,8 @@ type MixanWebOptions = MixanOptions & {
};
export class MixanWeb extends Mixan<MixanWebOptions> {
private lastPath = '';
constructor(options: MixanWebOptions) {
super(options);
@@ -24,14 +26,6 @@ export class MixanWeb extends Mixan<MixanWebOptions> {
return typeof document === 'undefined';
}
private getTimezone() {
try {
return Intl.DateTimeFormat().resolvedOptions().timeZone;
} catch (e) {
return undefined;
}
}
public trackOutgoingLinks() {
if (this.isServer()) {
return;
@@ -90,9 +84,16 @@ export class MixanWeb extends Mixan<MixanWebOptions> {
return;
}
const path = window.location.href;
if (this.lastPath === path) {
return;
}
this.lastPath = path;
super.event('screen_view', {
...(properties ?? {}),
path: window.location.href,
path,
title: document.title,
referrer: document.referrer,
});