vitessio / website

vitess.io website and other project management related content
https://vitess.io
Apache License 2.0
53 stars 198 forks source link

Track Lunr search queries and search-result clicks #1519

Closed chalin closed 1 year ago

chalin commented 1 year ago

A note about the deploy preview: the site preview will allow you to confirm that search is still functional, but it won't generate GA4 events, since analytics is only enabled in production. When _debug is enabled (which it was for my original commit, but has since been disabled), you can at least see that the tracking functions get called, like this:

trackSearchEvent: searchTerm = installation
trackSearchResultClick: searchTerm = installation, link = https://deploy-preview-1519--vitess.netlify.app/docs/17.0/get-started/local-mac/

I've locally built a "production" version of the site, and can confirm that GA4 is receiving both search and click (related to search) events. Notice the search_term attribute in both events:

Event Event attributes
Notice the search event with event count of 1: Screen Shot 2023-07-01 at 11 33 43 Screen Shot 2023-07-01 at 11 34 04
Oops forgot to get a click-event screenshot Screen Shot 2023-07-01 at 11 34 24

/cc @harshit-gangal @thisisobate @nate-double-u

netlify[bot] commented 1 year ago

Deploy Preview for vitess ready!

Name Link
Latest commit 792cd9cf9adfae509e64961829640e095392c55b
Latest deploy log https://app.netlify.com/sites/vitess/deploys/64a060630bbe97000884081b
Deploy Preview https://deploy-preview-1519--vitess.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.