Skip to content

Add tracking of user progress in the Site Kit setup widget#22125

Merged
vraja-pro merged 84 commits intotrunkfrom
add-tracking
Apr 9, 2025
Merged

Add tracking of user progress in the Site Kit setup widget#22125
vraja-pro merged 84 commits intotrunkfrom
add-tracking

Conversation

@pls78
Copy link
Copy Markdown
Member

@pls78 pls78 commented Mar 21, 2025

Context

  • We want to track a number of metrics about the usage of the Site Kit setup widget.

Summary

This PR can be summarized in the following changelog entry:

  • Adds tracking for a number of metrics about the usage of the Site Kit setup widget.

Relevant technical choices:

  • I decided to use the string type for all the tracked data in order to simplify the fetching and the setting of each of the tracked data. Feel free to disagree with this! 😁
  • Please note that it has been lately decided to split the setp_widget_dismissed option into two different options, setup_widget_temporary_dismissed and setup_widget_permanently_dismissed

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Have the Site Kit Feature flag enabled

  • By using Postman or any other similar client, perform the following POST request:

    http://YOUR-BLOG-URL/wp-json/yoast/v1/setup_steps_tracking
    
  • Verify you get the following response:

    {"code":"wpseo_set_site_kit_usage_tracking","message":"No valid parameters were provided.","data":{}}
    
  • Start with no Google Site Kit plugin installed

  • Visit Yoast SEO -> General

  • Use a MySQL client (e.g. Adminer or the WP Data Access plugin) and inspect the wpseo option in the wp_options table

    • Verify you have the following array in it:
    {s:19:"setup_widget_loaded";s:3:"yes";s:23:"first_interaction_stage";s:7:"install";s:22:"last_interaction_stage";s:7:"install";s:34:"setup_widget_temporarily_dismissed";s:2:"no";s:34:"setup_widget_permanently_dismissed";s:2:"no";}}
    
  • Temporarily dismiss the setup widget and check now setup_widget_temporarily_dismissed is set to s:3:"yes"

  • Permanently dismiss the setup widget and check now setup_widget_permanently_dismissed is set to s:3:"yes"

  • Reset the options by using the Yoast test helper

  • Install the Site Kit plugin but don't activate it

  • Visit Yoast SEO -> General

    • Check that now in your database you have:
    {s:19:"setup_widget_loaded";s:3:"yes";s:23:"first_interaction_stage";s:8:"activate";s:22:"last_interaction_stage";s:8:"activate";s:34:"setup_widget_temporarily_dismissed";s:2:"no";s:34:"setup_widget_permanently_dismissed";s:2:"no";}}
    
  • Click on Activate Site Kit by Google

  • Go back to Yoast SEO -> General

    • Verify that now you have:
    {s:19:"setup_widget_loaded";s:3:"yes";s:23:"first_interaction_stage";s:8:"activate";s:22:"last_interaction_stage";s:5:"setup";s:34:"setup_widget_temporarily_dismissed";s:2:"no";s:34:"setup_widget_permanently_dismissed";s:2:"no";}}
    
  • Click on Setup Site Kit by Google and perform the setup

  • Go back to Yoast SEO -> General

    • Verify that now you have:
    {s:19:"setup_widget_loaded";s:3:"yes";s:23:"first_interaction_stage";s:8:"activate";s:22:"last_interaction_stage";s:12:"grantConsent";s:34:"setup_widget_temporarily_dismissed";s:2:"no";s:34:"setup_widget_permanently_dismissed";s:2:"no";}}
    
  • Reset the options by using the Yoast test helper

  • Keep the Site Kit plugin both installed and activated and visit Yoast SEO -> General

    • Check that now in your database you have:
    {s:19:"setup_widget_loaded";s:3:"yes";s:23:"first_interaction_stage";s:5:"setup";s:22:"last_interaction_stage";s:5:"setup";s:34:"setup_widget_temporarily_dismissed";s:2:"no";s:34:"setup_widget_permanently_dismissed";s:2:"no";}}
    

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

  • N/A

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes #466

@pls78 pls78 added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label Mar 21, 2025
Comment thread src/dashboard/application/configuration/dashboard-configuration.php
Comment thread packages/js/tests/dashboard/widgets/site-kit-setup-widget.test.js
@pls78
Copy link
Copy Markdown
Member Author

pls78 commented Apr 7, 2025

I think we need to reconsider the architecture of the DataTracker. It is very coupled with site kit. Something like the remote data provider, maybe have the tracking element include the endpoint, or other mechanism to allow tracking with other endpoints.

I already spoke to @igorschoester about the DataTracker: we cannot generalize it because the encapsulated data is dependent on the tracked widget, and at the same time we cannot use a single DataTracker class for tracking everything, So the idea is to use a DataTracker class for each widget.

Comment thread packages/js/src/dashboard/widgets/site-kit-setup-widget.js Outdated
Comment thread packages/js/src/dashboard/services/data-tracker.js
Comment thread packages/js/src/dashboard/services/data-tracker.js Outdated
Comment thread packages/js/src/dashboard/widgets/site-kit-setup-widget.js Outdated
@vraja-pro
Copy link
Copy Markdown
Contributor

CR & AC ✅

@vraja-pro vraja-pro added this to the 25.0 milestone Apr 9, 2025
@vraja-pro vraja-pro merged commit ed0dc63 into trunk Apr 9, 2025
39 checks passed
@vraja-pro vraja-pro deleted the add-tracking branch April 9, 2025 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants