File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change 99</div >
1010
1111<script >
12+ import { track } from "~/util/zaraz";
13+
1214 const { pathname } = window.location;
1315
1416 const anchor = document.getElementById("404-search-link");
1719 const pretty = pathname.replaceAll("/", " ").replaceAll("-", " ").trim();
1820
1921 anchor.setAttribute("href", `/search/?q=${encodeURIComponent(pretty)}`);
22+ anchor.addEventListener("click", () => {
23+ track("serp from 404", { query: pretty });
24+ });
2025 }
2126</script >
Original file line number Diff line number Diff line change 1+ import { track } from "~/util/zaraz" ;
12import type { DocSearchClientOptions } from "@astrojs/starlight-docsearch" ;
23
34export default {
@@ -26,6 +27,10 @@ export default {
2627 __v : null ,
2728 key : state . query ,
2829 props : {
30+ onclick : ( ) => {
31+ track ( "serp from widget" , { query : state . query } ) ;
32+ } ,
33+ id : "docsearch-search-link" ,
2934 href : `/search/?query=${ state . query } ` ,
3035 target : "_blank" ,
3136 children : "View all results" ,
You can’t perform that action at this time.
0 commit comments