Skip to content

feat (api): Adds ability for click insights events to be triggered#1916

Merged
8bittitan merged 8 commits into
mainfrom
feat/docsearch-click-insights-events
Jun 15, 2023
Merged

feat (api): Adds ability for click insights events to be triggered#1916
8bittitan merged 8 commits into
mainfrom
feat/docsearch-click-insights-events

Conversation

@8bittitan

Copy link
Copy Markdown
Contributor

Recently we added insights options for DocSearch in #1904. This PR now also adds in the ability for click analytics to be triggered as well when insights option is active.

@netlify

netlify Bot commented Jun 12, 2023

Copy link
Copy Markdown

Deploy Preview for docsearch canceled.

Name Link
🔨 Latest commit ab3f94f
🔍 Latest deploy log https://app.netlify.com/sites/docsearch/deploys/648b11e220f2d40008beb68d

@levimichael levimichael left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! 🥳

item: InternalDocSearchHit,
itemPosition: number
): InsightsParamsWithItems<ClickedObjectIDsAfterSearchParams> {
const insightsItem = item as AlgoliaInsightsHit;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we run into issues with this assertion?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, if we have an insights plugin active the needed attributes are added to the item. All AlgoliaInsightsHit type adds is better typings for the __autocomplete_* attributes.

Comment thread packages/docsearch-react/src/Hit.tsx Outdated
Comment thread packages/docsearch-react/src/utils/buildInsightsClickParams.ts Outdated
Comment thread packages/docsearch-react/src/DocSearchModal.tsx Outdated
8bittitan and others added 2 commits June 14, 2023 10:02
Co-authored-by: François Chalifour <francoischalifour@users.noreply.github.com>
Comment thread packages/docsearch-react/src/Hit.tsx Outdated
@8bittitan 8bittitan merged commit cacade4 into main Jun 15, 2023
@8bittitan 8bittitan deleted the feat/docsearch-click-insights-events branch June 15, 2023 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants