Edit analytics

Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
Hadi
2026-03-16 23:24:08 +01:00
parent 0cb4f515ce
commit 5b4ca98f70
2 changed files with 38 additions and 6 deletions

View File

@@ -76,7 +76,16 @@
totalPages = data.pagination.totalPages;
totalResults = data.pagination.totalResults;
if (typeof window !== "undefined" && (window as any).umami) {
(window as any).umami.track("search", { query: lastQuery, results: totalResults });
(window as any).umami.track("search", {
query: lastQuery,
results: totalResults,
hasResults: totalResults > 0,
});
if (totalResults === 0) {
(window as any).umami.track("search_no_results", {
query: lastQuery,
});
}
}
} catch (e) {
console.error("Search error:", e);