From 63ad5a8d3e730aad79ecf1fcafa223da07f0a717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bergstr=C3=B6m?= Date: Thu, 11 Apr 2024 16:59:11 +0100 Subject: [PATCH] feat: add `location.search` to default event path Have default path include `location.search` as part of passing path belonging to events. PR: https://github.com/Topsort/analytics.js/pull/243 --- src/detector.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detector.ts b/src/detector.ts index 7342534..9578942 100644 --- a/src/detector.ts +++ b/src/detector.ts @@ -208,7 +208,7 @@ function getPage(): string { const hash = location.hash; // This is to support HashRouter from either ReactRouter or VueRouter. if (hash[1] === "/") return hash; - return location.pathname; + return `${location.pathname}${location.search}`; } function getEvent(type: EventType, node: HTMLElement): ProductEvent {