From 25ecacadc6c8f612fea9e49394533c1ae21a4d33 Mon Sep 17 00:00:00 2001 From: Viet Date: Wed, 23 Apr 2025 17:04:17 +0700 Subject: [PATCH] Update trackEvent --- package.json | 2 +- src/utils/index.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index a63db12..e8fe3a6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aesirx-analytics", - "version": "2.4.1", + "version": "2.4.2", "license": "GPL-3.0-only", "author": "AesirX", "repository": "https://gitlab.redweb.dk/aesirx/analytics", diff --git a/src/utils/index.ts b/src/utils/index.ts index 050c2d0..d71e7a5 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -102,7 +102,7 @@ const startTracker = async ( } }; -const trackEvent = async (endpoint: string, referer?: string, data?: object) => { +const trackEvent = async (endpoint: string, referer?: string, data?: object, _url?: string) => { const allow = sessionStorage.getItem('aesirx-analytics-allow'); const reject = sessionStorage.getItem('aesirx-analytics-rejected'); if (allow === '0' || reject === 'true') { @@ -119,7 +119,7 @@ const trackEvent = async (endpoint: string, referer?: string, data?: object) => ? location.protocol + '//' + location.host : location.protocol + '//' + location.host + window['referer'] : ''; - const url = location.protocol + '//' + location.host + location.pathname; + const url = _url ? _url : location.protocol + '//' + location.host + location.pathname; const user_agent = window.navigator.userAgent; const browser = Bowser.parse(window.navigator.userAgent); const browser_name = browser?.browser?.name;