Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"remark-prism": "^1.3.6",
"rss": "^1.2.2",
"sass": "^1.69.5",
"search-insights": "^2.2.3",
"search-insights": "^2.17.2",
"server-only": "^0.0.1",
"sharp": "^0.33.4",
"tailwindcss-scoped-preflight": "^3.0.4",
Expand Down Expand Up @@ -137,4 +137,4 @@
"node": "20.11.0",
"yarn": "1.22.21"
}
}
}
25 changes: 16 additions & 9 deletions src/components/search/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';

import {Fragment, useCallback, useEffect, useRef, useState} from 'react';
import * as Sentry from '@sentry/nextjs';
import {
Hit,
Result,
Expand Down Expand Up @@ -200,15 +201,21 @@ export function Search({path, autoFocus, searchPlatforms = [], showChatBot}: Pro
return;
}

algoliaInsights('clickedObjectIDsAfterSearch', {
eventName: 'documentation_search_result_click',
userToken: randomUserToken,
index: hit.index,
objectIDs: [hit.id],
// Positions in Algolia are 1 indexed
queryID: hit.queryID ?? '',
positions: [position + 1],
});
// we don't want analytics to crash anything or log errors the console
// so we'll catch any errors and send them to Sentry here silently
try {
algoliaInsights('clickedObjectIDsAfterSearch', {
eventName: 'documentation_search_result_click',
userToken: randomUserToken,
index: hit.index,
objectIDs: [hit.id],
// Positions in Algolia are 1 indexed
queryID: hit.queryID ?? '',
positions: [position + 1],
});
} catch (error) {
Sentry.captureException(error);
}
}, []);

return (
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11110,10 +11110,10 @@ scheduler@^0.23.0:
dependencies:
loose-envify "^1.1.0"

search-insights@^2.2.3:
version "2.13.0"
resolved "https://registry.npmjs.org/search-insights/-/search-insights-2.13.0.tgz"
integrity sha512-Orrsjf9trHHxFRuo9/rzm0KIWmgzE8RMlZMzuhZOJ01Rnz3D0YBAe+V6473t6/H6c7irs6Lt48brULAiRWb3Vw==
search-insights@^2.17.2:
version "2.17.2"
resolved "https://registry.yarnpkg.com/search-insights/-/search-insights-2.17.2.tgz#d13b2cabd44e15ade8f85f1c3b65c8c02138629a"
integrity sha512-zFNpOpUO+tY2D85KrxJ+aqwnIfdEGi06UH2+xEb+Bp9Mwznmauqc9djbnBibJO5mpfUPPa8st6Sx65+vbeO45g==

section-matter@^1.0.0:
version "1.0.0"
Expand Down
Loading