Skip to content

Commit 50103ba

Browse files
kodster28nevikashah
authored andcommitted
[Analytics] Add search tracking (#24732)
* [Analytics] Add sidebar search event * Update
1 parent 2b8576e commit 50103ba

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/components/overrides/Sidebar.astro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const [product, module] = Astro.url.pathname.split("/").filter(Boolean);
3737
<Default><slot /></Default>
3838

3939
<script>
40+
import { track } from "~/util/zaraz"
4041
function initSidebarSearch() {
4142
const searchInput = document.getElementById('sidebar-search') as HTMLInputElement;
4243
const noResultsMessage = document.getElementById('sidebar-no-results') as HTMLElement;
@@ -94,6 +95,7 @@ const [product, module] = Astro.url.pathname.split("/").filter(Boolean);
9495
function filterSidebarItems(query: string) {
9596
const items = sidebarContent!.querySelectorAll('li');
9697
const detailsElements = sidebarContent!.querySelectorAll('details');
98+
track("use sidebar search", { query: query });
9799

98100
if (!query.trim()) {
99101
// Reset to original state

0 commit comments

Comments
 (0)