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

Add an analytics event for search results count #5109

Merged
merged 4 commits into from
Nov 7, 2024

Conversation

Danil49
Copy link
Contributor

@Danil49 Danil49 commented Oct 29, 2024

Fixes

Fixes #4561 by @obulat

Description

This PR introduces a new analytics event, GET_SEARCH_RESULTS, that logs the number of results returned for each user search query for each media type (image and audio). By adding GET_SEARCH_RESULTS, we gain insight into queries that yield few or no results, enabling us to better understand and address potential gaps in openverse search capabilities.

As was advised in issue #4561 a GET_SEARCH_RESULTS event was placed near the existing SUBMIT_SEARCH event. The very sending of the event was implemented in the fetchSingleMediaType function before we return mediaCount, if page is 1 (so, it fires once per a search term, and does not fire when user clicks on Load more)

if (page == 1) {
    $sendCustomEvent("GET_SEARCH_RESULTS", {
         mediaType: mediaType,
         query: queryParams.q,
         resultsCount: mediaCount
    })
}

Testing Instructions

Project setup and initialisation was done according to the General setup guide, but despite this, for some reason analytical events were not sent to the Plausible server (http://0.0.0.0:50288/localhost), as it was unreachable for none of them. Even though it was started, initialised and there were no visible errors in logs. So, this didn't give the ability to test and see the stats directly in the form of a chart etc on Plausible server.
Screenshot_1

Despite this operability can be tested using the developer tools in the browser. The following image shows that events are successfully sent as intended without any visible bugs.
Screenshot_2

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • I ran the DAG documentation generator (ov just catalog/generate-docs for catalog
    PRs) or the media properties generator (ov just catalog/generate-docs media-props
    for the catalog or ov just api/generate-docs for the API) where applicable.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@Danil49 Danil49 requested a review from a team as a code owner October 29, 2024 13:19
@Danil49 Danil49 requested review from obulat and dhruvkb October 29, 2024 13:19
@openverse-bot openverse-bot added 🧱 stack: frontend Related to the Nuxt frontend 🟨 priority: medium Not blocking but should be addressed soon ✨ goal: improvement Improvement to an existing user-facing feature 💻 aspect: code Concerns the software code in the repository labels Oct 29, 2024
@Danil49
Copy link
Contributor Author

Danil49 commented Oct 29, 2024

@obulat Could you please advise how to find the problem that caused my PR to fail during "CI + CD / Lint files" test, as I can see there is some kind of problem with "prettier" in error logs?

@Danil49
Copy link
Contributor Author

Danil49 commented Nov 5, 2024

Good afternoon @obulat, I would like to ask your opinion on the work done, is the merge request valid?

@obulat
Copy link
Contributor

obulat commented Nov 5, 2024

Good afternoon @obulat, I would like to ask your opinion on the work done, is the merge request valid?

Hi, @Danil49, sorry for the delay! The Pull request looks really good, and I just need to test it locally. I'll do it tomorrow, sorry again!

@openverse-bot
Copy link
Collaborator

Based on the contributor urgency of this PR, the following reviewers are being gently reminded to review this PR:

@obulat
@dhruvkb
This reminder is being automatically generated due to the urgency configuration.

Excluding weekend1 days, this PR was ready for review 6 day(s) ago. PRs labelled with contributor urgency are expected to be reviewed within 3 weekday(s)2.

@Danil49, if this PR is not ready for a review, please draft it to prevent reviewers from getting further unnecessary pings.

Footnotes

  1. Specifically, Saturday and Sunday.

  2. For the purpose of these reminders we treat Monday - Friday as weekdays. Please note that the operation that generates these reminders runs at midnight UTC on Monday - Friday. This means that depending on your timezone, you may be pinged outside of the expected range.

Copy link
Contributor

@obulat obulat left a comment

Choose a reason for hiding this comment

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

Tested well locally! Thank you for your contribution, @Danil49

@obulat obulat merged commit cd37daf into WordPress:main Nov 7, 2024
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository ✨ goal: improvement Improvement to an existing user-facing feature 🟨 priority: medium Not blocking but should be addressed soon 🧱 stack: frontend Related to the Nuxt frontend
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add an analytics event showing how many results a search yields
3 participants