The Client ID used for Sign in With Google should be surfaced in the Site Health UI, as well as any other settings (eg. sign in button styles, new user account creation, etc.).
The number of users who have used SiWG should be shown as at least an absolute number (and possibly a percentage), based on the usermeta values saved for each user who successfully signs in using SiwG.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
When the signInWithGoogleModule is enabled and the Sign in with Google module is connected, the following fields should be shown in Site Kit's Site Health:
Sign in with Google Client ID
Sign in with Google Shape
Sign in with Google Text
Sign in with Google Theme
Sign in with Google One-tap Enabled
The absolute number of users who have authenticated using Sign in with Google
A "Tag placement" check, similar to other modules like Analytics, for the Sign in with Google JS tag. The check should be made against the WordPress login page and (if the module is present) the WooCommerce login page.
Implementation Brief
[ ] Update includes/Modules/Sign_In_With_Google/Settings.php to include both the label and settings value for each supported field to match the js definitions of theses constants:
Instantiate a new instance of use Google\Site_Kit\Modules\Sign_In_With_Google\Settings and get the module settings.
Return each module setting as a new debug field with the titles in the AC:
For the style settings use the label value updated above in includes/Modules/Sign_In_With_Google/Settings.php.
For the clientID, return the clientID as stored.
For the One-tap Enabled setting return the string Enabled or Disabled based on the boolean value in the database.
Get a count of the key SIGN_IN_WITH_GOOGLE_USER_ID_OPTION in the usermeta table with the following query:
$wpdb->query(
$wpdb->prepare( "SELECT count(id) FROM $wpdb->usermeta WHERE meta_key = %s", Sign_In_With_Google_Settings::SIGN_IN_WITH_GOOGLE_USER_ID_OPTION )
);
Update the existing get_fields method, calling the new get_sign_in_with_google_fields method and merge it with the $fields array:
Wrap the call in the Feature_Flags::enabled( 'signInWithGoogleModule' ) call to only return the fields when the feature flag is enabled.
Create a new instance of the Sign_In_With_Google module and wrap the call in a check for $sign_in_with_google->is_connected() to only render the fields when the module is connected.
If the tag is found add Sign in button added to the WordPress login page. to the $description, otherwise add Sign in button missing on the WordPress login page.
Check if WooCommerce is active using the is_active method on the WooCommerce class, if it's active do the following:
Get the content of the current WooCommerce login page using this technique, replacing home_url with wc_get_page_id( 'myaccount' ):
If the tag is found add Sign in button added to WooCommerce login page. to the $description, otherwise add Sign in button missing on the WooCommerce login page.
Join the $description array into a string by commas and update and return $result.
[ ] Update includes/Core/Site_Health/Site_Health.php, import the new class Sign_In_Button_Placement to a new const.
Within the register method, call $this->sign_in_with_google->register() if Feature_Flags::enabled( 'signInWithGoogleModule' ) is true and the module is connected using the module is_connected method.
Test Coverage
Update tests/phpunit/integration/Core/Site_Health/Debug_DataTest.php to confirm the fields are added as expected.
Create new tests for the new Sign_In_Button_Placement check.
Note for @tofumatt / the IB reviewer, should we also consider adding a SiwG tag/code placement check similar or as part of the "Tag Placement" checks we have for other modules.
Feature Description
The Client ID used for Sign in With Google should be surfaced in the Site Health UI, as well as any other settings (eg. sign in button styles, new user account creation, etc.).
The number of users who have used SiWG should be shown as at least an absolute number (and possibly a percentage), based on the usermeta values saved for each user who successfully signs in using SiwG.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
signInWithGoogleModule
is enabled and the Sign in with Google module is connected, the following fields should be shown in Site Kit's Site Health:Implementation Brief
[ ] Update
includes/Modules/Sign_In_With_Google/Settings.php
to include both the label and settings value for each supported field to match the js definitions of theses constants:[ ] Update
includes/Core/Site_Health/Debug_Data.php
get_sign_in_with_google_fields
:use Google\Site_Kit\Modules\Sign_In_With_Google\Settings
and get the module settings.label
value updated above inincludes/Modules/Sign_In_With_Google/Settings.php
.Enabled
orDisabled
based on the boolean value in the database.SIGN_IN_WITH_GOOGLE_USER_ID_OPTION
in the usermeta table with the following query:get_fields
method, calling the newget_sign_in_with_google_fields
method and merge it with the$fields
array:Feature_Flags::enabled( 'signInWithGoogleModule' )
call to only return the fields when the feature flag is enabled.Sign_In_With_Google
module and wrap the call in a check for$sign_in_with_google->is_connected()
to only render the fields when the module is connected.[ ] Create a new file
includes/Core/Site_Health/Sign_In_Button_Placement.php
, this will take a similar approach to some elements of the Tag_Placement class, but the render method and future requirements warrant a new class:register
method which registers the new test as a direct check:sign_in_button_test
:Sign In Button Placement
and the test prop tosign_in_button_test
:$description
array.home_url
withwp_login_url
:Sign in button added to the WordPress login page.
to the$description
, otherwise addSign in button missing on the WordPress login page.
is_active
method on theWooCommerce
class, if it's active do the following:home_url
withwc_get_page_id( 'myaccount' )
:Sign in button added to WooCommerce login page.
to the$description
, otherwise addSign in button missing on the WooCommerce login page.
$description
array into a string by commas and update and return$result
.[ ] Update
includes/Core/Site_Health/Site_Health.php
, import the new classSign_In_Button_Placement
to a new const.register
method, call$this->sign_in_with_google->register()
ifFeature_Flags::enabled( 'signInWithGoogleModule' )
is true and the module is connected using the moduleis_connected
method.Test Coverage
tests/phpunit/integration/Core/Site_Health/Debug_DataTest.php
to confirm the fields are added as expected.Sign_In_Button_Placement
check.QA Brief
Changelog entry