Skip to content

Implement search term logging and analytics#15932

Open
adalcima wants to merge 6 commits into
mainfrom
TP1-3913-Implement-search-term-logging-and-analytics
Open

Implement search term logging and analytics#15932
adalcima wants to merge 6 commits into
mainfrom
TP1-3913-Implement-search-term-logging-and-analytics

Conversation

@adalcima
Copy link
Copy Markdown
Collaborator

@adalcima adalcima commented May 14, 2026

Description

This PR adds logging for site search by combining Wagtail search_promotions module with a local SearchEvent model.

Related issue: TP1-3913
Review app: https://foundation-s-tp1-3913-i-fgoydx.mofostaging.net/cms/

Note: Follow up tickets will be created as mentioned in the ticket.

Main changes

  • Added searchpromotions native module to enable basic logging of search queries.
  • Added a SearchEvent model to extend the logic of searchpromotions module and store: query_string, language, results_count, created_at fields. With this model, we can record searches that yield no results.
  • Updated search view to log on initial search submit (both searchpromotions and SearchEvent logs).

How to test:

  1. Visit the search page and try different terms.
  2. Log in to the review app and verify that there's a new report under Reports -> Search terms, which displays the search terms and a hit counter. Explore the options to filter and generate a CSV or XLSX file.
  3. Also, check that a new Promoted search result setting has been added. This can be populated with popular terms from the new Search Promotions module.
  4. A new search_searchevent table is storing additional data. For now, we are only storing records.
    Credentials to connect to the Heroku DB are available here

Images

  • Search termsn report
image - Promoted search results setting image - SearchEvent DB model image

@adalcima adalcima temporarily deployed to foundation-s-tp1-3913-i-fgoydx May 14, 2026 17:05 Inactive
@adalcima adalcima temporarily deployed to foundation-s-tp1-3913-i-fgoydx May 14, 2026 19:46 Inactive
@adalcima adalcima temporarily deployed to foundation-s-tp1-3913-i-fgoydx May 15, 2026 15:37 Inactive
@adalcima adalcima temporarily deployed to foundation-s-tp1-3913-i-fgoydx May 16, 2026 00:47 Inactive
Copy link
Copy Markdown
Collaborator

@danielfmiranda danielfmiranda left a comment

Choose a reason for hiding this comment

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

Wow! Very cool @adalcima this will definitely be useful in the future. Thanks for taking this on. Looks good to me! Approved 👍

@adalcima adalcima requested a deployment to foundation-s-tp1-3913-i-fgoydx May 19, 2026 21:29 Pending
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.

2 participants