Admin bar plugin settings inconsistent with others
Bug Description
In #990 we added a new control in the plugin settings for disabling the admin bar via a new setting.
This inconsistent with the existing opt-in setting for anonymous usage tracking which has been in Site Kit since the beginning.
- The fields are not aligned

- The admin bar settings are not preloaded, resulting in an additional fetch request on page load
Steps to reproduce
- Go to Site Kit settings
- Refresh the page while observing network requests
- See request to
core/site/data/admin-bar-settings - Also notice settings fields are not aligned
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- Admin bar settings should be preloaded to not invoke an immediate fetch request on page load
- Plugin settings and tracking settings should visually align - specifically, the tracking setting style should be adjusted to align with the admin bar setting in left spacing.
Implementation Brief
-
Inside
assets/sass/components/global/_googlesitekit-opt-in.scss:- Remove the rule on line 44 which adds the negative
margin-leftof 11px to the.mdc-checkbox
- Remove the rule on line 44 which adds the negative
-
Inside
includes/Core/Admin_Bar/Admin_Bar.php:- Inside the
registermethod, add a filter for'googlesitekit_apifetch_preload_paths'for the'/core/site/data/admin-bar-settings'REST path. See below for an example.
- Inside the
https://github.com/google/site-kit-wp/blob/ba9b9ed777c74f040e35351e4f69f37fe05a3ca8/includes/Core/Util/Tracking.php#L85-L95
Test Coverage
- No new tests required; existing ones should pass.
Visual Regression Changes
- VRT images dealing with the AdminBar checkbox may need updating.
QA Brief
- In Settings page, Checkboxes should be aligned.
core/site/data/admin-bar-settingsshould be preloaded.- VRTs should pass.
Changelog entry
- Update admin settings for consistency and introduce optional loading state for checkboxes.
@felixarntz this is the issue I mentioned earlier today. Regarding the alignment, I think we should update the tracking input to be like the setting for the admin bar because the opt-in class has some special styles on it so that the checkbox border is left-aligned. This may be fine to keep in other places but in the general settings layout, it should probably be placed using default styles.
Does that sound good to you?
@aaemnnosttv Sounds good to me - I've clarified this in the ACs.
IB :heavy_check_mark:
Following the IB and removing the negative margin from mdc-checkbox breaks design and VRT for Authenticate with Google Using GCP. Is this something we want to tackle in this Issue/IB Level?

CC @johnPhillips @eugene-manuilov @aaemnnosttv
@kuasha420 these are expected changes, so we need to approve them and add them to your PR. Run npm run test:visualtest and npm run test:visualapprove commands.
QA Update: ✅
Verified:
- In Settings page, the checkboxes are aligned.
- Tested on all screen sizes including mobile and the checkboxes remain aligned.
- Tested on supported browsers via Browserstack
- Checked that
core/site/data/admin-bar-settingsis preloaded.


I have added the QA:Eng label for an engineer to check the VRT!
QA:Eng ✅
Verified the following locally:
- core/site/data/admin-bar-settings should be preloaded. ✅
- VRTs should pass. ✅