Skip to content

Fix issues from disconnecting accounts via Site Kit dashboard#22232

Merged
thijsoo merged 5 commits intotrunkfrom
526-issues-when-you-disconnect-from-site-kit-new
May 8, 2025
Merged

Fix issues from disconnecting accounts via Site Kit dashboard#22232
thijsoo merged 5 commits intotrunkfrom
526-issues-when-you-disconnect-from-site-kit-new

Conversation

@leonidasmi
Copy link
Copy Markdown
Contributor

@leonidasmi leonidasmi commented May 5, 2025

Context

Summary

This PR can be summarized in the following changelog entry:

  • Improves the UX of the Site Kit integration for cases where there's no access to Google services.

Relevant technical choices:

  • We changed the concept of what Is Site Kit set up means.
    • It used to mean whether Site Kit was set up once in the site from any user, even if that user was now disconnected.
    • It now means whether the current user has access to either the SC module or the Analytics module.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

The first bug:

  • Go through the onboarding process in a fresh site
  • Go to Site Kit and disconnect the user (disconnect from the upper right corner. if you reset Site Kit, using the relevant button, the bug is not there):
    Image
  • Go to Yoast dashboard (preferrably in a new tab, to avoid cache)
    With the fix:
  • the onboarding widget appears again, in the 3rd step (prompting users to set up Site Kit)
    Without the fix:
  • No onboarding widget
  • The 5 widgets showing, with errors (since we don't have our users connected to Site Kit)

The second bug:

  • 1st admin sets up Site Kit and gives viewing rights to admins
  • 2nd admin goes to Yoast Dashboard and sees widgets with data
  • 1st admin disconnects from Site Kit (disconnect from the upper right corner. if you reset Site Kit, using the relevant button, the bug is not there):
    Image
    With this fix:
  • 2nd admin goes to Yoast Dashboard and sees the onboarding widget
  • Without the fix:
  • 2nd admin goes to Yoast Dashboard and sees widgets with error

A minor improvement when consent hasn't been given:

  • admin1 sets up Site Kit but doesn't connect Site Kit to Yoast
  • admin2 goes to Yoast dashboard
    With this fix:
  • sees the 3rd step of the onboarding widget (set up site kit) and is able to complete it
    Without the fix:
  • sees the 4th step of the onboarding widget with a disabled button (which doesn't make sense because he's an admin and should have been able to connect Site Kit to Yoast)

Test also #22157 with a twist:

  • Set up Site Kit (without setting up Analytics) with user A
  • Don't give viewing rights to any role
  • Go to Yoast dashboard with user B and confirm that you don't see the Site Kit widgets, but you do see the onboarding widget
    • Use the onboarding widget to connect user B's google account to Site Kit (Search Console only, not Analytics)
    • Re-visit Yoast dashboard and confirm that you now see the 4 widgets properly
    • Disconnect user B's google account from Site Kit.
  • With user A, give viewing rights to Search Console to admins
  • User B now can see the Search Console widgets in Yoast dashboard
  • Revert viewing rights to none, to continue our tests
  • With user B, go and set up Site Kit with a different account
  • Go to Yoast dashboard with user B and confirm that you see the Site Kit widgets that are for Search Console
  • With user A, go and set up Analytics but don't give viewing rights to it, to any role
  • Go to Yoast dashboard with user A and confirm that you see the Organic Sessions widget too
  • Go to Yoast dashboard with user B and confirm that you see see the Organic Sessions widget too but you get a You don't have permission error
  • If user A gives viewing rights to admin for Analytics and user refreshes the Yoast dashboard, they will see the Organic Sessions widget with no errors. Revert the viewing rights of Analytics to no role.
  • With user B, go and set up Analytics (first you will need to go to the Analytics account of user A and give access to your account as per this: https://support.google.com/analytics/answer/9305788?hl=en#Add&zippy=%2Cin-this-article)
    • After you gave access to your account as per the article, go to Site Kit->Settings, edit the Analytics settings and save your account
  • Go to Yoast dashboard with user B and confirm that you see the Organic Sessions widget with no errors
  • Now repeat the test in a fresh site, but this time set up Site Kit with user A and set up Analytics at the beginning (before doing anything with user B). User B should not see any widgets (aside from the onboarding widget) until either user A gives viewing rights or user B sets up Site Kit with their own Google account:
    • First have user A give viewing rights for Search Console to admins
    • Go to Yoast dashboard with user B and confirm you see all widgets with no errors except Organic Sessions which you can't see at all
    • Then have user A give viewing rights for Analytics to admins
    • Go to Yoast dashboard with user B and confirm you see all widgets including Organic Sessions
    • Revoke viewing rights for Search Console
    • Go to Yoast dashboard with user B and confirm you see only the Organic Sessions widget with no errors there
    • Now revoke viewing rights for Analytics too
    • GO to Yoast dashboard with user B and confirm you see no Site Kit related widgets, but you do see the onboarding widget
    • Have user B set up Site Kit with their own Google account and then confirm that in the Yoast dashboard they see all Site Kit widgets.

Test also #22091 with a twist:

  • Have the Site Kit Feature flag enabled.
  • Log in as an SEO manager, go to Yoast SEO-> Integrations and later Yoast SEO->general and check you see the warnings:

Please contact your WordPress admin to install, activate, and set up the Site Kit by Google plugin.

  • Check the install button is disabled, try to click it and check it has disabled styling.
  • Log in as an admin and install the site kit plugin, log in again as seo manager and check you see the same message in the integration card and the set up widget. Check the buttons are disabled.
  • Log in as an admin and activate the site kit plugin, log in again as seo manager and check you see the same message in the integration card and the set up widget. Check the buttons are disabled.
  • Log in as admin and set up the site kit and analytics and log in again as seo manager and check you see the same message.
  • Check the button is disabled in both integration card and widget.
  • Log in as an admin and connect site kit to yoast, log in again as seo manager and check you see the same message in the integration card and the onboarding widget.
  • Log in as an admin and add the SEO manager role to the search console sharing.
  • Log in as the seo manager again and check you can see the site kit widgets and you can disconnect and connect to yoast site kit from the integrations page.
  • Check you don't see the Organic sessions widget.
  • Log in as admin and add the seo manager in the sharing settings for analytics.
  • Log in again as SEO manager and check you now see the organic sessions widget.
  • Log in as admin and revoke all viewing rights and only give viewing rights to PageSpeed Insights.
  • Log in as SEO manager and check that you don't see any Site Kit widgets in the Yoast dashboard.

Regression testing:

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:

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 https://github.com/Yoast/reserved-tasks/issues/526

@leonidasmi leonidasmi added this to the 25.1 milestone May 5, 2025
@leonidasmi leonidasmi added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label May 5, 2025
@coveralls
Copy link
Copy Markdown

coveralls commented May 5, 2025

Pull Request Test Coverage Report for Build 456796fbb7c10a2edc272dd10d604ec6a16d58dd

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 2 of 8 (25.0%) changed or added relevant lines in 1 file are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.004%) to 52.515%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/dashboard/infrastructure/integrations/site-kit.php 2 8 25.0%
Files with Coverage Reduction New Missed Lines %
src/dashboard/infrastructure/integrations/site-kit.php 3 50.0%
Totals Coverage Status
Change from base Build 2dd102b0847b1753a23b3f10843ab8f6b83e2b77: 0.004%
Covered Lines: 29135
Relevant Lines: 56553

💛 - Coveralls

@leonidasmi leonidasmi removed this from the 25.1 milestone May 6, 2025
@leonidasmi leonidasmi changed the base branch from release/25.1 to trunk May 6, 2025 11:38
@leonidasmi leonidasmi added changelog: enhancement Needs to be included in the 'Enhancements' category in the changelog and removed changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog labels May 7, 2025
@leonidasmi leonidasmi marked this pull request as ready for review May 7, 2025 06:48
@thijsoo thijsoo added this to the 25.2 milestone May 8, 2025
Copy link
Copy Markdown
Contributor

@thijsoo thijsoo left a comment

Choose a reason for hiding this comment

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

CR + ACC 👍

@thijsoo thijsoo merged commit 365e301 into trunk May 8, 2025
36 checks passed
@thijsoo thijsoo deleted the 526-issues-when-you-disconnect-from-site-kit-new branch May 8, 2025 12:48
@enricobattocchi enricobattocchi added changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog and removed changelog: enhancement Needs to be included in the 'Enhancements' category in the changelog labels May 13, 2025
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