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 tracking when opening or searching in the Command Palette #41838

Merged
merged 3 commits into from Dec 18, 2023

Conversation

Aljullu
Copy link
Contributor

@Aljullu Aljullu commented Dec 1, 2023

Submission Review Guidelines:

Changes proposed in this Pull Request:

Closes #41837.

This PR adds tracking when the user opens the Command Palette and makes a search in it.

cc @pmcpinto

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. To test tracking, open the browser console (F12) and run localStorage.setItem( 'debug', 'wc-admin:*' );.
  2. Go to the post editor (Posts > Add New).
  3. Press Ctrl+K to open the Command Palette.
  4. Verify an event is triggered when the Command Palette was opened (in the browser console you will see wc-admin:tracks recordevent wcadmin_woocommerce_command_palette_open).
  5. Type a search term in the Command Palette. Ie, products.
  6. An event should be triggered with the search term (in the browser console you will see wc-admin:tracks recordevent wcadmin_woocommerce_command_palette_search { value: "products", origin: "post-editor" }).

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Comment

Add tracking when opening or searching in the Command Palette

@Aljullu Aljullu added team: Kirigami & Origami focus: FSE Issues related to Full Site Editing labels Dec 1, 2023
@Aljullu Aljullu self-assigned this Dec 1, 2023
@Aljullu Aljullu requested review from a team and dinhtungdu and removed request for a team December 1, 2023 11:02
Copy link
Contributor

github-actions bot commented Dec 1, 2023

Hi @dinhtungdu,

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

1 similar comment
Copy link
Contributor

github-actions bot commented Dec 1, 2023

Hi @dinhtungdu,

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

@Aljullu Aljullu force-pushed the update/41837-command-palette-tracking branch from e032348 to b878d43 Compare December 1, 2023 11:07
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Dec 1, 2023
Copy link
Contributor

github-actions bot commented Dec 1, 2023

Test Results Summary

Commit SHA: 88e468a

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 37s
E2E Tests258003026114m 52s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

Copy link
Member

@dinhtungdu dinhtungdu left a comment

Choose a reason for hiding this comment

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

Code looks and tests good in my test so I'm pre-approving! Thank you for working on this.

I have a question on the palette open event. Do we record where (which screen/page) the palette is opened? From the debug value I didn't see any data related to the current screen. I also see a property named shouldRecord set to false, which is a bit confusion and makes me wonder if the event was recorded or not.

image

@Aljullu
Copy link
Contributor Author

Aljullu commented Dec 7, 2023

Thanks for the review, @dinhtungdu!

I have a question on the palette open event. Do we record where (which screen/page) the palette is opened?

Good idea! I added an origin property to all events which contains the origin editor, which can be: post-editor, page-editor, wp_template-editor or wp_template_part-editor. I wasn't sure if we should unify those last two into site-editor, but I felt it made more sense to always include the post type being edited. This way, if in the future the Command Palette is displayed in the Product editor, we can have product-editor as an origin.

Btw, I added this property to all events, not only the open one. That means also when submitting one command or when searching. I think it might be useful in those cases as well, but cc'ing @pmcpinto in case he has other thoughts.

I also see a property named shouldRecord set to false, which is a bit confusion and makes me wonder if the event was recorded or not.

I think that's expected if you are in development mode or don't have tracking enabled:

shouldRecord:
! isDevelopmentMode &&
!! window._tkq &&
!! window.wcTracks &&
!! window.wcTracks.isEnabled,

@Aljullu Aljullu force-pushed the update/41837-command-palette-tracking branch from b878d43 to 4ed1d57 Compare December 7, 2023 16:52
@Aljullu Aljullu force-pushed the update/41837-command-palette-tracking branch from 4ed1d57 to a0c8922 Compare December 12, 2023 08:23
Copy link
Member

@dinhtungdu dinhtungdu left a comment

Choose a reason for hiding this comment

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

The update looks good to me! Tested and I can confirm it's working, the origin data is tracked correctly.

@Aljullu Aljullu force-pushed the update/41837-command-palette-tracking branch from a0c8922 to e445d26 Compare December 18, 2023 11:05
@Aljullu Aljullu force-pushed the update/41837-command-palette-tracking branch from e445d26 to 88e468a Compare December 18, 2023 12:14
@Aljullu Aljullu merged commit 140d1db into trunk Dec 18, 2023
17 checks passed
@Aljullu Aljullu deleted the update/41837-command-palette-tracking branch December 18, 2023 13:36
@github-actions github-actions bot added this to the 8.5.0 milestone Dec 18, 2023
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Dec 18, 2023
@nigeljamesstevenson nigeljamesstevenson added needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. status: analysis complete Indicates if a PR has been analysed by Solaris and removed needs: analysis Indicates if the PR requires a PR testing scrub session. labels Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: FSE Issues related to Full Site Editing needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. plugin: woocommerce Issues related to the WooCommerce Core plugin. status: analysis complete Indicates if a PR has been analysed by Solaris team: Kirigami & Origami
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add tracking to Command Palette opening and search
3 participants