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

Display First-Party Mode Status in Site Health #9667

Closed
1 task done
hussain-t opened this issue Nov 12, 2024 · 4 comments
Closed
1 task done

Display First-Party Mode Status in Site Health #9667

hussain-t opened this issue Nov 12, 2024 · 4 comments
Labels
P0 High priority Team M Issues for Squad 2 Type: Enhancement Improvement of an existing feature

Comments

@hussain-t
Copy link
Collaborator

hussain-t commented Nov 12, 2024

Feature Description

Enhance Site Health to show the status of First-party mode, indicating whether it is enabled or disabled.

For details, refer to the Design Doc.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • The following entry should be added to Site Kit's Site Health section when the firstPartyMode feature flag is enabled:
    • Title: First-Party Mode: Enabled
    • Value:
      • Yes if First-party mode is enabled.
      • No if it's not enabled.
  • If Display FPFE Health Check and Script Access Status in Site Health #9668 has already been implemented it should be ensured that this entry appears above the entries specified in that issue.

Implementation Brief

  • Update includes/Core/Tags/First_Party_Mode/First_Party_Mode.php:
    • Inherit the Module_With_Debug_Fields trait.
    • Add a new method get_debug_fields:
      • Get the module settings with $settings = $this->get_settings()->get();, return the value of isEnabled in the following format:
           'first_party_mode_is_enabled' => array(
           	'label' => __( 'First-Party Mode: Enabled', 'google-site-kit' ),
           	'value' => $settings['isEnabled'] ? __( 'Yes', 'google-site-kit' ) : __( 'No', 'google-site-kit' ),
           	'debug' => $settings['isEnabled'] ? 'yes' : 'no',
           ),
        
        Note: the module activation is behind a feature flag, and these debug fields will only show when the module is active so I have not added any additional feature flag check.

Test Coverage

  • No additional test coverage required.

QA Brief

  • Enable either the Ads or Analytics module and the firstPartyMode feature flag.
  • Visit site health and you will see the new field.
  • If the toggle switch has not been merged you should be able to test by manually editing/adding the settings into googlesitekit_first_party_mode meta key in the wp_options table.

Update:

  • We don't have to update the settings in the wp_options table. Instead we can simply execute the following steps.
  • Set the First-Party Mode status and save the settings by running the following commands in the browser console:
// Set `isEnabled` locally:
googlesitekit.data.dispatch( "core/site" ).setFirstPartyModeEnabled( true );

// Persist the settings on the server.
await googlesitekit.data.dispatch( "core/site" ).saveFirstPartyModeSettings();

Changelog entry

  • Add First-Party Mode status to Site Kit’s Site Health section, displaying whether the feature is enabled or not when either the Analytics or Ads modules are connected and the firstPartyMode feature flag is active.
@hussain-t hussain-t added P0 High priority Type: Enhancement Improvement of an existing feature Team M Issues for Squad 2 labels Nov 12, 2024
@ivonac4 ivonac4 added the Next Up Issues to prioritize for definition label Nov 20, 2024
@techanvil techanvil changed the title Display First-Party Mode Status in Site Health for Ads Module Display First-Party Mode Status in Site Health Nov 25, 2024
@techanvil techanvil assigned techanvil and unassigned techanvil Nov 25, 2024
@nfmohit nfmohit self-assigned this Nov 26, 2024
@nfmohit
Copy link
Collaborator

nfmohit commented Nov 26, 2024

AC ✅

@nfmohit nfmohit removed their assignment Nov 26, 2024
@benbowler benbowler assigned benbowler and unassigned benbowler Nov 27, 2024
@techanvil techanvil self-assigned this Nov 28, 2024
@techanvil
Copy link
Collaborator

  *Note: I adjusted the titles slightly from the AC to keep them consistent with #9680*

Thanks @benbowler, good shout. I've amended the AC accordingly and removed this note from the IB.

IB ✅

@techanvil techanvil removed their assignment Nov 28, 2024
@benbowler benbowler self-assigned this Nov 29, 2024
@ivonac4 ivonac4 removed the Next Up Issues to prioritize for definition label Nov 29, 2024
@benbowler benbowler removed their assignment Dec 2, 2024
@hussain-t hussain-t self-assigned this Dec 2, 2024
@hussain-t
Copy link
Collaborator Author

Hi @benbowler, FYI, we don't have to alter the wp_options table to update the FPM settings. We can run the following actions to set and persist the status. I've updated the QAB to avoid a round of iteration.

// Set `isEnabled` locally:
googlesitekit.data.dispatch( "core/site" ).setFirstPartyModeEnabled( true );

// Persist the settings on the server.
await googlesitekit.data.dispatch( "core/site" ).saveFirstPartyModeSettings();

@hussain-t hussain-t removed their assignment Dec 2, 2024
@wpdarren wpdarren self-assigned this Dec 2, 2024
@wpdarren
Copy link
Collaborator

wpdarren commented Dec 2, 2024

QA Update: ✅

Verified:

  • The following entries are added to Site Kit's Site Health section when the firstPartyMode feature flag is enabled:
    • Title: First-Party Mode: Enabled
    • Value:
      • Yes when First-party mode is enabled.
      • No when not enabled.
Screenshots

Image

Image

QA Note: You have to run the code in the QAB on the Site Kit settings screen for this to function correctly.

@wpdarren wpdarren removed their assignment Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P0 High priority Team M Issues for Squad 2 Type: Enhancement Improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

7 participants