Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture search terms in playbook analytics #1181

Merged
merged 4 commits into from
Aug 22, 2023
Merged

Conversation

lookupdaily
Copy link
Contributor

@lookupdaily lookupdaily commented Jul 20, 2023

This adds the ability to track common search terms on the playbook using our analytics tool Plausible.

This is related to issue #1024 and was a suggestion from the content team. In order to inform future content changes (e.g. restructures), it might be useful to have some kind of analytics to track common search terms. This has two benefits:

  • understanding what might be difficult to find by standard navigation
  • highlighting potential content gaps in the playbook

By default Plausible strips query params from urls to count page views. We can however, use a custom script to capture query parameters, and track them as page views in Plausible.

How it works

By creating a 'Goal' for the /search* url in the Plausible dashboard, we can still view the total number of visitors to the search page. When clicking on the goal, common terms are listed as pages under the 'Top pages' section. Common search terms will also be listed under general page views, but this is an easy way to view them together.

Goals shown on the Plausible Dashboard showing 'Search' goal
Top search terms shown as page views

Things to note

Special characters

This solution currently only handles spaces in search terms, and joins them together using a '-'. It does not remove other special characters. However, special characters are shown on the plausible dashboard (see example below). It is also worth noting that search itself does not currently handle special characters. This does mean that there may be more variations of the same or similar terms though - which might create additional work when analysing the top terms.
Special characters are shown in the plausible dashboard

What's next

We are also looking ways to understand if people are finding what they're looking for on the playbook. One suggestion is to add a button on the search page to let users let us know themselves (linked to a simple form).

@netlify
Copy link

netlify bot commented Jul 20, 2023

Deploy Preview for laughing-payne-b9fbd2 ready!

Name Link
🔨 Latest commit 613c120
🔍 Latest deploy log https://app.netlify.com/sites/laughing-payne-b9fbd2/deploys/64e39fe50089d700096a1b90
😎 Deploy Preview https://deploy-preview-1181--laughing-payne-b9fbd2.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.

@lookupdaily lookupdaily force-pushed the capture-search-terms branch 4 times, most recently from 5ff5006 to 7741854 Compare July 20, 2023 16:29
@lookupdaily lookupdaily changed the title WIP: Capture search terms in playbook analytics Capture search terms in playbook analytics Aug 17, 2023
@lookupdaily lookupdaily marked this pull request as ready for review August 18, 2023 08:25
Copy link
Contributor

@yndajas yndajas left a comment

Choose a reason for hiding this comment

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

I don't know how Plausible works (trust you and Adam on that!), but have a few quick tidy up suggestions

src/_layouts/default.html Show resolved Hide resolved
src/_layouts/default.html Outdated Show resolved Hide resolved
src/_webpack/plausible.js Outdated Show resolved Hide resolved
src/_layouts/default.html Outdated Show resolved Hide resolved
src/_layouts/default.html Outdated Show resolved Hide resolved
src/_webpack/plausible.js Outdated Show resolved Hide resolved
By default Plausible strips query params from urls to count page views. We want to track search terms via the 'query' tag. To do this we will need to switch to using the manual Plausible script, and define a function to manually trigger events. This adds the custom plausible page view script from docs
@lookupdaily lookupdaily merged commit ac29860 into main Aug 22, 2023
6 checks passed
@lookupdaily lookupdaily deleted the capture-search-terms branch August 22, 2023 08:22
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.

3 participants