Plugin Directory

Changeset 3201134


Ignore:
Timestamp:
12/02/2024 06:41:44 PM (13 months ago)
Author:
google
Message:

Update to version 1.141.0 from GitHub

Location:
google-site-kit
Files:
112 added
88 deleted
34 edited
1 copied

Legend:

Unmodified
Added
Removed
  • google-site-kit/tags/1.141.0/dist/manifest.php

    r3191565 r3201134  
    1919    'analytics-advanced-tracking'                          => array( "analytics-advanced-tracking-ea84b2c367b69f5c094b.js", null ),
    2020    'googlesitekit-i18n'                                   => array( "googlesitekit-i18n-33cdd2dee5d1d1f4fb34.js", null ),
    21     'googlesitekit-admin-css'                              => array( "googlesitekit-admin-css-436096755512e44a2180.min.css", null ),
     21    'googlesitekit-admin-css'                              => array( "googlesitekit-admin-css-c7c4e28ef467fa74720d.min.css", null ),
    2222    'googlesitekit-adminbar-css'                           => array( "googlesitekit-adminbar-css-6db776544b37175be17f.min.css", null ),
    2323    'googlesitekit-authorize-application-css'              => array( "googlesitekit-authorize-application-css-ce25e97404abc5a02921.min.css", null ),
    2424    'googlesitekit-wp-dashboard-css'                       => array( "googlesitekit-wp-dashboard-css-c5417a27cb905717f9fc.min.css", null ),
    25     'googlesitekit-vendor'                                 => array( "googlesitekit-vendor-a19e0d3a9785a4679814.js", null ),
    26     'googlesitekit-runtime'                                => array( "runtime-ac7cb3123d0c92a4c83a.js", null ),
    27     'googlesitekit-activation'                             => array( "googlesitekit-activation-86e820f351b221f65654.js", null ),
    28     'googlesitekit-ad-blocking-recovery'                   => array( "googlesitekit-ad-blocking-recovery-35406f6b97f89119cba2.js", null ),
    29     'googlesitekit-adminbar'                               => array( "googlesitekit-adminbar-2aa4217dc92c2c92519c.js", null ),
    30     'googlesitekit-api'                                    => array( "googlesitekit-api-63e0255bae8c37401ba1.js", null ),
    31     'googlesitekit-components'                             => array( array( "googlesitekit-components-gm2-888e11c2f889b3818fac.js", null ), array( "googlesitekit-components-gm3-6f888313ed0d8623cf0e.js", null ) ),
    32     'googlesitekit-data'                                   => array( "googlesitekit-data-9b04ce04845587d08ef9.js", null ),
    33     'googlesitekit-datastore-forms'                        => array( "googlesitekit-datastore-forms-f38e139a09c823fd80b9.js", null ),
    34     'googlesitekit-datastore-location'                     => array( "googlesitekit-datastore-location-1e7b4e4c0f10376ae735.js", null ),
    35     'googlesitekit-datastore-site'                         => array( "googlesitekit-datastore-site-b48fcdc028f30543c49a.js", null ),
    36     'googlesitekit-datastore-ui'                           => array( "googlesitekit-datastore-ui-fbeb338baf423fe10a9a.js", null ),
    37     'googlesitekit-datastore-user'                         => array( "googlesitekit-datastore-user-8525155abe6c24a6b6e4.js", null ),
    38     'googlesitekit-entity-dashboard'                       => array( "googlesitekit-entity-dashboard-c2c8cb7c5a812c7ef92b.js", null ),
    39     'googlesitekit-main-dashboard'                         => array( "googlesitekit-main-dashboard-4a22bdd52eac618bdba0.js", null ),
    40     'googlesitekit-modules'                                => array( "googlesitekit-modules-f137613a7b6e587d2f09.js", null ),
    41     'googlesitekit-modules-ads'                            => array( "googlesitekit-modules-ads-8294c3788d693c1aa4d1.js", null ),
    42     'googlesitekit-modules-adsense'                        => array( "googlesitekit-modules-adsense-86be7f15c8ab18f2c8c2.js", null ),
    43     'googlesitekit-modules-analytics-4'                    => array( "googlesitekit-modules-analytics-4-fb3e6466670e9fe98540.js", null ),
    44     'googlesitekit-modules-pagespeed-insights'             => array( "googlesitekit-modules-pagespeed-insights-c88ecf4fb9fabd4b00ce.js", null ),
    45     'googlesitekit-modules-reader-revenue-manager'         => array( "googlesitekit-modules-reader-revenue-manager-0aca4740f1f170a04318.js", null ),
    46     'googlesitekit-modules-search-console'                 => array( "googlesitekit-modules-search-console-338c440d2a515b691bf2.js", null ),
    47     'googlesitekit-modules-sign-in-with-google'            => array( "googlesitekit-modules-sign-in-with-google-56b980cf11ec18bc46e7.js", null ),
    48     'googlesitekit-modules-tagmanager'                     => array( "googlesitekit-modules-tagmanager-a9c1650ad917dc777a4f.js", null ),
    49     'googlesitekit-notifications'                          => array( "googlesitekit-notifications-e491c3e66473a45eb37c.js", null ),
    50     'googlesitekit-polyfills'                              => array( "googlesitekit-polyfills-b3b20bb6f4276a648085.js", null ),
    51     'googlesitekit-settings'                               => array( "googlesitekit-settings-516d574e9df74fe6b81f.js", null ),
    52     'googlesitekit-splash'                                 => array( "googlesitekit-splash-30e76c65a9e86b793d44.js", null ),
    53     'googlesitekit-user-input'                             => array( "googlesitekit-user-input-ebc5e165960a36731c7f.js", null ),
    54     'googlesitekit-widgets'                                => array( "googlesitekit-widgets-c2422864a9b59a9a6def.js", null ),
    55     'googlesitekit-wp-dashboard'                           => array( "googlesitekit-wp-dashboard-a24f18cd5f1c8dae446d.js", null ),
     25    'googlesitekit-vendor'                                 => array( "googlesitekit-vendor-56e09129c0c5da07a38b.js", null ),
     26    'googlesitekit-runtime'                                => array( "runtime-28f15eb6ca67d1a2d920.js", null ),
     27    'googlesitekit-activation'                             => array( "googlesitekit-activation-f250ffdb179ce67acd13.js", null ),
     28    'googlesitekit-ad-blocking-recovery'                   => array( "googlesitekit-ad-blocking-recovery-f6e2202aedc4b9dec80a.js", null ),
     29    'googlesitekit-adminbar'                               => array( "googlesitekit-adminbar-309ccca4cdd85f61e57c.js", null ),
     30    'googlesitekit-api'                                    => array( "googlesitekit-api-51477bf3a499de73c6b0.js", null ),
     31    'googlesitekit-components'                             => array( array( "googlesitekit-components-gm2-d1deb8243b7fe27ddfd3.js", null ), array( "googlesitekit-components-gm3-26d6f652a561407fc1d9.js", null ) ),
     32    'googlesitekit-data'                                   => array( "googlesitekit-data-e2d57f0d3e8cbcde4f77.js", null ),
     33    'googlesitekit-datastore-forms'                        => array( "googlesitekit-datastore-forms-d673eb18908574ac23e4.js", null ),
     34    'googlesitekit-datastore-location'                     => array( "googlesitekit-datastore-location-b2b133386452785f40cd.js", null ),
     35    'googlesitekit-datastore-site'                         => array( "googlesitekit-datastore-site-d81c0033927d3f14fb1a.js", null ),
     36    'googlesitekit-datastore-ui'                           => array( "googlesitekit-datastore-ui-bca078eceaaa8c87948d.js", null ),
     37    'googlesitekit-datastore-user'                         => array( "googlesitekit-datastore-user-c9aee053073946d82bc6.js", null ),
     38    'googlesitekit-entity-dashboard'                       => array( "googlesitekit-entity-dashboard-909580c1ad26533618a7.js", null ),
     39    'googlesitekit-main-dashboard'                         => array( "googlesitekit-main-dashboard-00725d6f8918d582c7be.js", null ),
     40    'googlesitekit-modules'                                => array( "googlesitekit-modules-eeec4132d38e98b7da80.js", null ),
     41    'googlesitekit-modules-ads'                            => array( "googlesitekit-modules-ads-8fc1dc559868da9f2c36.js", null ),
     42    'googlesitekit-modules-adsense'                        => array( "googlesitekit-modules-adsense-e7fb25a5bd63d8fcdd08.js", null ),
     43    'googlesitekit-modules-analytics-4'                    => array( "googlesitekit-modules-analytics-4-f382f0563523da5f8023.js", null ),
     44    'googlesitekit-modules-pagespeed-insights'             => array( "googlesitekit-modules-pagespeed-insights-ac9df42867d70783b841.js", null ),
     45    'googlesitekit-modules-reader-revenue-manager'         => array( "googlesitekit-modules-reader-revenue-manager-fbbb8a6b54f8e8e6c506.js", null ),
     46    'googlesitekit-modules-search-console'                 => array( "googlesitekit-modules-search-console-7ef9910074ab8c22bab3.js", null ),
     47    'googlesitekit-modules-sign-in-with-google'            => array( "googlesitekit-modules-sign-in-with-google-5438d79c1a357d5f1552.js", null ),
     48    'googlesitekit-modules-tagmanager'                     => array( "googlesitekit-modules-tagmanager-7c01bc6dc43a4de58a7e.js", null ),
     49    'googlesitekit-notifications'                          => array( "googlesitekit-notifications-990bda6838a2b33db477.js", null ),
     50    'googlesitekit-polyfills'                              => array( "googlesitekit-polyfills-2ca995545dced5490968.js", null ),
     51    'googlesitekit-settings'                               => array( "googlesitekit-settings-3d397e7aeec169a6f6f7.js", null ),
     52    'googlesitekit-splash'                                 => array( "googlesitekit-splash-77f274ec773bb062bf6b.js", null ),
     53    'googlesitekit-user-input'                             => array( "googlesitekit-user-input-f2a4eab971b7ec745147.js", null ),
     54    'googlesitekit-widgets'                                => array( "googlesitekit-widgets-870e0a6fad71d1353b97.js", null ),
     55    'googlesitekit-wp-dashboard'                           => array( "googlesitekit-wp-dashboard-d26ef36f87825368c95d.js", null ),
    5656);
  • google-site-kit/tags/1.141.0/google-site-kit.php

    r3191565 r3201134  
    1212 * Plugin URI:        https://sitekit.withgoogle.com
    1313 * Description:       Site Kit is a one-stop solution for WordPress users to use everything Google has to offer to make them successful on the web.
    14  * Version:           1.140.0
     14 * Version:           1.141.0
    1515 * Requires at least: 5.2
    1616 * Requires PHP:      7.4
     
    2727
    2828// Define most essential constants.
    29 define( 'GOOGLESITEKIT_VERSION', '1.140.0' );
     29define( 'GOOGLESITEKIT_VERSION', '1.141.0' );
    3030define( 'GOOGLESITEKIT_PLUGIN_MAIN_FILE', __FILE__ );
    3131define( 'GOOGLESITEKIT_PHP_MINIMUM', '7.4.0' );
  • google-site-kit/tags/1.141.0/includes/Core/Assets/Assets.php

    r3148853 r3201134  
    731731
    732732        $inline_data = array(
    733             'homeURL'          => trailingslashit( $this->context->get_canonical_home_url() ),
    734             'referenceSiteURL' => esc_url_raw( trailingslashit( $site_url ) ),
    735             'adminURL'         => esc_url_raw( trailingslashit( admin_url() ) ),
    736             'assetsURL'        => esc_url_raw( $this->context->url( 'dist/assets/' ) ),
    737             'widgetsAdminURL'  => esc_url_raw( $this->get_widgets_admin_url() ),
    738             'blogPrefix'       => $wpdb->get_blog_prefix(),
    739             'ampMode'          => $this->context->get_amp_mode(),
    740             'isNetworkMode'    => $this->context->is_network_mode(),
    741             'timezone'         => get_option( 'timezone_string' ),
    742             'siteName'         => wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ),
    743             'enabledFeatures'  => Feature_Flags::get_enabled_features(),
    744             'webStoriesActive' => defined( 'WEBSTORIES_VERSION' ),
    745             'postTypes'        => $this->get_post_types(),
    746             'storagePrefix'    => $this->get_storage_prefix(),
    747             'referenceDate'    => apply_filters( 'googlesitekit_reference_date', null ),
    748             'productPostType'  => $this->get_product_post_type(),
     733            'homeURL'           => trailingslashit( $this->context->get_canonical_home_url() ),
     734            'referenceSiteURL'  => esc_url_raw( trailingslashit( $site_url ) ),
     735            'adminURL'          => esc_url_raw( trailingslashit( admin_url() ) ),
     736            'assetsURL'         => esc_url_raw( $this->context->url( 'dist/assets/' ) ),
     737            'widgetsAdminURL'   => esc_url_raw( $this->get_widgets_admin_url() ),
     738            'blogPrefix'        => $wpdb->get_blog_prefix(),
     739            'ampMode'           => $this->context->get_amp_mode(),
     740            'isNetworkMode'     => $this->context->is_network_mode(),
     741            'timezone'          => get_option( 'timezone_string' ),
     742            'siteName'          => wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ),
     743            'enabledFeatures'   => Feature_Flags::get_enabled_features(),
     744            'webStoriesActive'  => defined( 'WEBSTORIES_VERSION' ),
     745            'postTypes'         => $this->get_post_types(),
     746            'storagePrefix'     => $this->get_storage_prefix(),
     747            'referenceDate'     => apply_filters( 'googlesitekit_reference_date', null ),
     748            'productPostType'   => $this->get_product_post_type(),
     749            'anyoneCanRegister' => (bool) get_option( 'users_can_register' ),
    749750        );
    750751
  • google-site-kit/tags/1.141.0/includes/Core/Consent_Mode/Consent_Mode.php

    r3127664 r3201134  
    1414use Google\Site_Kit\Core\Assets\Script;
    1515use Google\Site_Kit\Core\Storage\Options;
     16use Google\Site_Kit\Core\Util\BC_Functions;
    1617use Google\Site_Kit\Core\Util\Method_Proxy_Trait;
    1718use Plugin_Upgrader;
     
    232233        // The core Consent Mode code is in assets/js/consent-mode/consent-mode.js.
    233234        // Only code that passes data from PHP to JS should be in this file.
    234         ?>
    235 <!-- <?php echo esc_html__( 'Google tag (gtag.js) Consent Mode dataLayer added by Site Kit', 'google-site-kit' ); ?> -->
    236 <script id='google_gtagjs-js-consent-mode-data-layer'>
    237 window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}
    238 gtag('consent', 'default', <?php echo wp_json_encode( $consent_defaults ); ?>);
    239 window._googlesitekitConsentCategoryMap = <?php echo wp_json_encode( $consent_category_map ); ?>;
    240 window._googlesitekitConsents = <?php echo wp_json_encode( $consent_defaults ); ?>
    241 </script>
    242 <!-- <?php echo esc_html__( 'End Google tag (gtag.js) Consent Mode dataLayer added by Site Kit', 'google-site-kit' ); ?> -->
    243             <?php
     235        printf( "<!-- %s -->\n", esc_html__( 'Google tag (gtag.js) Consent Mode dataLayer added by Site Kit', 'google-site-kit' ) );
     236        BC_Functions::wp_print_inline_script_tag(
     237            join(
     238                "\n",
     239                array(
     240                    'window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}',
     241                    sprintf( "gtag('consent', 'default', %s);", wp_json_encode( $consent_defaults ) ),
     242                    sprintf( 'window._googlesitekitConsentCategoryMap = %s;', wp_json_encode( $consent_category_map ) ),
     243                    sprintf( 'window._googlesitekitConsents = %s;', wp_json_encode( $consent_defaults ) ),
     244                )
     245            ),
     246            array( 'id' => 'google_gtagjs-js-consent-mode-data-layer' )
     247        );
     248        printf( "<!-- %s -->\n", esc_html__( 'End Google tag (gtag.js) Consent Mode dataLayer added by Site Kit', 'google-site-kit' ) );
    244249    }
    245250
  • google-site-kit/tags/1.141.0/includes/Core/Key_Metrics/REST_Key_Metrics_Controller.php

    r3173125 r3201134  
    185185                )
    186186            ),
     187            new REST_Route(
     188                'core/user/data/reset-key-metrics-selection',
     189                array(
     190                    'methods'             => WP_REST_Server::CREATABLE,
     191                    'callback'            => function () {
     192                        $this->settings->merge( array( 'widgetSlugs' => array() ) );
     193
     194                        return new WP_REST_Response( $this->settings->get() );
     195                    },
     196                    'permission_callback' => $has_capabilities,
     197                )
     198            ),
    187199        );
    188200    }
  • google-site-kit/tags/1.141.0/includes/Core/Site_Health/Debug_Data.php

    r3156474 r3201134  
    1515use Google\Site_Kit\Core\Authentication\Clients\OAuth_Client;
    1616use Google\Site_Kit\Core\Conversion_Tracking\Conversion_Tracking;
     17use Google\Site_Kit\Core\Key_Metrics\Key_Metrics_Settings;
     18use Google\Site_Kit\Core\Key_Metrics\Key_Metrics_Setup_Completed_By;
    1719use Google\Site_Kit\Core\Modules\Module;
    1820use Google\Site_Kit\Core\Modules\Module_With_Debug_Fields;
     
    196198        $fields = array_merge( $fields, $this->get_consent_mode_fields() );
    197199        $fields = array_merge( $fields, $this->get_module_sharing_settings_fields() );
     200        $fields = array_merge( $fields, $this->get_key_metrics_fields() );
    198201
    199202        $fields = array_filter(
     
    416419                array(
    417420                    /* translators: %s: module name */
    418                     'label' => sprintf( __( '%s Shared Roles', 'google-site-kit' ), $module->name ),
     421                    'label' => sprintf( __( '%s: Shared Roles', 'google-site-kit' ), $module->name ),
    419422                ),
    420423                $this->get_module_shared_role_names( $module_settings['sharedRoles'] )
     
    424427                array(
    425428                    /* translators: %s: module name */
    426                     'label' => sprintf( __( '%s Management', 'google-site-kit' ), $module->name ),
     429                    'label' => sprintf( __( '%s: Management', 'google-site-kit' ), $module->name ),
    427430                ),
    428431                $this->get_module_management( $module_settings['management'] )
     
    639642        );
    640643    }
     644
     645    /**
     646     * Gets the key metrics status fields.
     647     *
     648     * @since 1.141.0
     649     *
     650     * @return array
     651     */
     652    private function get_key_metrics_fields() {
     653        $is_setup_complete    = ( new Key_Metrics_Setup_Completed_By( $this->options ) )->get();
     654        $key_metrics_settings = ( new Key_Metrics_Settings( $this->user_options ) )->get();
     655
     656        if ( ! $is_setup_complete ) {
     657            return array(
     658                'key_metrics_status' => array(
     659                    'label' => __( 'Key Metrics Status', 'google-site-kit' ),
     660                    'value' => __( 'Not setup', 'google-site-kit' ),
     661                ),
     662            );
     663        }
     664
     665        $key_metrics_status = isset( $key_metrics_settings['isWidgetHidden'] ) && $key_metrics_settings['isWidgetHidden'] ?
     666            __( 'Setup and Disabled', 'google-site-kit' ) :
     667            __( 'Setup and Enabled', 'google-site-kit' );
     668
     669        // A minimum of 2 key metrics need to be saved to prevent "default" tailored metrics to render.
     670        $key_metrics_source = isset( $key_metrics_settings['widgetSlugs'] ) && count( $key_metrics_settings['widgetSlugs'] ) > 1 ?
     671            __( 'Manual Selection', 'google-site-kit' ) :
     672            __( 'Tailored Metrics', 'google-site-kit' );
     673
     674        return array(
     675            'key_metrics_status' => array(
     676                'label' => __( 'Key Metrics Status', 'google-site-kit' ),
     677                'value' => $key_metrics_status,
     678            ),
     679            'key_metrics_source' => array(
     680                'label' => __( 'Key Metrics Source', 'google-site-kit' ),
     681                'value' => $key_metrics_source,
     682            ),
     683        );
     684    }
    641685}
  • google-site-kit/tags/1.141.0/includes/Modules/AdSense.php

    r3118692 r3201134  
    230230        return array(
    231231            'adsense_account_id'                       => array(
    232                 'label' => __( 'AdSense account ID', 'google-site-kit' ),
     232                'label' => __( 'AdSense: Account ID', 'google-site-kit' ),
    233233                'value' => $settings['accountID'],
    234234                'debug' => Debug_Data::redact_debug_value( $settings['accountID'], 7 ),
    235235            ),
    236236            'adsense_client_id'                        => array(
    237                 'label' => __( 'AdSense client ID', 'google-site-kit' ),
     237                'label' => __( 'AdSense: Client ID', 'google-site-kit' ),
    238238                'value' => $settings['clientID'],
    239239                'debug' => Debug_Data::redact_debug_value( $settings['clientID'], 10 ),
    240240            ),
    241241            'adsense_account_status'                   => array(
    242                 'label' => __( 'AdSense account status', 'google-site-kit' ),
     242                'label' => __( 'AdSense: Account status', 'google-site-kit' ),
    243243                'value' => $settings['accountStatus'],
    244244            ),
    245245            'adsense_site_status'                      => array(
    246                 'label' => __( 'AdSense site status', 'google-site-kit' ),
     246                'label' => __( 'AdSense: Site status', 'google-site-kit' ),
    247247                'value' => $settings['siteStatus'],
    248248            ),
    249249            'adsense_use_snippet'                      => array(
    250                 'label' => __( 'AdSense snippet placed', 'google-site-kit' ),
     250                'label' => __( 'AdSense: Snippet placed', 'google-site-kit' ),
    251251                'value' => $settings['useSnippet'] ? __( 'Yes', 'google-site-kit' ) : __( 'No', 'google-site-kit' ),
    252252                'debug' => $settings['useSnippet'] ? 'yes' : 'no',
    253253            ),
    254254            'adsense_web_stories_adunit_id'            => array(
    255                 'label' => __( 'Web Stories Ad Unit ID', 'google-site-kit' ),
     255                'label' => __( 'AdSense: Web Stories Ad Unit ID', 'google-site-kit' ),
    256256                'value' => $settings['webStoriesAdUnit'],
    257257                'debug' => $settings['webStoriesAdUnit'],
    258258            ),
    259259            'adsense_setup_completed_timestamp'        => array(
    260                 'label' => __( 'AdSense setup completed at', 'google-site-kit' ),
     260                'label' => __( 'AdSense: Setup completed at', 'google-site-kit' ),
    261261                'value' => $settings['setupCompletedTimestamp'] ? date_i18n(
    262262                    get_option( 'date_format' ),
     
    267267            'adsense_abr_use_snippet'                  => array(
    268268                'label' => __(
    269                     'Ad Blocking Recovery snippet placed',
     269                    'AdSense: Ad Blocking Recovery snippet placed',
    270270                    'google-site-kit'
    271271                ),
     
    275275            'adsense_abr_use_error_protection_snippet' => array(
    276276                'label' => __(
    277                     'Ad Blocking Recovery error protection snippet placed',
     277                    'AdSense: Ad Blocking Recovery error protection snippet placed',
    278278                    'google-site-kit'
    279279                ),
     
    283283            'adsense_abr_setup_status'                 => array(
    284284                'label' => __(
    285                     'Ad Blocking Recovery setup status',
     285                    'AdSense: Ad Blocking Recovery setup status',
    286286                    'google-site-kit'
    287287                ),
  • google-site-kit/tags/1.141.0/includes/Modules/Ads.php

    r3173125 r3201134  
    310310        return array(
    311311            'ads_conversion_tracking_id' => array(
    312                 'label' => __( 'Ads Conversion Tracking ID', 'google-site-kit' ),
     312                'label' => __( 'Ads: Conversion Tracking ID', 'google-site-kit' ),
    313313                'value' => $settings['conversionID'],
    314314                'debug' => Debug_Data::redact_debug_value( $settings['conversionID'] ),
  • google-site-kit/tags/1.141.0/includes/Modules/Analytics_4.php

    r3181737 r3201134  
    506506        $debug_fields = array(
    507507            'analytics_4_account_id'                  => array(
    508                 'label' => __( 'Analytics account ID', 'google-site-kit' ),
     508                'label' => __( 'Analytics: Account ID', 'google-site-kit' ),
    509509                'value' => $settings['accountID'],
    510510                'debug' => Debug_Data::redact_debug_value( $settings['accountID'] ),
    511511            ),
    512512            'analytics_4_property_id'                 => array(
    513                 'label' => __( 'Analytics property ID', 'google-site-kit' ),
     513                'label' => __( 'Analytics: Property ID', 'google-site-kit' ),
    514514                'value' => $settings['propertyID'],
    515515                'debug' => Debug_Data::redact_debug_value( $settings['propertyID'], 7 ),
    516516            ),
    517517            'analytics_4_web_data_stream_id'          => array(
    518                 'label' => __( 'Analytics web data stream ID', 'google-site-kit' ),
     518                'label' => __( 'Analytics: Web Data Stream ID', 'google-site-kit' ),
    519519                'value' => $settings['webDataStreamID'],
    520520                'debug' => Debug_Data::redact_debug_value( $settings['webDataStreamID'] ),
    521521            ),
    522522            'analytics_4_measurement_id'              => array(
    523                 'label' => __( 'Analytics measurement ID', 'google-site-kit' ),
     523                'label' => __( 'Analytics: Measurement ID', 'google-site-kit' ),
    524524                'value' => $settings['measurementID'],
    525525                'debug' => Debug_Data::redact_debug_value( $settings['measurementID'] ),
    526526            ),
    527527            'analytics_4_use_snippet'                 => array(
    528                 'label' => __( 'Analytics snippet placed', 'google-site-kit' ),
     528                'label' => __( 'Analytics: Snippet placed', 'google-site-kit' ),
    529529                'value' => $settings['useSnippet'] ? __( 'Yes', 'google-site-kit' ) : __( 'No', 'google-site-kit' ),
    530530                'debug' => $settings['useSnippet'] ? 'yes' : 'no',
    531531            ),
    532532            'analytics_4_ads_conversion_id'           => array(
    533                 'label' => __( 'Analytics Ads conversion ID', 'google-site-kit' ),
     533                'label' => __( 'Analytics: Ads Conversion ID', 'google-site-kit' ),
    534534                'value' => $settings['adsConversionID'],
    535535                'debug' => Debug_Data::redact_debug_value( $settings['adsConversionID'] ),
    536536            ),
    537537            'analytics_4_available_custom_dimensions' => array(
    538                 'label' => __( 'Analytics available custom dimensions', 'google-site-kit' ),
     538                'label' => __( 'Analytics: Available Custom Dimensions', 'google-site-kit' ),
    539539                'value' => empty( $settings['availableCustomDimensions'] )
    540540                    ? __( 'None', 'google-site-kit' )
     
    549549            ),
    550550            'analytics_4_ads_linked'                  => array(
    551                 'label' => __( 'Analytics Ads Linked', 'google-site-kit' ),
     551                'label' => __( 'Analytics: Ads Linked', 'google-site-kit' ),
    552552                'value' => $settings['adsLinked'] ? __( 'Connected', 'google-site-kit' ) : __( 'Not connected', 'google-site-kit' ),
    553553                'debug' => $settings['adsLinked'],
    554554            ),
    555555            'analytics_4_ads_linked_last_synced_at'   => array(
    556                 'label' => __( 'Analytics Ads Linked Last Synced At', 'google-site-kit' ),
     556                'label' => __( 'Analytics: Ads Linked Last Synced At', 'google-site-kit' ),
    557557                'value' => $settings['adsLinkedLastSyncedAt'] ? gmdate( 'Y-m-d H:i:s', $settings['adsLinkedLastSyncedAt'] ) : __( 'Never synced', 'google-site-kit' ),
    558558                'debug' => $settings['adsLinkedLastSyncedAt'],
     
    562562        if ( $this->is_adsense_connected() ) {
    563563            $debug_fields['analytics_4_adsense_linked'] = array(
    564                 'label' => __( 'Analytics AdSense Linked', 'google-site-kit' ),
     564                'label' => __( 'Analytics: AdSense Linked', 'google-site-kit' ),
    565565                'value' => $settings['adSenseLinked'] ? __( 'Connected', 'google-site-kit' ) : __( 'Not connected', 'google-site-kit' ),
    566566                'debug' => Debug_Data::redact_debug_value( $settings['adSenseLinked'] ),
     
    568568
    569569            $debug_fields['analytics_4_adsense_linked_last_synced_at'] = array(
    570                 'label' => __( 'Analytics AdSense Linked Last Synced At', 'google-site-kit' ),
     570                'label' => __( 'Analytics: AdSense Linked Last Synced At', 'google-site-kit' ),
    571571                'value' => $settings['adSenseLinkedLastSyncedAt'] ? gmdate( 'Y-m-d H:i:s', $settings['adSenseLinkedLastSyncedAt'] ) : __( 'Never synced', 'google-site-kit' ),
    572572                'debug' => Debug_Data::redact_debug_value( $settings['adSenseLinkedLastSyncedAt'] ),
     
    580580
    581581            $debug_fields['analytics_4_site_kit_audiences'] = array(
    582                 'label' => __( 'Analytics site created audiences', 'google-site-kit' ),
     582                'label' => __( 'Analytics: Site created audiences', 'google-site-kit' ),
    583583                'value' => empty( $site_kit_audiences )
    584584                    ? __( 'None', 'google-site-kit' )
  • google-site-kit/tags/1.141.0/includes/Modules/Reader_Revenue_Manager.php

    r3148853 r3201134  
    2929use Google\Site_Kit\Core\Modules\Module_With_Tag_Trait;
    3030use Google\Site_Kit\Core\REST_API\Data_Request;
     31use Google\Site_Kit\Core\REST_API\Exception\Missing_Required_Param_Exception;
    3132use Google\Site_Kit\Core\Site_Health\Debug_Data;
    3233use Google\Site_Kit\Core\Tags\Guards\Tag_Environment_Type_Guard;
     
    3435use Google\Site_Kit\Core\Util\URL;
    3536use Google\Site_Kit\Modules\Reader_Revenue_Manager\Settings;
     37use Google\Site_Kit\Modules\Reader_Revenue_Manager\Synchronize_OnboardingState;
    3638use Google\Site_Kit\Modules\Reader_Revenue_Manager\Tag_Guard;
    3739use Google\Site_Kit\Modules\Reader_Revenue_Manager\Tag_Matchers;
     
    6870        $this->register_scopes_hook();
    6971
     72        $synchronize_onboarding_state = new Synchronize_OnboardingState(
     73            $this,
     74            $this->user_options
     75        );
     76        $synchronize_onboarding_state->register();
     77
     78        add_action( 'load-toplevel_page_googlesitekit-dashboard', array( $synchronize_onboarding_state, 'maybe_schedule_synchronize_onboarding_state' ) );
     79        add_action( 'load-toplevel_page_googlesitekit-settings', array( $synchronize_onboarding_state, 'maybe_schedule_synchronize_onboarding_state' ) );
     80
    7081        // Reader Revenue Manager tag placement logic.
    7182        add_action( 'template_redirect', array( $this, 'register_tag' ) );
     
    192203    protected function get_datapoint_definitions() {
    193204        return array(
    194             'GET:publications' => array( 'service' => 'subscribewithgoogle' ),
     205            'GET:publications'                       => array(
     206                'service' => 'subscribewithgoogle',
     207            ),
     208            'POST:sync-publication-onboarding-state' => array(
     209                'service' => 'subscribewithgoogle',
     210            ),
    195211        );
    196212    }
     
    204220     * @return RequestInterface|callable|WP_Error Request object or callable on success, or WP_Error on failure.
    205221     *
    206      * @throws Invalid_Datapoint_Exception Thrown if the datapoint does not exist.
     222     * @throws Invalid_Datapoint_Exception|Missing_Required_Param_Exception Thrown if the datapoint does not exist or parameters are missing.
    207223     */
    208224    protected function create_data_request( Data_Request $data ) {
     
    216232                $subscribewithgoogle = $this->get_service( 'subscribewithgoogle' );
    217233                return $subscribewithgoogle->publications->listPublications( array( 'filter' => $this->get_publication_filter() ) );
     234
     235            case 'POST:sync-publication-onboarding-state':
     236                if ( empty( $data['publicationID'] ) ) {
     237                    throw new Missing_Required_Param_Exception( 'publicationID' );
     238                }
     239
     240                if ( empty( $data['publicationOnboardingState'] ) ) {
     241                    throw new Missing_Required_Param_Exception( 'publicationOnboardingState' );
     242                }
     243
     244                $publications = $this->get_data( 'publications' );
     245
     246                if ( is_wp_error( $publications ) ) {
     247                    return $publications;
     248                }
     249
     250                if ( empty( $publications ) ) {
     251                    return new WP_Error(
     252                        'publication_not_found',
     253                        __( 'Publication not found.', 'google-site-kit' ),
     254                        array( 'status' => 404 )
     255                    );
     256                }
     257
     258                $publication = array_filter(
     259                    $publications,
     260                    function ( $publication ) use ( $data ) {
     261                        return $publication->getPublicationId() === $data['publicationID'];
     262                    }
     263                );
     264
     265                if ( empty( $publication ) ) {
     266                    return new WP_Error(
     267                        'publication_not_found',
     268                        __( 'Publication not found.', 'google-site-kit' ),
     269                        array( 'status' => 404 )
     270                    );
     271                }
     272
     273                $publication          = reset( $publication );
     274                $new_onboarding_state = $publication->getOnboardingState();
     275
     276                if ( $new_onboarding_state === $data['publicationOnboardingState'] ) {
     277                    return function () {
     278                        return (object) array();
     279                    };
     280                }
     281
     282                $settings = $this->get_settings();
     283
     284                if ( $data['publicationID'] === $settings->get()['publicationID'] ) {
     285                    $settings->merge(
     286                        array(
     287                            'publicationOnboardingState' => $new_onboarding_state,
     288                        )
     289                    );
     290                }
     291
     292                return function () use ( $data, $new_onboarding_state ) {
     293                    return (object) array(
     294                        'publicationID'              => $data['publicationID'],
     295                        'publicationOnboardingState' => $new_onboarding_state,
     296                    );
     297                };
    218298        }
    219299
     
    373453        return array(
    374454            'reader_revenue_manager_publication_id' => array(
    375                 'label' => __( 'Reader Revenue Manager publication ID', 'google-site-kit' ),
     455                'label' => __( 'Reader Revenue Manager: Publication ID', 'google-site-kit' ),
    376456                'value' => $settings['publicationID'],
    377457                'debug' => Debug_Data::redact_debug_value( $settings['publicationID'] ),
    378458            ),
    379459            'reader_revenue_manager_publication_onboarding_state' => array(
    380                 'label' => __( 'Reader Revenue Manager publication onboarding state', 'google-site-kit' ),
     460                'label' => __( 'Reader Revenue Manager: Publication onboarding state', 'google-site-kit' ),
    381461                'value' => $settings['publicationOnboardingState'],
    382462                'debug' => $settings['publicationOnboardingState'],
    383463            ),
    384             'reader_revenue_manager_publication_onboarding_state_last_synced_at' => array(
    385                 'label' => __( 'Reader Revenue Manager publication onboarding state last synced at', 'google-site-kit' ),
    386                 'value' => $settings['publicationOnboardingStateLastSyncedAtMs'] ? gmdate( 'Y-m-d H:i:s', $settings['publicationOnboardingStateLastSyncedAtMs'] / 1000 ) : __( 'Never synced', 'google-site-kit' ),
    387                 'debug' => $settings['publicationOnboardingStateLastSyncedAtMs'],
    388             ),
    389464        );
    390465    }
  • google-site-kit/tags/1.141.0/includes/Modules/Reader_Revenue_Manager/Settings.php

    r3134468 r3201134  
    7070    protected function get_default() {
    7171        return array(
    72             'ownerID'                                  => 0,
    73             'publicationID'                            => '',
    74             'publicationOnboardingState'               => '',
    75             'publicationOnboardingStateLastSyncedAtMs' => 0,
     72            'ownerID'                           => 0,
     73            'publicationID'                     => '',
     74            'publicationOnboardingState'        => '',
     75            'publicationOnboardingStateChanged' => false,
    7676        );
    7777    }
     
    103103            }
    104104
    105             if ( isset( $option['publicationOnboardingStateLastSyncedAtMs'] ) ) {
    106                 if ( ! is_int( $option['publicationOnboardingStateLastSyncedAtMs'] ) ) {
    107                     $option['publicationOnboardingStateLastSyncedAtMs'] = 0;
     105            if ( isset( $option['publicationOnboardingStateChanged'] ) ) {
     106                if ( ! is_bool( $option['publicationOnboardingStateChanged'] ) ) {
     107                    $option['publicationOnboardingStateChanged'] = false;
    108108                }
    109109            }
  • google-site-kit/tags/1.141.0/includes/Modules/Search_Console.php

    r3148853 r3201134  
    166166        return array(
    167167            'search_console_property' => array(
    168                 'label' => __( 'Search Console property', 'google-site-kit' ),
     168                'label' => __( 'Search Console: Property', 'google-site-kit' ),
    169169                'value' => $this->get_property_id(),
    170170            ),
  • google-site-kit/tags/1.141.0/includes/Modules/Sign_In_With_Google.php

    r3191565 r3201134  
    1111namespace Google\Site_Kit\Modules;
    1212
     13use Google\Site_Kit\Core\Assets\Asset;
    1314use Google\Site_Kit\Core\Assets\Script;
    1415use Google\Site_Kit\Core\Conversion_Tracking\Conversion_Event_Providers\WooCommerce;
     
    2324use Google\Site_Kit\Core\Modules\Module_With_Tag_Trait;
    2425use Google\Site_Kit\Core\Modules\Tags\Module_Tag_Matchers;
     26use Google\Site_Kit\Core\Permissions\Permissions;
    2527use Google\Site_Kit\Core\Site_Health\Debug_Data;
     28use Google\Site_Kit\Core\Storage\Options;
     29use Google\Site_Kit\Core\Storage\User_Options;
     30use Google\Site_Kit\Core\Util\BC_Functions;
    2631use Google\Site_Kit\Core\Util\Method_Proxy_Trait;
     32use Google\Site_Kit\Modules\Sign_In_With_Google\Authenticator;
     33use Google\Site_Kit\Modules\Sign_In_With_Google\Authenticator_Interface;
     34use Google\Site_Kit\Modules\Sign_In_With_Google\Hashed_User_ID;
     35use Google\Site_Kit\Modules\Sign_In_With_Google\Profile_Reader;
    2736use Google\Site_Kit\Modules\Sign_In_With_Google\Settings;
    2837use Google\Site_Kit\Modules\Sign_In_With_Google\Tag_Matchers;
    29 use Google\Site_Kit_Dependencies\Google_Client;
    3038use WP_Error;
     39use WP_User;
    3140
    3241/**
    33  * Class representing the Sign in With Google module.
     42 * Class representing the Sign in with Google module.
    3443 *
    3544 * @since 1.137.0
     
    5059
    5160    /**
     61     * Authentication action name.
     62     */
     63    const ACTION_AUTH = 'googlesitekit_auth';
     64
     65    /**
     66     * Disconnect action name.
     67     */
     68    const ACTION_DISCONNECT = 'googlesitekit_auth_disconnect';
     69
     70    /**
    5271     * Registers functionality through WordPress hooks.
    5372     *
    5473     * @since 1.137.0
     74     * @since 1.141.0 Add functionality to allow users to disconnect their own account and admins to disconnect any user.
    5575     */
    5676    public function register() {
    57         add_filter( 'wp_login_errors', array( $this, 'handle_google_auth_errors' ) );
    58 
    59         add_action( 'login_form_google_auth', array( $this, 'handle_google_auth' ) );
     77        add_filter( 'wp_login_errors', array( $this, 'handle_login_errors' ) );
     78
     79        add_action(
     80            'login_form_' . self::ACTION_AUTH,
     81            function () {
     82                $settings = $this->get_settings();
     83
     84                $profile_reader = new Profile_Reader( $settings );
     85                $authenticator  = new Authenticator( $this->user_options, $profile_reader );
     86
     87                $this->handle_auth_callback( $authenticator );
     88            }
     89        );
     90
     91        add_action( 'admin_action_' . self::ACTION_DISCONNECT, fn () => $this->handle_disconnect_user() );
     92
    6093        add_action( 'login_form', $this->get_method_proxy( 'render_signin_button' ) );
    61     }
    62 
    63     /**
    64      * Intercept the page request to process token ID
    65      * and complete Sign in with Google flow.
    66      *
    67      * @since 1.140.0
    68      */
    69     public function handle_google_auth() {
    70         $request_method = $this->context->input()->filter( INPUT_SERVER, 'REQUEST_METHOD' );
    71 
     94
     95        add_action( 'show_user_profile', $this->get_method_proxy( 'render_disconnect_profile' ) ); // This action shows the disconnect section on the users own profile page.
     96        add_action( 'edit_user_profile', $this->get_method_proxy( 'render_disconnect_profile' ) ); // This action shows the disconnect section on other users profile page to allow admins to disconnect others.
     97
     98        add_action( 'woocommerce_login_form_start', $this->get_method_proxy( 'render_signin_button' ) );
     99    }
     100
     101    /**
     102     * Handles the callback request after the user signs in with Google.
     103     *
     104     * @since 1.140.0
     105     *
     106     * @param Authenticator_Interface $authenticator Authenticator instance.
     107     */
     108    private function handle_auth_callback( Authenticator_Interface $authenticator ) {
     109        $input = $this->context->input();
     110
     111        // Ignore the request if the request method is not POST.
     112        $request_method = $input->filter( INPUT_SERVER, 'REQUEST_METHOD' );
    72113        if ( 'POST' !== $request_method ) {
    73114            return;
    74115        }
    75116
    76         $csrf_cookie = $this->context->input()->filter( INPUT_COOKIE, 'g_csrf_token' );
    77         $csrf_post   = $this->context->input()->filter( INPUT_POST, 'g_csrf_token' );
    78 
    79         if (
    80             ! $csrf_cookie ||
    81             ! $csrf_post ||
    82             $csrf_cookie !== $csrf_post
    83         ) {
    84             wp_safe_redirect( add_query_arg( 'error', 'google_auth_invalid_g_csrf_token', wp_login_url() ) );
    85             exit;
    86         }
    87 
    88         $client_id = $this->get_settings()->get()['clientID'];
    89         $id_token  = $this->context->input()->filter( INPUT_POST, 'credential' );
    90         try {
    91             $client  = new Google_Client( array( 'client_id' => $client_id ) );
    92             $payload = $client->verifyIdToken( $id_token );
    93 
    94             if ( empty( $payload ) ) {
    95                 wp_safe_redirect( add_query_arg( 'error', 'google_auth_invalid_request', wp_login_url() ) );
    96                 exit;
    97             }
    98 
    99             // @TODO implement further flow using $payload in #9339.
    100 
    101         } catch ( \Exception $e ) {
    102             wp_safe_redirect( add_query_arg( 'error', 'google_auth_invalid_request', wp_login_url() ) );
     117        $redirect_to = $authenticator->authenticate_user( $input );
     118        if ( ! empty( $redirect_to ) ) {
     119            wp_safe_redirect( $redirect_to );
    103120            exit;
    104121        }
     
    113130     * @return WP_Error $error WP_Error instance.
    114131     */
    115     public function handle_google_auth_errors( $error ) {
     132    public function handle_login_errors( $error ) {
    116133        $error_code = $this->context->input()->filter( INPUT_GET, 'error' );
    117134        if ( ! $error_code ) {
     
    120137
    121138        switch ( $error_code ) {
    122             case 'google_auth_invalid_request':
    123             case 'google_auth_invalid_g_csrf_token':
    124                 $error->add( 'google_auth', __( 'Sign in with Google failed.', 'google-site-kit' ) );
     139            case Authenticator::ERROR_INVALID_REQUEST:
     140                $error->add( self::MODULE_SLUG, __( 'Sign in with Google failed.', 'google-site-kit' ) );
     141                break;
     142            case Authenticator::ERROR_SIGNIN_FAILED:
     143                $error->add( self::MODULE_SLUG, __( 'The user is not registered on this site.', 'google-site-kit' ) );
    125144                break;
    126145            default:
     
    206225    public function is_connected() {
    207226        $options = $this->get_settings()->get();
    208 
    209227        if ( empty( $options['clientID'] ) ) {
    210228            return false;
     
    220238     */
    221239    private function render_signin_button() {
     240        global $wp;
     241        $is_woo_commerce_login = 'my-account' === $wp->request;
     242
    222243        $settings = $this->get_settings()->get();
    223244        if ( ! $settings['clientID'] ) {
     
    225246        }
    226247
    227         $redirect_url = add_query_arg( 'action', 'google_auth', wp_login_url() );
    228         if ( substr( $redirect_url, 0, 5 ) !== 'https' ) {
     248        $login_uri = add_query_arg( 'action', self::ACTION_AUTH, wp_login_url() );
     249        if ( substr( $login_uri, 0, 5 ) !== 'https' ) {
    229250            return;
    230251        }
    231252
     253        $redirect_to = $this->context->input()->filter( INPUT_GET, 'redirect_to' );
     254        if ( ! empty( $redirect_to ) ) {
     255            $redirect_to = trim( $redirect_to );
     256        }
     257
     258        $btn_args = array(
     259            'theme' => $settings['theme'],
     260            'text'  => $settings['text'],
     261            'shape' => $settings['shape'],
     262        );
     263
    232264        // Render the Sign in with Google button and related inline styles.
     265        printf( "\n<!-- %s -->\n", esc_html__( 'Sign in with Google button added by Site Kit', 'google-site-kit' ) );
     266        BC_Functions::wp_print_script_tag( array( 'src' => 'https://accounts.google.com/gsi/client' ) );
     267        ob_start();
    233268        ?>
    234 <!-- <?php echo esc_html__( 'Sign in with Google button added by Site Kit', 'google-site-kit' ); ?> -->
    235 <?php /* phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript */ ?>
    236 <script src="https://accounts.google.com/gsi/client"></script>
    237 <script>
    238269( () => {
    239     google.accounts.id.initialize({
     270    const parent = document.createElement( 'div' );
     271<?php if ( $is_woo_commerce_login ) : // phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect ?>
     272    document.getElementsByClassName( 'login' )[0]?.insertBefore( parent, document.getElementsByClassName( 'woocommerce-form-row' )[0] );
     273        <?php else : // phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect ?>
     274    document.getElementById( 'login' ).insertBefore( parent, document.getElementById( 'loginform' ) );
     275        <?php endif; // phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect ?>
     276
     277    async function handleCredentialResponse( response ) {
     278        try {
     279            const res = await fetch( '<?php echo esc_js( $login_uri ); ?>', {
     280                method: 'POST',
     281                headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
     282                body: new URLSearchParams( response )
     283            });
     284            if ( res.ok && res.redirected ) {
     285                location.assign( res.url );
     286            }
     287        } catch( error ) {
     288            console.error( error );
     289        }
     290    }
     291
     292    google.accounts.id.initialize( {
    240293        client_id: '<?php echo esc_js( $settings['clientID'] ); ?>',
    241         login_uri: '<?php echo esc_js( $redirect_url ); ?>',
    242         ux_mode: 'redirect',
    243     });
    244     const parent = document.createElement( 'div' );
    245     document.getElementById( 'login').insertBefore( parent, document.getElementById( 'loginform' ) );
    246     google.accounts.id.renderButton(parent, {
    247         theme: '<?php echo esc_js( $settings['theme'] ); ?>',
    248         text: '<?php echo esc_js( $settings['text'] ); ?>',
    249         shape: '<?php echo esc_js( $settings['shape'] ); ?>'
    250     });
     294        callback: handleCredentialResponse,
     295    } );
     296
     297    google.accounts.id.renderButton( parent, <?php echo wp_json_encode( $btn_args ); ?> );
     298
     299<?php if ( $settings['oneTapEnabled'] ) : // phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect ?>
     300    google.accounts.id.prompt();
     301        <?php endif; // phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect ?>
     302
     303<?php if ( ! empty( $redirect_to ) ) : // phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect ?>
     304    const expires = new Date();
     305    expires.setTime( expires.getTime() + 1000 * 60 * 5 );
     306    document.cookie = "<?php echo esc_js( Authenticator::COOKIE_REDIRECT_TO ); ?>=<?php echo esc_js( $redirect_to ); ?>;expires="  + expires.toUTCString() + ";path=<?php echo esc_js( Authenticator::get_cookie_path() ); ?>";
     307        <?php endif; // phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect ?>
    251308} )();
    252 </script>
    253 <!-- <?php echo esc_html__( 'End Sign in with Google button added by Site Kit', 'google-site-kit' ); ?> -->
    254309        <?php
     310        BC_Functions::wp_print_inline_script_tag( ob_get_clean() );
     311        printf( "\n<!-- %s -->\n", esc_html__( 'End Sign in with Google button added by Site Kit', 'google-site-kit' ) );
    255312    }
    256313
     
    260317     * @since 1.140.0
    261318     *
    262      * @return array
     319     * @return int
    263320     */
    264321    public function get_authenticated_users_count() {
    265322        global $wpdb;
    266323
    267         $settings = $this->get_settings();
    268324        // phpcs:ignore WordPress.DB.DirectDatabaseQuery
    269         return $wpdb->query(
    270             $wpdb->prepare( "SELECT count(id) FROM $wpdb->usermeta WHERE meta_key = %s", self::GOOGLE_USER_ID_OPTION )
     325        return (int) $wpdb->get_var(
     326            $wpdb->prepare(
     327                "SELECT COUNT( user_id ) FROM $wpdb->usermeta WHERE meta_key = %s",
     328                $this->user_options->get_meta_key( Hashed_User_ID::OPTION )
     329            )
    271330        );
    272331    }
     
    282341        $settings = $this->get_settings()->get();
    283342
    284         // TODO Uncomment and remove fixed value after #9339 is merged.
    285         // $authenticated_user_count = $this->get_authenticated_users_count();.
    286         $authenticated_user_count = 1;
     343        $authenticated_user_count = $this->get_authenticated_users_count();
    287344
    288345        $debug_fields = array(
    289346            'sign_in_with_google_client_id'                => array(
    290                 'label' => __( 'Sign in with Google Client ID', 'google-site-kit' ),
     347                'label' => __( 'Sign in with Google: Client ID', 'google-site-kit' ),
    291348                'value' => $settings['clientID'],
    292349                'debug' => Debug_Data::redact_debug_value( $settings['clientID'] ),
    293350            ),
    294351            'sign_in_with_google_shape'                    => array(
    295                 'label' => __( 'Sign in with Google Shape', 'google-site-kit' ),
     352                'label' => __( 'Sign in with Google: Shape', 'google-site-kit' ),
    296353                'value' => $this->get_settings()->get_label( 'shape', $settings['shape'] ),
    297354                'debug' => $settings['shape'],
    298355            ),
    299356            'sign_in_with_google_text'                     => array(
    300                 'label' => __( 'Sign in with Google Text', 'google-site-kit' ),
     357                'label' => __( 'Sign in with Google: Text', 'google-site-kit' ),
    301358                'value' => $this->get_settings()->get_label( 'text', $settings['text'] ),
    302359                'debug' => $settings['text'],
    303360            ),
    304361            'sign_in_with_google_theme'                    => array(
    305                 'label' => __( 'Sign in with Google Theme', 'google-site-kit' ),
     362                'label' => __( 'Sign in with Google: Theme', 'google-site-kit' ),
    306363                'value' => $this->get_settings()->get_label( 'theme', $settings['theme'] ),
    307364                'debug' => $settings['theme'],
    308365            ),
    309366            'sign_in_with_google_use_snippet'              => array(
    310                 'label' => __( 'Sign in with Google One-tap Enabled', 'google-site-kit' ),
     367                'label' => __( 'Sign in with Google: One-tap Enabled', 'google-site-kit' ),
    311368                'value' => $settings['oneTapEnabled'] ? __( 'Yes', 'google-site-kit' ) : __( 'No', 'google-site-kit' ),
    312369                'debug' => $settings['oneTapEnabled'] ? 'yes' : 'no',
    313370            ),
    314371            'sign_in_with_google_authenticated_user_count' => array(
    315                 'label' => __( 'Sign in with Google Number of users who have authenticated using Sign in with Google', 'google-site-kit' ),
     372                'label' => __( 'Sign in with Google: Number of users who have authenticated using Sign in with Google', 'google-site-kit' ),
    316373                'value' => $authenticated_user_count,
    317374                'debug' => $authenticated_user_count,
     
    394451        return Module_Tag_Matchers::NO_TAG_FOUND;
    395452    }
     453
     454    /**
     455     * Returns the disconnect URL for the specified user.
     456     *
     457     * @since 1.141.0
     458     *
     459     * @param int $user_id WordPress User ID.
     460     */
     461    public static function disconnect_url( $user_id ) {
     462        return add_query_arg(
     463            array(
     464                'action'  => self::ACTION_DISCONNECT,
     465                'nonce'   => wp_create_nonce( self::ACTION_DISCONNECT . '-' . $user_id ),
     466                'user_id' => $user_id,
     467            ),
     468            admin_url( 'index.php' )
     469        );
     470    }
     471
     472    /**
     473     * Handles the disconnect action.
     474     *
     475     * @since 1.141.0
     476     */
     477    public function handle_disconnect_user() {
     478        $input   = $this->context->input();
     479        $nonce   = $input->filter( INPUT_GET, 'nonce' );
     480        $user_id = (int) $input->filter( INPUT_GET, 'user_id' );
     481        $action  = self::ACTION_DISCONNECT . '-' . $user_id;
     482
     483        if ( ! wp_verify_nonce( $nonce, $action ) ) {
     484            $this->authentication->invalid_nonce_error( $action );
     485        }
     486
     487        // Only allow this action for admins or users own setting.
     488        if ( current_user_can( 'edit_user', $user_id ) ) {
     489            $hashed_user_id = new Hashed_User_ID( new User_Options( $this->context, $user_id ) );
     490            $hashed_user_id->delete();
     491            wp_safe_redirect( add_query_arg( 'updated', true, get_edit_user_link( $user_id ) ) );
     492            exit;
     493        }
     494
     495        wp_safe_redirect( get_edit_user_link( $user_id ) );
     496        exit;
     497    }
     498
     499    /**
     500     * Displays a disconnect button on user profile pages.
     501     *
     502     * @since 1.141.0
     503     *
     504     * @param WP_User $user WordPress user object.
     505     */
     506    private function render_disconnect_profile( WP_User $user ) {
     507        if ( ! current_user_can( 'edit_user', $user->ID ) ) {
     508            return;
     509        }
     510
     511        $hashed_user_id         = new Hashed_User_ID( new User_Options( $this->context, $user->ID ) );
     512        $current_user_google_id = $hashed_user_id->get();
     513
     514        // Don't show if the user does not have a Google ID saved in user meta.
     515        if ( empty( $current_user_google_id ) ) {
     516            return;
     517        }
     518
     519        ?>
     520<div id="googlesitekit-sign-in-with-google-disconnect">
     521    <h2><?php esc_html_e( 'Sign in with Google via Site Kit by Google', 'google-site-kit' ); ?></h2>
     522    <p>
     523        <?php
     524        if ( get_current_user_id() === $user->ID ) {
     525            esc_html_e(
     526                'You can sign in with your Google account.',
     527                'google-site-kit'
     528            );
     529        } else {
     530            esc_html_e(
     531                'This user can sign in with their Google account.',
     532                'google-site-kit'
     533            );
     534        }
     535        ?>
     536    </p>
     537    <p>
     538        <a
     539            class="button button-secondary"
     540            href="<?php echo esc_url( self::disconnect_url( $user->ID ) ); ?>"
     541        >
     542            <?php esc_html_e( 'Disconnect Google Account', 'google-site-kit' ); ?>
     543        </a>
     544    </p>
     545</div>
     546        <?php
     547    }
    396548}
  • google-site-kit/tags/1.141.0/includes/Modules/Tag_Manager.php

    r3118692 r3201134  
    174174        return array(
    175175            'tagmanager_account_id'       => array(
    176                 'label' => __( 'Tag Manager account ID', 'google-site-kit' ),
     176                'label' => __( 'Tag Manager: Account ID', 'google-site-kit' ),
    177177                'value' => $settings['accountID'],
    178178                'debug' => Debug_Data::redact_debug_value( $settings['accountID'] ),
    179179            ),
    180180            'tagmanager_container_id'     => array(
    181                 'label' => __( 'Tag Manager container ID', 'google-site-kit' ),
     181                'label' => __( 'Tag Manager: Container ID', 'google-site-kit' ),
    182182                'value' => $settings['containerID'],
    183183                'debug' => Debug_Data::redact_debug_value( $settings['containerID'], 7 ),
    184184            ),
    185185            'tagmanager_amp_container_id' => array(
    186                 'label' => __( 'Tag Manager AMP container ID', 'google-site-kit' ),
     186                'label' => __( 'Tag Manager: AMP Container ID', 'google-site-kit' ),
    187187                'value' => $settings['ampContainerID'],
    188188                'debug' => Debug_Data::redact_debug_value( $settings['ampContainerID'], 7 ),
    189189            ),
    190190            'tagmanager_use_snippet'      => array(
    191                 'label' => __( 'Tag Manager snippet placed', 'google-site-kit' ),
     191                'label' => __( 'Tag Manager: Snippet placed', 'google-site-kit' ),
    192192                'value' => $settings['useSnippet'] ? __( 'Yes', 'google-site-kit' ) : __( 'No', 'google-site-kit' ),
    193193                'debug' => $settings['useSnippet'] ? 'yes' : 'no',
  • google-site-kit/tags/1.141.0/includes/Plugin.php

    r3164469 r3201134  
    227227                ( new Core\Tags\GTag() )->register();
    228228                ( new Core\Conversion_Tracking\Conversion_Tracking( $this->context, $options ) )->register();
     229                if ( Feature_Flags::enabled( 'firstPartyMode' ) ) {
     230                    ( new Core\Tags\First_Party_Mode\First_Party_Mode( $this->context, $options ) )->register();
     231                }
    229232
    230233                // If a login is happening (runs after 'init'), update current user in dependency chain.
  • google-site-kit/tags/1.141.0/includes/vendor/composer/autoload_classmap.php

    r3191565 r3201134  
    177177    'Google\\Site_Kit\\Core\\Storage\\User_Transients' => $baseDir . '/Core/Storage/User_Transients.php',
    178178    'Google\\Site_Kit\\Core\\Tags\\Blockable_Tag_Interface' => $baseDir . '/Core/Tags/Blockable_Tag_Interface.php',
     179    'Google\\Site_Kit\\Core\\Tags\\First_Party_Mode\\First_Party_Mode' => $baseDir . '/Core/Tags/First_Party_Mode/First_Party_Mode.php',
     180    'Google\\Site_Kit\\Core\\Tags\\First_Party_Mode\\First_Party_Mode_Settings' => $baseDir . '/Core/Tags/First_Party_Mode/First_Party_Mode_Settings.php',
     181    'Google\\Site_Kit\\Core\\Tags\\First_Party_Mode\\REST_First_Party_Mode_Controller' => $baseDir . '/Core/Tags/First_Party_Mode/REST_First_Party_Mode_Controller.php',
    179182    'Google\\Site_Kit\\Core\\Tags\\GTag' => $baseDir . '/Core/Tags/GTag.php',
    180183    'Google\\Site_Kit\\Core\\Tags\\Guards\\Tag_Environment_Type_Guard' => $baseDir . '/Core/Tags/Guards/Tag_Environment_Type_Guard.php',
     
    301304    'Google\\Site_Kit\\Modules\\Reader_Revenue_Manager' => $baseDir . '/Modules/Reader_Revenue_Manager.php',
    302305    'Google\\Site_Kit\\Modules\\Reader_Revenue_Manager\\Settings' => $baseDir . '/Modules/Reader_Revenue_Manager/Settings.php',
     306    'Google\\Site_Kit\\Modules\\Reader_Revenue_Manager\\Synchronize_OnboardingState' => $baseDir . '/Modules/Reader_Revenue_Manager/Synchronize_OnboardingState.php',
    303307    'Google\\Site_Kit\\Modules\\Reader_Revenue_Manager\\Tag_Guard' => $baseDir . '/Modules/Reader_Revenue_Manager/Tag_Guard.php',
    304308    'Google\\Site_Kit\\Modules\\Reader_Revenue_Manager\\Tag_Matchers' => $baseDir . '/Modules/Reader_Revenue_Manager/Tag_Matchers.php',
     
    307311    'Google\\Site_Kit\\Modules\\Search_Console\\Settings' => $baseDir . '/Modules/Search_Console/Settings.php',
    308312    'Google\\Site_Kit\\Modules\\Sign_In_With_Google' => $baseDir . '/Modules/Sign_In_With_Google.php',
     313    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Authenticator' => $baseDir . '/Modules/Sign_In_With_Google/Authenticator.php',
     314    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Authenticator_Interface' => $baseDir . '/Modules/Sign_In_With_Google/Authenticator_Interface.php',
     315    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Hashed_User_ID' => $baseDir . '/Modules/Sign_In_With_Google/Hashed_User_ID.php',
     316    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Profile_Reader' => $baseDir . '/Modules/Sign_In_With_Google/Profile_Reader.php',
     317    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Profile_Reader_Interface' => $baseDir . '/Modules/Sign_In_With_Google/Profile_Reader_Interface.php',
    309318    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Settings' => $baseDir . '/Modules/Sign_In_With_Google/Settings.php',
    310319    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Tag_Matchers' => $baseDir . '/Modules/Sign_In_With_Google/Tag_Matchers.php',
  • google-site-kit/tags/1.141.0/readme.txt

    r3191565 r3201134  
    55Tested up to:      6.7
    66Requires PHP:      7.4
    7 Stable tag:        1.140.0
     7Stable tag:        1.141.0
    88License:           Apache License 2.0
    99License URI:       https://www.apache.org/licenses/LICENSE-2.0
     
    110110== Changelog ==
    111111
    112 = 1.140.0 =
     112= 1.141.0 =
    113113
    114114**Added**
    115115
    116 * Add Sign in with Google to Site Health. See [#9571](https://github.com/google/site-kit-wp/issues/9571).
    117 * Add new feature notification for Sign in with Google module. See [#9335](https://github.com/google/site-kit-wp/issues/9335).
     116* Add Sign in with Google to WooCommerce login page. See [#9340](https://github.com/google/site-kit-wp/issues/9340).
    118117
    119118**Enhanced**
    120119
    121 * Add a survey to be triggered when audience groups are set up. See [#9656](https://github.com/google/site-kit-wp/issues/9656).
    122 * Update styles for the admin settings. See [#9580](https://github.com/google/site-kit-wp/issues/9580).
    123 * Add GA event tracking for user interactions with the Audience Segmentation Setup in the Settings section. See [#9499](https://github.com/google/site-kit-wp/issues/9499).
    124 * Add opt-in event tracking for the Audience Segmentation introductory popup/banner. See [#9498](https://github.com/google/site-kit-wp/issues/9498).
    125 * Add GA event tracking for user interactions with the Audience Selection Panel. See [#9497](https://github.com/google/site-kit-wp/issues/9497).
    126 * Add opt-in user activity tracking in the audience tiles area. See [#9494](https://github.com/google/site-kit-wp/issues/9494).
    127 * Add opt-in user activity tracking in the audience setup CTA widget and related setting areas. See [#9493](https://github.com/google/site-kit-wp/issues/9493).
    128 * Don't unnecessarily render the Key Metrics Selection Panel into the DOM. See [#9468](https://github.com/google/site-kit-wp/issues/9468).
    129 * Add a stub survey trigger that is called when viewing the Reader Revenue Manager Setup CTA. See [#9447](https://github.com/google/site-kit-wp/issues/9447).
    130 * Update the widget area renderer to accept React components for subtitles. See [#9444](https://github.com/google/site-kit-wp/issues/9444).
    131 * Add modal of tailored metrics to User Input Questionnaire. See [#9439](https://github.com/google/site-kit-wp/issues/9439).
    132 * Add confirmation modal for users changing key metrics. See [#9438](https://github.com/google/site-kit-wp/issues/9438).
    133 * Add support for lost events to Conversion Reporting events datastore. See [#9379](https://github.com/google/site-kit-wp/issues/9379).
    134 * Add a new "Chip Tab Group" component. See [#9378](https://github.com/google/site-kit-wp/issues/9378).
    135 * Add new notification to Key Metrics Widget Settings Area. See [#9344](https://github.com/google/site-kit-wp/issues/9344).
    136 * Implement the Sign in with Google callback action. See [#9338](https://github.com/google/site-kit-wp/issues/9338).
    137 * Fix a bug that prevented the appearance of the Reader Revenue Manager setup banner graphic. See [#9329](https://github.com/google/site-kit-wp/issues/9329).
    138 * Include a "Learn more" link on the Reader Revenue Manager setup screen shown when the user doesn't have an existing publication. See [#9259](https://github.com/google/site-kit-wp/issues/9259).
     120* Update Sign in with Google descriptions in Site Health. See [#9680](https://github.com/google/site-kit-wp/issues/9680).
     121* Update the Sign in with Google login to use the popup approach. See [#9677](https://github.com/google/site-kit-wp/issues/9677).
     122* Integrate the First-party mode proxy script that will allow Analytics events to be tracked via requests made from the browser to the user's site rather than directly to Google's servers. See [#9665](https://github.com/google/site-kit-wp/issues/9665).
     123* Add info to the "One-tap" option in Sign in with Google settings. See [#9643](https://github.com/google/site-kit-wp/issues/9643).
     124* Do not show "Maybe later" in Key Metrics Admin Settings callout banner. See [#9636](https://github.com/google/site-kit-wp/issues/9636).
     125* Implement the `fetchGetFPMServerRequirementStatus()` Redux action used to retrieve the FPM server requirement status. See [#9634](https://github.com/google/site-kit-wp/issues/9634).
     126* Add an `fpm-server-requirement-status` API endpoint to verify First-Party Mode readiness by performing FPFE health checks and verifying direct PHP script access. See [#9632](https://github.com/google/site-kit-wp/issues/9632).
     127* Add a partial datastore for First-Party Mode in the `core/site` datastore to manage its settings. See [#9628](https://github.com/google/site-kit-wp/issues/9628).
     128* Add REST endpoints for First-Party Mode module settings. See [#9625](https://github.com/google/site-kit-wp/issues/9625).
     129* Update "Get your Client ID" link in Sign in with Google setup. See [#9621](https://github.com/google/site-kit-wp/issues/9621).
     130* Ensure tailored metrics override previous metrics when switching from manually-selected metrics. See [#9613](https://github.com/google/site-kit-wp/issues/9613).
     131* Improve the accuracy of the mechanism that scrolls the user to a widget area. See [#9603](https://github.com/google/site-kit-wp/issues/9603).
     132* Improve visitor groups selection panel to prevent a console warning. See [#9602](https://github.com/google/site-kit-wp/issues/9602).
     133* Add an external icon to external links in the audience selection panel and placeholder tile. See [#9598](https://github.com/google/site-kit-wp/issues/9598).
     134* Remove visitor groups setup success notifications when the user chooses not to display visitor groups in dashboard. See [#9596](https://github.com/google/site-kit-wp/issues/9596).
     135* Introduce grouping of notification queues. See [#9568](https://github.com/google/site-kit-wp/issues/9568).
     136* Add notice for users who used a legacy answer in Key Metrics settings. See [#9518](https://github.com/google/site-kit-wp/issues/9518).
     137* Split the "Sell products or services" answer in the User Input app. See [#9489](https://github.com/google/site-kit-wp/issues/9489).
     138* Persist selection group in Key Metrics selection panel. See [#9385](https://github.com/google/site-kit-wp/issues/9385).
     139* Add support for disconnecting associated Google account for sign in from WordPress user edit screen. See [#9380](https://github.com/google/site-kit-wp/issues/9380).
     140* Implement new subtle notification banner in KMW dashboard area. See [#9371](https://github.com/google/site-kit-wp/issues/9371).
     141* Move on-demand onboarding state synchronization to the server side, avoiding the need to reload the full list of publications. See [#9363](https://github.com/google/site-kit-wp/issues/9363).
     142* Improve selection panels so that they perform actions only when in view. See [#9312](https://github.com/google/site-kit-wp/issues/9312).
     143* Improve Reader Revenue Manager publication onboarding state synchronization. See [#9149](https://github.com/google/site-kit-wp/issues/9149).
     144* Add Key Metrics info to Site Health report. See [#9112](https://github.com/google/site-kit-wp/issues/9112).
     145
     146**Changed**
     147
     148* Implement settings view for Sign in with Google. See [#9477](https://github.com/google/site-kit-wp/issues/9477).
     149* Implement Sign in with Google token response login handling. See [#9339](https://github.com/google/site-kit-wp/issues/9339).
    139150
    140151**Fixed**
    141152
    142 * Only place the Reader Revenue Manager snippet on singular WordPress posts. See [#9670](https://github.com/google/site-kit-wp/issues/9670).
    143 * Fix typo in Key Metrics Widget. See [#9614](https://github.com/google/site-kit-wp/issues/9614).
    144 * Fix the issue where an extra "Failed to enable metric" modal appears when canceled in the Audience Segmentation "Top Content" custom dimension creation flow. See [#9563](https://github.com/google/site-kit-wp/issues/9563).
    145 * Fix dashboard error when selecting specific key metrics on the view-only dashboard. See [#9548](https://github.com/google/site-kit-wp/issues/9548).
    146 * Remove the “Temporarily hidden” badge when temporarily hidden tiles reappear with only a single tile visible. See [#9472](https://github.com/google/site-kit-wp/issues/9472).
    147 * Ensure "Add a metric" tiles are always visible on the view-only dashboard when fewer than 4 metrics are available or fewer than 8 metrics if the `conversionReporting` feature flag is enabled. See [#8712](https://github.com/google/site-kit-wp/issues/8712).
     153* Fix a bug that caused a custom dimension to not be created while setting up visitor groups. See [#9597](https://github.com/google/site-kit-wp/issues/9597).
    148154
    149155[See changelog for all versions](https://raw.githubusercontent.com/google/site-kit-wp/main/changelog.txt).
  • google-site-kit/trunk/dist/manifest.php

    r3191565 r3201134  
    1919    'analytics-advanced-tracking'                          => array( "analytics-advanced-tracking-ea84b2c367b69f5c094b.js", null ),
    2020    'googlesitekit-i18n'                                   => array( "googlesitekit-i18n-33cdd2dee5d1d1f4fb34.js", null ),
    21     'googlesitekit-admin-css'                              => array( "googlesitekit-admin-css-436096755512e44a2180.min.css", null ),
     21    'googlesitekit-admin-css'                              => array( "googlesitekit-admin-css-c7c4e28ef467fa74720d.min.css", null ),
    2222    'googlesitekit-adminbar-css'                           => array( "googlesitekit-adminbar-css-6db776544b37175be17f.min.css", null ),
    2323    'googlesitekit-authorize-application-css'              => array( "googlesitekit-authorize-application-css-ce25e97404abc5a02921.min.css", null ),
    2424    'googlesitekit-wp-dashboard-css'                       => array( "googlesitekit-wp-dashboard-css-c5417a27cb905717f9fc.min.css", null ),
    25     'googlesitekit-vendor'                                 => array( "googlesitekit-vendor-a19e0d3a9785a4679814.js", null ),
    26     'googlesitekit-runtime'                                => array( "runtime-ac7cb3123d0c92a4c83a.js", null ),
    27     'googlesitekit-activation'                             => array( "googlesitekit-activation-86e820f351b221f65654.js", null ),
    28     'googlesitekit-ad-blocking-recovery'                   => array( "googlesitekit-ad-blocking-recovery-35406f6b97f89119cba2.js", null ),
    29     'googlesitekit-adminbar'                               => array( "googlesitekit-adminbar-2aa4217dc92c2c92519c.js", null ),
    30     'googlesitekit-api'                                    => array( "googlesitekit-api-63e0255bae8c37401ba1.js", null ),
    31     'googlesitekit-components'                             => array( array( "googlesitekit-components-gm2-888e11c2f889b3818fac.js", null ), array( "googlesitekit-components-gm3-6f888313ed0d8623cf0e.js", null ) ),
    32     'googlesitekit-data'                                   => array( "googlesitekit-data-9b04ce04845587d08ef9.js", null ),
    33     'googlesitekit-datastore-forms'                        => array( "googlesitekit-datastore-forms-f38e139a09c823fd80b9.js", null ),
    34     'googlesitekit-datastore-location'                     => array( "googlesitekit-datastore-location-1e7b4e4c0f10376ae735.js", null ),
    35     'googlesitekit-datastore-site'                         => array( "googlesitekit-datastore-site-b48fcdc028f30543c49a.js", null ),
    36     'googlesitekit-datastore-ui'                           => array( "googlesitekit-datastore-ui-fbeb338baf423fe10a9a.js", null ),
    37     'googlesitekit-datastore-user'                         => array( "googlesitekit-datastore-user-8525155abe6c24a6b6e4.js", null ),
    38     'googlesitekit-entity-dashboard'                       => array( "googlesitekit-entity-dashboard-c2c8cb7c5a812c7ef92b.js", null ),
    39     'googlesitekit-main-dashboard'                         => array( "googlesitekit-main-dashboard-4a22bdd52eac618bdba0.js", null ),
    40     'googlesitekit-modules'                                => array( "googlesitekit-modules-f137613a7b6e587d2f09.js", null ),
    41     'googlesitekit-modules-ads'                            => array( "googlesitekit-modules-ads-8294c3788d693c1aa4d1.js", null ),
    42     'googlesitekit-modules-adsense'                        => array( "googlesitekit-modules-adsense-86be7f15c8ab18f2c8c2.js", null ),
    43     'googlesitekit-modules-analytics-4'                    => array( "googlesitekit-modules-analytics-4-fb3e6466670e9fe98540.js", null ),
    44     'googlesitekit-modules-pagespeed-insights'             => array( "googlesitekit-modules-pagespeed-insights-c88ecf4fb9fabd4b00ce.js", null ),
    45     'googlesitekit-modules-reader-revenue-manager'         => array( "googlesitekit-modules-reader-revenue-manager-0aca4740f1f170a04318.js", null ),
    46     'googlesitekit-modules-search-console'                 => array( "googlesitekit-modules-search-console-338c440d2a515b691bf2.js", null ),
    47     'googlesitekit-modules-sign-in-with-google'            => array( "googlesitekit-modules-sign-in-with-google-56b980cf11ec18bc46e7.js", null ),
    48     'googlesitekit-modules-tagmanager'                     => array( "googlesitekit-modules-tagmanager-a9c1650ad917dc777a4f.js", null ),
    49     'googlesitekit-notifications'                          => array( "googlesitekit-notifications-e491c3e66473a45eb37c.js", null ),
    50     'googlesitekit-polyfills'                              => array( "googlesitekit-polyfills-b3b20bb6f4276a648085.js", null ),
    51     'googlesitekit-settings'                               => array( "googlesitekit-settings-516d574e9df74fe6b81f.js", null ),
    52     'googlesitekit-splash'                                 => array( "googlesitekit-splash-30e76c65a9e86b793d44.js", null ),
    53     'googlesitekit-user-input'                             => array( "googlesitekit-user-input-ebc5e165960a36731c7f.js", null ),
    54     'googlesitekit-widgets'                                => array( "googlesitekit-widgets-c2422864a9b59a9a6def.js", null ),
    55     'googlesitekit-wp-dashboard'                           => array( "googlesitekit-wp-dashboard-a24f18cd5f1c8dae446d.js", null ),
     25    'googlesitekit-vendor'                                 => array( "googlesitekit-vendor-56e09129c0c5da07a38b.js", null ),
     26    'googlesitekit-runtime'                                => array( "runtime-28f15eb6ca67d1a2d920.js", null ),
     27    'googlesitekit-activation'                             => array( "googlesitekit-activation-f250ffdb179ce67acd13.js", null ),
     28    'googlesitekit-ad-blocking-recovery'                   => array( "googlesitekit-ad-blocking-recovery-f6e2202aedc4b9dec80a.js", null ),
     29    'googlesitekit-adminbar'                               => array( "googlesitekit-adminbar-309ccca4cdd85f61e57c.js", null ),
     30    'googlesitekit-api'                                    => array( "googlesitekit-api-51477bf3a499de73c6b0.js", null ),
     31    'googlesitekit-components'                             => array( array( "googlesitekit-components-gm2-d1deb8243b7fe27ddfd3.js", null ), array( "googlesitekit-components-gm3-26d6f652a561407fc1d9.js", null ) ),
     32    'googlesitekit-data'                                   => array( "googlesitekit-data-e2d57f0d3e8cbcde4f77.js", null ),
     33    'googlesitekit-datastore-forms'                        => array( "googlesitekit-datastore-forms-d673eb18908574ac23e4.js", null ),
     34    'googlesitekit-datastore-location'                     => array( "googlesitekit-datastore-location-b2b133386452785f40cd.js", null ),
     35    'googlesitekit-datastore-site'                         => array( "googlesitekit-datastore-site-d81c0033927d3f14fb1a.js", null ),
     36    'googlesitekit-datastore-ui'                           => array( "googlesitekit-datastore-ui-bca078eceaaa8c87948d.js", null ),
     37    'googlesitekit-datastore-user'                         => array( "googlesitekit-datastore-user-c9aee053073946d82bc6.js", null ),
     38    'googlesitekit-entity-dashboard'                       => array( "googlesitekit-entity-dashboard-909580c1ad26533618a7.js", null ),
     39    'googlesitekit-main-dashboard'                         => array( "googlesitekit-main-dashboard-00725d6f8918d582c7be.js", null ),
     40    'googlesitekit-modules'                                => array( "googlesitekit-modules-eeec4132d38e98b7da80.js", null ),
     41    'googlesitekit-modules-ads'                            => array( "googlesitekit-modules-ads-8fc1dc559868da9f2c36.js", null ),
     42    'googlesitekit-modules-adsense'                        => array( "googlesitekit-modules-adsense-e7fb25a5bd63d8fcdd08.js", null ),
     43    'googlesitekit-modules-analytics-4'                    => array( "googlesitekit-modules-analytics-4-f382f0563523da5f8023.js", null ),
     44    'googlesitekit-modules-pagespeed-insights'             => array( "googlesitekit-modules-pagespeed-insights-ac9df42867d70783b841.js", null ),
     45    'googlesitekit-modules-reader-revenue-manager'         => array( "googlesitekit-modules-reader-revenue-manager-fbbb8a6b54f8e8e6c506.js", null ),
     46    'googlesitekit-modules-search-console'                 => array( "googlesitekit-modules-search-console-7ef9910074ab8c22bab3.js", null ),
     47    'googlesitekit-modules-sign-in-with-google'            => array( "googlesitekit-modules-sign-in-with-google-5438d79c1a357d5f1552.js", null ),
     48    'googlesitekit-modules-tagmanager'                     => array( "googlesitekit-modules-tagmanager-7c01bc6dc43a4de58a7e.js", null ),
     49    'googlesitekit-notifications'                          => array( "googlesitekit-notifications-990bda6838a2b33db477.js", null ),
     50    'googlesitekit-polyfills'                              => array( "googlesitekit-polyfills-2ca995545dced5490968.js", null ),
     51    'googlesitekit-settings'                               => array( "googlesitekit-settings-3d397e7aeec169a6f6f7.js", null ),
     52    'googlesitekit-splash'                                 => array( "googlesitekit-splash-77f274ec773bb062bf6b.js", null ),
     53    'googlesitekit-user-input'                             => array( "googlesitekit-user-input-f2a4eab971b7ec745147.js", null ),
     54    'googlesitekit-widgets'                                => array( "googlesitekit-widgets-870e0a6fad71d1353b97.js", null ),
     55    'googlesitekit-wp-dashboard'                           => array( "googlesitekit-wp-dashboard-d26ef36f87825368c95d.js", null ),
    5656);
  • google-site-kit/trunk/google-site-kit.php

    r3191565 r3201134  
    1212 * Plugin URI:        https://sitekit.withgoogle.com
    1313 * Description:       Site Kit is a one-stop solution for WordPress users to use everything Google has to offer to make them successful on the web.
    14  * Version:           1.140.0
     14 * Version:           1.141.0
    1515 * Requires at least: 5.2
    1616 * Requires PHP:      7.4
     
    2727
    2828// Define most essential constants.
    29 define( 'GOOGLESITEKIT_VERSION', '1.140.0' );
     29define( 'GOOGLESITEKIT_VERSION', '1.141.0' );
    3030define( 'GOOGLESITEKIT_PLUGIN_MAIN_FILE', __FILE__ );
    3131define( 'GOOGLESITEKIT_PHP_MINIMUM', '7.4.0' );
  • google-site-kit/trunk/includes/Core/Assets/Assets.php

    r3148853 r3201134  
    731731
    732732        $inline_data = array(
    733             'homeURL'          => trailingslashit( $this->context->get_canonical_home_url() ),
    734             'referenceSiteURL' => esc_url_raw( trailingslashit( $site_url ) ),
    735             'adminURL'         => esc_url_raw( trailingslashit( admin_url() ) ),
    736             'assetsURL'        => esc_url_raw( $this->context->url( 'dist/assets/' ) ),
    737             'widgetsAdminURL'  => esc_url_raw( $this->get_widgets_admin_url() ),
    738             'blogPrefix'       => $wpdb->get_blog_prefix(),
    739             'ampMode'          => $this->context->get_amp_mode(),
    740             'isNetworkMode'    => $this->context->is_network_mode(),
    741             'timezone'         => get_option( 'timezone_string' ),
    742             'siteName'         => wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ),
    743             'enabledFeatures'  => Feature_Flags::get_enabled_features(),
    744             'webStoriesActive' => defined( 'WEBSTORIES_VERSION' ),
    745             'postTypes'        => $this->get_post_types(),
    746             'storagePrefix'    => $this->get_storage_prefix(),
    747             'referenceDate'    => apply_filters( 'googlesitekit_reference_date', null ),
    748             'productPostType'  => $this->get_product_post_type(),
     733            'homeURL'           => trailingslashit( $this->context->get_canonical_home_url() ),
     734            'referenceSiteURL'  => esc_url_raw( trailingslashit( $site_url ) ),
     735            'adminURL'          => esc_url_raw( trailingslashit( admin_url() ) ),
     736            'assetsURL'         => esc_url_raw( $this->context->url( 'dist/assets/' ) ),
     737            'widgetsAdminURL'   => esc_url_raw( $this->get_widgets_admin_url() ),
     738            'blogPrefix'        => $wpdb->get_blog_prefix(),
     739            'ampMode'           => $this->context->get_amp_mode(),
     740            'isNetworkMode'     => $this->context->is_network_mode(),
     741            'timezone'          => get_option( 'timezone_string' ),
     742            'siteName'          => wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ),
     743            'enabledFeatures'   => Feature_Flags::get_enabled_features(),
     744            'webStoriesActive'  => defined( 'WEBSTORIES_VERSION' ),
     745            'postTypes'         => $this->get_post_types(),
     746            'storagePrefix'     => $this->get_storage_prefix(),
     747            'referenceDate'     => apply_filters( 'googlesitekit_reference_date', null ),
     748            'productPostType'   => $this->get_product_post_type(),
     749            'anyoneCanRegister' => (bool) get_option( 'users_can_register' ),
    749750        );
    750751
  • google-site-kit/trunk/includes/Core/Consent_Mode/Consent_Mode.php

    r3127664 r3201134  
    1414use Google\Site_Kit\Core\Assets\Script;
    1515use Google\Site_Kit\Core\Storage\Options;
     16use Google\Site_Kit\Core\Util\BC_Functions;
    1617use Google\Site_Kit\Core\Util\Method_Proxy_Trait;
    1718use Plugin_Upgrader;
     
    232233        // The core Consent Mode code is in assets/js/consent-mode/consent-mode.js.
    233234        // Only code that passes data from PHP to JS should be in this file.
    234         ?>
    235 <!-- <?php echo esc_html__( 'Google tag (gtag.js) Consent Mode dataLayer added by Site Kit', 'google-site-kit' ); ?> -->
    236 <script id='google_gtagjs-js-consent-mode-data-layer'>
    237 window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}
    238 gtag('consent', 'default', <?php echo wp_json_encode( $consent_defaults ); ?>);
    239 window._googlesitekitConsentCategoryMap = <?php echo wp_json_encode( $consent_category_map ); ?>;
    240 window._googlesitekitConsents = <?php echo wp_json_encode( $consent_defaults ); ?>
    241 </script>
    242 <!-- <?php echo esc_html__( 'End Google tag (gtag.js) Consent Mode dataLayer added by Site Kit', 'google-site-kit' ); ?> -->
    243             <?php
     235        printf( "<!-- %s -->\n", esc_html__( 'Google tag (gtag.js) Consent Mode dataLayer added by Site Kit', 'google-site-kit' ) );
     236        BC_Functions::wp_print_inline_script_tag(
     237            join(
     238                "\n",
     239                array(
     240                    'window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}',
     241                    sprintf( "gtag('consent', 'default', %s);", wp_json_encode( $consent_defaults ) ),
     242                    sprintf( 'window._googlesitekitConsentCategoryMap = %s;', wp_json_encode( $consent_category_map ) ),
     243                    sprintf( 'window._googlesitekitConsents = %s;', wp_json_encode( $consent_defaults ) ),
     244                )
     245            ),
     246            array( 'id' => 'google_gtagjs-js-consent-mode-data-layer' )
     247        );
     248        printf( "<!-- %s -->\n", esc_html__( 'End Google tag (gtag.js) Consent Mode dataLayer added by Site Kit', 'google-site-kit' ) );
    244249    }
    245250
  • google-site-kit/trunk/includes/Core/Key_Metrics/REST_Key_Metrics_Controller.php

    r3173125 r3201134  
    185185                )
    186186            ),
     187            new REST_Route(
     188                'core/user/data/reset-key-metrics-selection',
     189                array(
     190                    'methods'             => WP_REST_Server::CREATABLE,
     191                    'callback'            => function () {
     192                        $this->settings->merge( array( 'widgetSlugs' => array() ) );
     193
     194                        return new WP_REST_Response( $this->settings->get() );
     195                    },
     196                    'permission_callback' => $has_capabilities,
     197                )
     198            ),
    187199        );
    188200    }
  • google-site-kit/trunk/includes/Core/Site_Health/Debug_Data.php

    r3156474 r3201134  
    1515use Google\Site_Kit\Core\Authentication\Clients\OAuth_Client;
    1616use Google\Site_Kit\Core\Conversion_Tracking\Conversion_Tracking;
     17use Google\Site_Kit\Core\Key_Metrics\Key_Metrics_Settings;
     18use Google\Site_Kit\Core\Key_Metrics\Key_Metrics_Setup_Completed_By;
    1719use Google\Site_Kit\Core\Modules\Module;
    1820use Google\Site_Kit\Core\Modules\Module_With_Debug_Fields;
     
    196198        $fields = array_merge( $fields, $this->get_consent_mode_fields() );
    197199        $fields = array_merge( $fields, $this->get_module_sharing_settings_fields() );
     200        $fields = array_merge( $fields, $this->get_key_metrics_fields() );
    198201
    199202        $fields = array_filter(
     
    416419                array(
    417420                    /* translators: %s: module name */
    418                     'label' => sprintf( __( '%s Shared Roles', 'google-site-kit' ), $module->name ),
     421                    'label' => sprintf( __( '%s: Shared Roles', 'google-site-kit' ), $module->name ),
    419422                ),
    420423                $this->get_module_shared_role_names( $module_settings['sharedRoles'] )
     
    424427                array(
    425428                    /* translators: %s: module name */
    426                     'label' => sprintf( __( '%s Management', 'google-site-kit' ), $module->name ),
     429                    'label' => sprintf( __( '%s: Management', 'google-site-kit' ), $module->name ),
    427430                ),
    428431                $this->get_module_management( $module_settings['management'] )
     
    639642        );
    640643    }
     644
     645    /**
     646     * Gets the key metrics status fields.
     647     *
     648     * @since 1.141.0
     649     *
     650     * @return array
     651     */
     652    private function get_key_metrics_fields() {
     653        $is_setup_complete    = ( new Key_Metrics_Setup_Completed_By( $this->options ) )->get();
     654        $key_metrics_settings = ( new Key_Metrics_Settings( $this->user_options ) )->get();
     655
     656        if ( ! $is_setup_complete ) {
     657            return array(
     658                'key_metrics_status' => array(
     659                    'label' => __( 'Key Metrics Status', 'google-site-kit' ),
     660                    'value' => __( 'Not setup', 'google-site-kit' ),
     661                ),
     662            );
     663        }
     664
     665        $key_metrics_status = isset( $key_metrics_settings['isWidgetHidden'] ) && $key_metrics_settings['isWidgetHidden'] ?
     666            __( 'Setup and Disabled', 'google-site-kit' ) :
     667            __( 'Setup and Enabled', 'google-site-kit' );
     668
     669        // A minimum of 2 key metrics need to be saved to prevent "default" tailored metrics to render.
     670        $key_metrics_source = isset( $key_metrics_settings['widgetSlugs'] ) && count( $key_metrics_settings['widgetSlugs'] ) > 1 ?
     671            __( 'Manual Selection', 'google-site-kit' ) :
     672            __( 'Tailored Metrics', 'google-site-kit' );
     673
     674        return array(
     675            'key_metrics_status' => array(
     676                'label' => __( 'Key Metrics Status', 'google-site-kit' ),
     677                'value' => $key_metrics_status,
     678            ),
     679            'key_metrics_source' => array(
     680                'label' => __( 'Key Metrics Source', 'google-site-kit' ),
     681                'value' => $key_metrics_source,
     682            ),
     683        );
     684    }
    641685}
  • google-site-kit/trunk/includes/Modules/AdSense.php

    r3118692 r3201134  
    230230        return array(
    231231            'adsense_account_id'                       => array(
    232                 'label' => __( 'AdSense account ID', 'google-site-kit' ),
     232                'label' => __( 'AdSense: Account ID', 'google-site-kit' ),
    233233                'value' => $settings['accountID'],
    234234                'debug' => Debug_Data::redact_debug_value( $settings['accountID'], 7 ),
    235235            ),
    236236            'adsense_client_id'                        => array(
    237                 'label' => __( 'AdSense client ID', 'google-site-kit' ),
     237                'label' => __( 'AdSense: Client ID', 'google-site-kit' ),
    238238                'value' => $settings['clientID'],
    239239                'debug' => Debug_Data::redact_debug_value( $settings['clientID'], 10 ),
    240240            ),
    241241            'adsense_account_status'                   => array(
    242                 'label' => __( 'AdSense account status', 'google-site-kit' ),
     242                'label' => __( 'AdSense: Account status', 'google-site-kit' ),
    243243                'value' => $settings['accountStatus'],
    244244            ),
    245245            'adsense_site_status'                      => array(
    246                 'label' => __( 'AdSense site status', 'google-site-kit' ),
     246                'label' => __( 'AdSense: Site status', 'google-site-kit' ),
    247247                'value' => $settings['siteStatus'],
    248248            ),
    249249            'adsense_use_snippet'                      => array(
    250                 'label' => __( 'AdSense snippet placed', 'google-site-kit' ),
     250                'label' => __( 'AdSense: Snippet placed', 'google-site-kit' ),
    251251                'value' => $settings['useSnippet'] ? __( 'Yes', 'google-site-kit' ) : __( 'No', 'google-site-kit' ),
    252252                'debug' => $settings['useSnippet'] ? 'yes' : 'no',
    253253            ),
    254254            'adsense_web_stories_adunit_id'            => array(
    255                 'label' => __( 'Web Stories Ad Unit ID', 'google-site-kit' ),
     255                'label' => __( 'AdSense: Web Stories Ad Unit ID', 'google-site-kit' ),
    256256                'value' => $settings['webStoriesAdUnit'],
    257257                'debug' => $settings['webStoriesAdUnit'],
    258258            ),
    259259            'adsense_setup_completed_timestamp'        => array(
    260                 'label' => __( 'AdSense setup completed at', 'google-site-kit' ),
     260                'label' => __( 'AdSense: Setup completed at', 'google-site-kit' ),
    261261                'value' => $settings['setupCompletedTimestamp'] ? date_i18n(
    262262                    get_option( 'date_format' ),
     
    267267            'adsense_abr_use_snippet'                  => array(
    268268                'label' => __(
    269                     'Ad Blocking Recovery snippet placed',
     269                    'AdSense: Ad Blocking Recovery snippet placed',
    270270                    'google-site-kit'
    271271                ),
     
    275275            'adsense_abr_use_error_protection_snippet' => array(
    276276                'label' => __(
    277                     'Ad Blocking Recovery error protection snippet placed',
     277                    'AdSense: Ad Blocking Recovery error protection snippet placed',
    278278                    'google-site-kit'
    279279                ),
     
    283283            'adsense_abr_setup_status'                 => array(
    284284                'label' => __(
    285                     'Ad Blocking Recovery setup status',
     285                    'AdSense: Ad Blocking Recovery setup status',
    286286                    'google-site-kit'
    287287                ),
  • google-site-kit/trunk/includes/Modules/Ads.php

    r3173125 r3201134  
    310310        return array(
    311311            'ads_conversion_tracking_id' => array(
    312                 'label' => __( 'Ads Conversion Tracking ID', 'google-site-kit' ),
     312                'label' => __( 'Ads: Conversion Tracking ID', 'google-site-kit' ),
    313313                'value' => $settings['conversionID'],
    314314                'debug' => Debug_Data::redact_debug_value( $settings['conversionID'] ),
  • google-site-kit/trunk/includes/Modules/Analytics_4.php

    r3181737 r3201134  
    506506        $debug_fields = array(
    507507            'analytics_4_account_id'                  => array(
    508                 'label' => __( 'Analytics account ID', 'google-site-kit' ),
     508                'label' => __( 'Analytics: Account ID', 'google-site-kit' ),
    509509                'value' => $settings['accountID'],
    510510                'debug' => Debug_Data::redact_debug_value( $settings['accountID'] ),
    511511            ),
    512512            'analytics_4_property_id'                 => array(
    513                 'label' => __( 'Analytics property ID', 'google-site-kit' ),
     513                'label' => __( 'Analytics: Property ID', 'google-site-kit' ),
    514514                'value' => $settings['propertyID'],
    515515                'debug' => Debug_Data::redact_debug_value( $settings['propertyID'], 7 ),
    516516            ),
    517517            'analytics_4_web_data_stream_id'          => array(
    518                 'label' => __( 'Analytics web data stream ID', 'google-site-kit' ),
     518                'label' => __( 'Analytics: Web Data Stream ID', 'google-site-kit' ),
    519519                'value' => $settings['webDataStreamID'],
    520520                'debug' => Debug_Data::redact_debug_value( $settings['webDataStreamID'] ),
    521521            ),
    522522            'analytics_4_measurement_id'              => array(
    523                 'label' => __( 'Analytics measurement ID', 'google-site-kit' ),
     523                'label' => __( 'Analytics: Measurement ID', 'google-site-kit' ),
    524524                'value' => $settings['measurementID'],
    525525                'debug' => Debug_Data::redact_debug_value( $settings['measurementID'] ),
    526526            ),
    527527            'analytics_4_use_snippet'                 => array(
    528                 'label' => __( 'Analytics snippet placed', 'google-site-kit' ),
     528                'label' => __( 'Analytics: Snippet placed', 'google-site-kit' ),
    529529                'value' => $settings['useSnippet'] ? __( 'Yes', 'google-site-kit' ) : __( 'No', 'google-site-kit' ),
    530530                'debug' => $settings['useSnippet'] ? 'yes' : 'no',
    531531            ),
    532532            'analytics_4_ads_conversion_id'           => array(
    533                 'label' => __( 'Analytics Ads conversion ID', 'google-site-kit' ),
     533                'label' => __( 'Analytics: Ads Conversion ID', 'google-site-kit' ),
    534534                'value' => $settings['adsConversionID'],
    535535                'debug' => Debug_Data::redact_debug_value( $settings['adsConversionID'] ),
    536536            ),
    537537            'analytics_4_available_custom_dimensions' => array(
    538                 'label' => __( 'Analytics available custom dimensions', 'google-site-kit' ),
     538                'label' => __( 'Analytics: Available Custom Dimensions', 'google-site-kit' ),
    539539                'value' => empty( $settings['availableCustomDimensions'] )
    540540                    ? __( 'None', 'google-site-kit' )
     
    549549            ),
    550550            'analytics_4_ads_linked'                  => array(
    551                 'label' => __( 'Analytics Ads Linked', 'google-site-kit' ),
     551                'label' => __( 'Analytics: Ads Linked', 'google-site-kit' ),
    552552                'value' => $settings['adsLinked'] ? __( 'Connected', 'google-site-kit' ) : __( 'Not connected', 'google-site-kit' ),
    553553                'debug' => $settings['adsLinked'],
    554554            ),
    555555            'analytics_4_ads_linked_last_synced_at'   => array(
    556                 'label' => __( 'Analytics Ads Linked Last Synced At', 'google-site-kit' ),
     556                'label' => __( 'Analytics: Ads Linked Last Synced At', 'google-site-kit' ),
    557557                'value' => $settings['adsLinkedLastSyncedAt'] ? gmdate( 'Y-m-d H:i:s', $settings['adsLinkedLastSyncedAt'] ) : __( 'Never synced', 'google-site-kit' ),
    558558                'debug' => $settings['adsLinkedLastSyncedAt'],
     
    562562        if ( $this->is_adsense_connected() ) {
    563563            $debug_fields['analytics_4_adsense_linked'] = array(
    564                 'label' => __( 'Analytics AdSense Linked', 'google-site-kit' ),
     564                'label' => __( 'Analytics: AdSense Linked', 'google-site-kit' ),
    565565                'value' => $settings['adSenseLinked'] ? __( 'Connected', 'google-site-kit' ) : __( 'Not connected', 'google-site-kit' ),
    566566                'debug' => Debug_Data::redact_debug_value( $settings['adSenseLinked'] ),
     
    568568
    569569            $debug_fields['analytics_4_adsense_linked_last_synced_at'] = array(
    570                 'label' => __( 'Analytics AdSense Linked Last Synced At', 'google-site-kit' ),
     570                'label' => __( 'Analytics: AdSense Linked Last Synced At', 'google-site-kit' ),
    571571                'value' => $settings['adSenseLinkedLastSyncedAt'] ? gmdate( 'Y-m-d H:i:s', $settings['adSenseLinkedLastSyncedAt'] ) : __( 'Never synced', 'google-site-kit' ),
    572572                'debug' => Debug_Data::redact_debug_value( $settings['adSenseLinkedLastSyncedAt'] ),
     
    580580
    581581            $debug_fields['analytics_4_site_kit_audiences'] = array(
    582                 'label' => __( 'Analytics site created audiences', 'google-site-kit' ),
     582                'label' => __( 'Analytics: Site created audiences', 'google-site-kit' ),
    583583                'value' => empty( $site_kit_audiences )
    584584                    ? __( 'None', 'google-site-kit' )
  • google-site-kit/trunk/includes/Modules/Reader_Revenue_Manager.php

    r3148853 r3201134  
    2929use Google\Site_Kit\Core\Modules\Module_With_Tag_Trait;
    3030use Google\Site_Kit\Core\REST_API\Data_Request;
     31use Google\Site_Kit\Core\REST_API\Exception\Missing_Required_Param_Exception;
    3132use Google\Site_Kit\Core\Site_Health\Debug_Data;
    3233use Google\Site_Kit\Core\Tags\Guards\Tag_Environment_Type_Guard;
     
    3435use Google\Site_Kit\Core\Util\URL;
    3536use Google\Site_Kit\Modules\Reader_Revenue_Manager\Settings;
     37use Google\Site_Kit\Modules\Reader_Revenue_Manager\Synchronize_OnboardingState;
    3638use Google\Site_Kit\Modules\Reader_Revenue_Manager\Tag_Guard;
    3739use Google\Site_Kit\Modules\Reader_Revenue_Manager\Tag_Matchers;
     
    6870        $this->register_scopes_hook();
    6971
     72        $synchronize_onboarding_state = new Synchronize_OnboardingState(
     73            $this,
     74            $this->user_options
     75        );
     76        $synchronize_onboarding_state->register();
     77
     78        add_action( 'load-toplevel_page_googlesitekit-dashboard', array( $synchronize_onboarding_state, 'maybe_schedule_synchronize_onboarding_state' ) );
     79        add_action( 'load-toplevel_page_googlesitekit-settings', array( $synchronize_onboarding_state, 'maybe_schedule_synchronize_onboarding_state' ) );
     80
    7081        // Reader Revenue Manager tag placement logic.
    7182        add_action( 'template_redirect', array( $this, 'register_tag' ) );
     
    192203    protected function get_datapoint_definitions() {
    193204        return array(
    194             'GET:publications' => array( 'service' => 'subscribewithgoogle' ),
     205            'GET:publications'                       => array(
     206                'service' => 'subscribewithgoogle',
     207            ),
     208            'POST:sync-publication-onboarding-state' => array(
     209                'service' => 'subscribewithgoogle',
     210            ),
    195211        );
    196212    }
     
    204220     * @return RequestInterface|callable|WP_Error Request object or callable on success, or WP_Error on failure.
    205221     *
    206      * @throws Invalid_Datapoint_Exception Thrown if the datapoint does not exist.
     222     * @throws Invalid_Datapoint_Exception|Missing_Required_Param_Exception Thrown if the datapoint does not exist or parameters are missing.
    207223     */
    208224    protected function create_data_request( Data_Request $data ) {
     
    216232                $subscribewithgoogle = $this->get_service( 'subscribewithgoogle' );
    217233                return $subscribewithgoogle->publications->listPublications( array( 'filter' => $this->get_publication_filter() ) );
     234
     235            case 'POST:sync-publication-onboarding-state':
     236                if ( empty( $data['publicationID'] ) ) {
     237                    throw new Missing_Required_Param_Exception( 'publicationID' );
     238                }
     239
     240                if ( empty( $data['publicationOnboardingState'] ) ) {
     241                    throw new Missing_Required_Param_Exception( 'publicationOnboardingState' );
     242                }
     243
     244                $publications = $this->get_data( 'publications' );
     245
     246                if ( is_wp_error( $publications ) ) {
     247                    return $publications;
     248                }
     249
     250                if ( empty( $publications ) ) {
     251                    return new WP_Error(
     252                        'publication_not_found',
     253                        __( 'Publication not found.', 'google-site-kit' ),
     254                        array( 'status' => 404 )
     255                    );
     256                }
     257
     258                $publication = array_filter(
     259                    $publications,
     260                    function ( $publication ) use ( $data ) {
     261                        return $publication->getPublicationId() === $data['publicationID'];
     262                    }
     263                );
     264
     265                if ( empty( $publication ) ) {
     266                    return new WP_Error(
     267                        'publication_not_found',
     268                        __( 'Publication not found.', 'google-site-kit' ),
     269                        array( 'status' => 404 )
     270                    );
     271                }
     272
     273                $publication          = reset( $publication );
     274                $new_onboarding_state = $publication->getOnboardingState();
     275
     276                if ( $new_onboarding_state === $data['publicationOnboardingState'] ) {
     277                    return function () {
     278                        return (object) array();
     279                    };
     280                }
     281
     282                $settings = $this->get_settings();
     283
     284                if ( $data['publicationID'] === $settings->get()['publicationID'] ) {
     285                    $settings->merge(
     286                        array(
     287                            'publicationOnboardingState' => $new_onboarding_state,
     288                        )
     289                    );
     290                }
     291
     292                return function () use ( $data, $new_onboarding_state ) {
     293                    return (object) array(
     294                        'publicationID'              => $data['publicationID'],
     295                        'publicationOnboardingState' => $new_onboarding_state,
     296                    );
     297                };
    218298        }
    219299
     
    373453        return array(
    374454            'reader_revenue_manager_publication_id' => array(
    375                 'label' => __( 'Reader Revenue Manager publication ID', 'google-site-kit' ),
     455                'label' => __( 'Reader Revenue Manager: Publication ID', 'google-site-kit' ),
    376456                'value' => $settings['publicationID'],
    377457                'debug' => Debug_Data::redact_debug_value( $settings['publicationID'] ),
    378458            ),
    379459            'reader_revenue_manager_publication_onboarding_state' => array(
    380                 'label' => __( 'Reader Revenue Manager publication onboarding state', 'google-site-kit' ),
     460                'label' => __( 'Reader Revenue Manager: Publication onboarding state', 'google-site-kit' ),
    381461                'value' => $settings['publicationOnboardingState'],
    382462                'debug' => $settings['publicationOnboardingState'],
    383463            ),
    384             'reader_revenue_manager_publication_onboarding_state_last_synced_at' => array(
    385                 'label' => __( 'Reader Revenue Manager publication onboarding state last synced at', 'google-site-kit' ),
    386                 'value' => $settings['publicationOnboardingStateLastSyncedAtMs'] ? gmdate( 'Y-m-d H:i:s', $settings['publicationOnboardingStateLastSyncedAtMs'] / 1000 ) : __( 'Never synced', 'google-site-kit' ),
    387                 'debug' => $settings['publicationOnboardingStateLastSyncedAtMs'],
    388             ),
    389464        );
    390465    }
  • google-site-kit/trunk/includes/Modules/Reader_Revenue_Manager/Settings.php

    r3134468 r3201134  
    7070    protected function get_default() {
    7171        return array(
    72             'ownerID'                                  => 0,
    73             'publicationID'                            => '',
    74             'publicationOnboardingState'               => '',
    75             'publicationOnboardingStateLastSyncedAtMs' => 0,
     72            'ownerID'                           => 0,
     73            'publicationID'                     => '',
     74            'publicationOnboardingState'        => '',
     75            'publicationOnboardingStateChanged' => false,
    7676        );
    7777    }
     
    103103            }
    104104
    105             if ( isset( $option['publicationOnboardingStateLastSyncedAtMs'] ) ) {
    106                 if ( ! is_int( $option['publicationOnboardingStateLastSyncedAtMs'] ) ) {
    107                     $option['publicationOnboardingStateLastSyncedAtMs'] = 0;
     105            if ( isset( $option['publicationOnboardingStateChanged'] ) ) {
     106                if ( ! is_bool( $option['publicationOnboardingStateChanged'] ) ) {
     107                    $option['publicationOnboardingStateChanged'] = false;
    108108                }
    109109            }
  • google-site-kit/trunk/includes/Modules/Search_Console.php

    r3148853 r3201134  
    166166        return array(
    167167            'search_console_property' => array(
    168                 'label' => __( 'Search Console property', 'google-site-kit' ),
     168                'label' => __( 'Search Console: Property', 'google-site-kit' ),
    169169                'value' => $this->get_property_id(),
    170170            ),
  • google-site-kit/trunk/includes/Modules/Sign_In_With_Google.php

    r3191565 r3201134  
    1111namespace Google\Site_Kit\Modules;
    1212
     13use Google\Site_Kit\Core\Assets\Asset;
    1314use Google\Site_Kit\Core\Assets\Script;
    1415use Google\Site_Kit\Core\Conversion_Tracking\Conversion_Event_Providers\WooCommerce;
     
    2324use Google\Site_Kit\Core\Modules\Module_With_Tag_Trait;
    2425use Google\Site_Kit\Core\Modules\Tags\Module_Tag_Matchers;
     26use Google\Site_Kit\Core\Permissions\Permissions;
    2527use Google\Site_Kit\Core\Site_Health\Debug_Data;
     28use Google\Site_Kit\Core\Storage\Options;
     29use Google\Site_Kit\Core\Storage\User_Options;
     30use Google\Site_Kit\Core\Util\BC_Functions;
    2631use Google\Site_Kit\Core\Util\Method_Proxy_Trait;
     32use Google\Site_Kit\Modules\Sign_In_With_Google\Authenticator;
     33use Google\Site_Kit\Modules\Sign_In_With_Google\Authenticator_Interface;
     34use Google\Site_Kit\Modules\Sign_In_With_Google\Hashed_User_ID;
     35use Google\Site_Kit\Modules\Sign_In_With_Google\Profile_Reader;
    2736use Google\Site_Kit\Modules\Sign_In_With_Google\Settings;
    2837use Google\Site_Kit\Modules\Sign_In_With_Google\Tag_Matchers;
    29 use Google\Site_Kit_Dependencies\Google_Client;
    3038use WP_Error;
     39use WP_User;
    3140
    3241/**
    33  * Class representing the Sign in With Google module.
     42 * Class representing the Sign in with Google module.
    3443 *
    3544 * @since 1.137.0
     
    5059
    5160    /**
     61     * Authentication action name.
     62     */
     63    const ACTION_AUTH = 'googlesitekit_auth';
     64
     65    /**
     66     * Disconnect action name.
     67     */
     68    const ACTION_DISCONNECT = 'googlesitekit_auth_disconnect';
     69
     70    /**
    5271     * Registers functionality through WordPress hooks.
    5372     *
    5473     * @since 1.137.0
     74     * @since 1.141.0 Add functionality to allow users to disconnect their own account and admins to disconnect any user.
    5575     */
    5676    public function register() {
    57         add_filter( 'wp_login_errors', array( $this, 'handle_google_auth_errors' ) );
    58 
    59         add_action( 'login_form_google_auth', array( $this, 'handle_google_auth' ) );
     77        add_filter( 'wp_login_errors', array( $this, 'handle_login_errors' ) );
     78
     79        add_action(
     80            'login_form_' . self::ACTION_AUTH,
     81            function () {
     82                $settings = $this->get_settings();
     83
     84                $profile_reader = new Profile_Reader( $settings );
     85                $authenticator  = new Authenticator( $this->user_options, $profile_reader );
     86
     87                $this->handle_auth_callback( $authenticator );
     88            }
     89        );
     90
     91        add_action( 'admin_action_' . self::ACTION_DISCONNECT, fn () => $this->handle_disconnect_user() );
     92
    6093        add_action( 'login_form', $this->get_method_proxy( 'render_signin_button' ) );
    61     }
    62 
    63     /**
    64      * Intercept the page request to process token ID
    65      * and complete Sign in with Google flow.
    66      *
    67      * @since 1.140.0
    68      */
    69     public function handle_google_auth() {
    70         $request_method = $this->context->input()->filter( INPUT_SERVER, 'REQUEST_METHOD' );
    71 
     94
     95        add_action( 'show_user_profile', $this->get_method_proxy( 'render_disconnect_profile' ) ); // This action shows the disconnect section on the users own profile page.
     96        add_action( 'edit_user_profile', $this->get_method_proxy( 'render_disconnect_profile' ) ); // This action shows the disconnect section on other users profile page to allow admins to disconnect others.
     97
     98        add_action( 'woocommerce_login_form_start', $this->get_method_proxy( 'render_signin_button' ) );
     99    }
     100
     101    /**
     102     * Handles the callback request after the user signs in with Google.
     103     *
     104     * @since 1.140.0
     105     *
     106     * @param Authenticator_Interface $authenticator Authenticator instance.
     107     */
     108    private function handle_auth_callback( Authenticator_Interface $authenticator ) {
     109        $input = $this->context->input();
     110
     111        // Ignore the request if the request method is not POST.
     112        $request_method = $input->filter( INPUT_SERVER, 'REQUEST_METHOD' );
    72113        if ( 'POST' !== $request_method ) {
    73114            return;
    74115        }
    75116
    76         $csrf_cookie = $this->context->input()->filter( INPUT_COOKIE, 'g_csrf_token' );
    77         $csrf_post   = $this->context->input()->filter( INPUT_POST, 'g_csrf_token' );
    78 
    79         if (
    80             ! $csrf_cookie ||
    81             ! $csrf_post ||
    82             $csrf_cookie !== $csrf_post
    83         ) {
    84             wp_safe_redirect( add_query_arg( 'error', 'google_auth_invalid_g_csrf_token', wp_login_url() ) );
    85             exit;
    86         }
    87 
    88         $client_id = $this->get_settings()->get()['clientID'];
    89         $id_token  = $this->context->input()->filter( INPUT_POST, 'credential' );
    90         try {
    91             $client  = new Google_Client( array( 'client_id' => $client_id ) );
    92             $payload = $client->verifyIdToken( $id_token );
    93 
    94             if ( empty( $payload ) ) {
    95                 wp_safe_redirect( add_query_arg( 'error', 'google_auth_invalid_request', wp_login_url() ) );
    96                 exit;
    97             }
    98 
    99             // @TODO implement further flow using $payload in #9339.
    100 
    101         } catch ( \Exception $e ) {
    102             wp_safe_redirect( add_query_arg( 'error', 'google_auth_invalid_request', wp_login_url() ) );
     117        $redirect_to = $authenticator->authenticate_user( $input );
     118        if ( ! empty( $redirect_to ) ) {
     119            wp_safe_redirect( $redirect_to );
    103120            exit;
    104121        }
     
    113130     * @return WP_Error $error WP_Error instance.
    114131     */
    115     public function handle_google_auth_errors( $error ) {
     132    public function handle_login_errors( $error ) {
    116133        $error_code = $this->context->input()->filter( INPUT_GET, 'error' );
    117134        if ( ! $error_code ) {
     
    120137
    121138        switch ( $error_code ) {
    122             case 'google_auth_invalid_request':
    123             case 'google_auth_invalid_g_csrf_token':
    124                 $error->add( 'google_auth', __( 'Sign in with Google failed.', 'google-site-kit' ) );
     139            case Authenticator::ERROR_INVALID_REQUEST:
     140                $error->add( self::MODULE_SLUG, __( 'Sign in with Google failed.', 'google-site-kit' ) );
     141                break;
     142            case Authenticator::ERROR_SIGNIN_FAILED:
     143                $error->add( self::MODULE_SLUG, __( 'The user is not registered on this site.', 'google-site-kit' ) );
    125144                break;
    126145            default:
     
    206225    public function is_connected() {
    207226        $options = $this->get_settings()->get();
    208 
    209227        if ( empty( $options['clientID'] ) ) {
    210228            return false;
     
    220238     */
    221239    private function render_signin_button() {
     240        global $wp;
     241        $is_woo_commerce_login = 'my-account' === $wp->request;
     242
    222243        $settings = $this->get_settings()->get();
    223244        if ( ! $settings['clientID'] ) {
     
    225246        }
    226247
    227         $redirect_url = add_query_arg( 'action', 'google_auth', wp_login_url() );
    228         if ( substr( $redirect_url, 0, 5 ) !== 'https' ) {
     248        $login_uri = add_query_arg( 'action', self::ACTION_AUTH, wp_login_url() );
     249        if ( substr( $login_uri, 0, 5 ) !== 'https' ) {
    229250            return;
    230251        }
    231252
     253        $redirect_to = $this->context->input()->filter( INPUT_GET, 'redirect_to' );
     254        if ( ! empty( $redirect_to ) ) {
     255            $redirect_to = trim( $redirect_to );
     256        }
     257
     258        $btn_args = array(
     259            'theme' => $settings['theme'],
     260            'text'  => $settings['text'],
     261            'shape' => $settings['shape'],
     262        );
     263
    232264        // Render the Sign in with Google button and related inline styles.
     265        printf( "\n<!-- %s -->\n", esc_html__( 'Sign in with Google button added by Site Kit', 'google-site-kit' ) );
     266        BC_Functions::wp_print_script_tag( array( 'src' => 'https://accounts.google.com/gsi/client' ) );
     267        ob_start();
    233268        ?>
    234 <!-- <?php echo esc_html__( 'Sign in with Google button added by Site Kit', 'google-site-kit' ); ?> -->
    235 <?php /* phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript */ ?>
    236 <script src="https://accounts.google.com/gsi/client"></script>
    237 <script>
    238269( () => {
    239     google.accounts.id.initialize({
     270    const parent = document.createElement( 'div' );
     271<?php if ( $is_woo_commerce_login ) : // phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect ?>
     272    document.getElementsByClassName( 'login' )[0]?.insertBefore( parent, document.getElementsByClassName( 'woocommerce-form-row' )[0] );
     273        <?php else : // phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect ?>
     274    document.getElementById( 'login' ).insertBefore( parent, document.getElementById( 'loginform' ) );
     275        <?php endif; // phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect ?>
     276
     277    async function handleCredentialResponse( response ) {
     278        try {
     279            const res = await fetch( '<?php echo esc_js( $login_uri ); ?>', {
     280                method: 'POST',
     281                headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
     282                body: new URLSearchParams( response )
     283            });
     284            if ( res.ok && res.redirected ) {
     285                location.assign( res.url );
     286            }
     287        } catch( error ) {
     288            console.error( error );
     289        }
     290    }
     291
     292    google.accounts.id.initialize( {
    240293        client_id: '<?php echo esc_js( $settings['clientID'] ); ?>',
    241         login_uri: '<?php echo esc_js( $redirect_url ); ?>',
    242         ux_mode: 'redirect',
    243     });
    244     const parent = document.createElement( 'div' );
    245     document.getElementById( 'login').insertBefore( parent, document.getElementById( 'loginform' ) );
    246     google.accounts.id.renderButton(parent, {
    247         theme: '<?php echo esc_js( $settings['theme'] ); ?>',
    248         text: '<?php echo esc_js( $settings['text'] ); ?>',
    249         shape: '<?php echo esc_js( $settings['shape'] ); ?>'
    250     });
     294        callback: handleCredentialResponse,
     295    } );
     296
     297    google.accounts.id.renderButton( parent, <?php echo wp_json_encode( $btn_args ); ?> );
     298
     299<?php if ( $settings['oneTapEnabled'] ) : // phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect ?>
     300    google.accounts.id.prompt();
     301        <?php endif; // phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect ?>
     302
     303<?php if ( ! empty( $redirect_to ) ) : // phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect ?>
     304    const expires = new Date();
     305    expires.setTime( expires.getTime() + 1000 * 60 * 5 );
     306    document.cookie = "<?php echo esc_js( Authenticator::COOKIE_REDIRECT_TO ); ?>=<?php echo esc_js( $redirect_to ); ?>;expires="  + expires.toUTCString() + ";path=<?php echo esc_js( Authenticator::get_cookie_path() ); ?>";
     307        <?php endif; // phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect ?>
    251308} )();
    252 </script>
    253 <!-- <?php echo esc_html__( 'End Sign in with Google button added by Site Kit', 'google-site-kit' ); ?> -->
    254309        <?php
     310        BC_Functions::wp_print_inline_script_tag( ob_get_clean() );
     311        printf( "\n<!-- %s -->\n", esc_html__( 'End Sign in with Google button added by Site Kit', 'google-site-kit' ) );
    255312    }
    256313
     
    260317     * @since 1.140.0
    261318     *
    262      * @return array
     319     * @return int
    263320     */
    264321    public function get_authenticated_users_count() {
    265322        global $wpdb;
    266323
    267         $settings = $this->get_settings();
    268324        // phpcs:ignore WordPress.DB.DirectDatabaseQuery
    269         return $wpdb->query(
    270             $wpdb->prepare( "SELECT count(id) FROM $wpdb->usermeta WHERE meta_key = %s", self::GOOGLE_USER_ID_OPTION )
     325        return (int) $wpdb->get_var(
     326            $wpdb->prepare(
     327                "SELECT COUNT( user_id ) FROM $wpdb->usermeta WHERE meta_key = %s",
     328                $this->user_options->get_meta_key( Hashed_User_ID::OPTION )
     329            )
    271330        );
    272331    }
     
    282341        $settings = $this->get_settings()->get();
    283342
    284         // TODO Uncomment and remove fixed value after #9339 is merged.
    285         // $authenticated_user_count = $this->get_authenticated_users_count();.
    286         $authenticated_user_count = 1;
     343        $authenticated_user_count = $this->get_authenticated_users_count();
    287344
    288345        $debug_fields = array(
    289346            'sign_in_with_google_client_id'                => array(
    290                 'label' => __( 'Sign in with Google Client ID', 'google-site-kit' ),
     347                'label' => __( 'Sign in with Google: Client ID', 'google-site-kit' ),
    291348                'value' => $settings['clientID'],
    292349                'debug' => Debug_Data::redact_debug_value( $settings['clientID'] ),
    293350            ),
    294351            'sign_in_with_google_shape'                    => array(
    295                 'label' => __( 'Sign in with Google Shape', 'google-site-kit' ),
     352                'label' => __( 'Sign in with Google: Shape', 'google-site-kit' ),
    296353                'value' => $this->get_settings()->get_label( 'shape', $settings['shape'] ),
    297354                'debug' => $settings['shape'],
    298355            ),
    299356            'sign_in_with_google_text'                     => array(
    300                 'label' => __( 'Sign in with Google Text', 'google-site-kit' ),
     357                'label' => __( 'Sign in with Google: Text', 'google-site-kit' ),
    301358                'value' => $this->get_settings()->get_label( 'text', $settings['text'] ),
    302359                'debug' => $settings['text'],
    303360            ),
    304361            'sign_in_with_google_theme'                    => array(
    305                 'label' => __( 'Sign in with Google Theme', 'google-site-kit' ),
     362                'label' => __( 'Sign in with Google: Theme', 'google-site-kit' ),
    306363                'value' => $this->get_settings()->get_label( 'theme', $settings['theme'] ),
    307364                'debug' => $settings['theme'],
    308365            ),
    309366            'sign_in_with_google_use_snippet'              => array(
    310                 'label' => __( 'Sign in with Google One-tap Enabled', 'google-site-kit' ),
     367                'label' => __( 'Sign in with Google: One-tap Enabled', 'google-site-kit' ),
    311368                'value' => $settings['oneTapEnabled'] ? __( 'Yes', 'google-site-kit' ) : __( 'No', 'google-site-kit' ),
    312369                'debug' => $settings['oneTapEnabled'] ? 'yes' : 'no',
    313370            ),
    314371            'sign_in_with_google_authenticated_user_count' => array(
    315                 'label' => __( 'Sign in with Google Number of users who have authenticated using Sign in with Google', 'google-site-kit' ),
     372                'label' => __( 'Sign in with Google: Number of users who have authenticated using Sign in with Google', 'google-site-kit' ),
    316373                'value' => $authenticated_user_count,
    317374                'debug' => $authenticated_user_count,
     
    394451        return Module_Tag_Matchers::NO_TAG_FOUND;
    395452    }
     453
     454    /**
     455     * Returns the disconnect URL for the specified user.
     456     *
     457     * @since 1.141.0
     458     *
     459     * @param int $user_id WordPress User ID.
     460     */
     461    public static function disconnect_url( $user_id ) {
     462        return add_query_arg(
     463            array(
     464                'action'  => self::ACTION_DISCONNECT,
     465                'nonce'   => wp_create_nonce( self::ACTION_DISCONNECT . '-' . $user_id ),
     466                'user_id' => $user_id,
     467            ),
     468            admin_url( 'index.php' )
     469        );
     470    }
     471
     472    /**
     473     * Handles the disconnect action.
     474     *
     475     * @since 1.141.0
     476     */
     477    public function handle_disconnect_user() {
     478        $input   = $this->context->input();
     479        $nonce   = $input->filter( INPUT_GET, 'nonce' );
     480        $user_id = (int) $input->filter( INPUT_GET, 'user_id' );
     481        $action  = self::ACTION_DISCONNECT . '-' . $user_id;
     482
     483        if ( ! wp_verify_nonce( $nonce, $action ) ) {
     484            $this->authentication->invalid_nonce_error( $action );
     485        }
     486
     487        // Only allow this action for admins or users own setting.
     488        if ( current_user_can( 'edit_user', $user_id ) ) {
     489            $hashed_user_id = new Hashed_User_ID( new User_Options( $this->context, $user_id ) );
     490            $hashed_user_id->delete();
     491            wp_safe_redirect( add_query_arg( 'updated', true, get_edit_user_link( $user_id ) ) );
     492            exit;
     493        }
     494
     495        wp_safe_redirect( get_edit_user_link( $user_id ) );
     496        exit;
     497    }
     498
     499    /**
     500     * Displays a disconnect button on user profile pages.
     501     *
     502     * @since 1.141.0
     503     *
     504     * @param WP_User $user WordPress user object.
     505     */
     506    private function render_disconnect_profile( WP_User $user ) {
     507        if ( ! current_user_can( 'edit_user', $user->ID ) ) {
     508            return;
     509        }
     510
     511        $hashed_user_id         = new Hashed_User_ID( new User_Options( $this->context, $user->ID ) );
     512        $current_user_google_id = $hashed_user_id->get();
     513
     514        // Don't show if the user does not have a Google ID saved in user meta.
     515        if ( empty( $current_user_google_id ) ) {
     516            return;
     517        }
     518
     519        ?>
     520<div id="googlesitekit-sign-in-with-google-disconnect">
     521    <h2><?php esc_html_e( 'Sign in with Google via Site Kit by Google', 'google-site-kit' ); ?></h2>
     522    <p>
     523        <?php
     524        if ( get_current_user_id() === $user->ID ) {
     525            esc_html_e(
     526                'You can sign in with your Google account.',
     527                'google-site-kit'
     528            );
     529        } else {
     530            esc_html_e(
     531                'This user can sign in with their Google account.',
     532                'google-site-kit'
     533            );
     534        }
     535        ?>
     536    </p>
     537    <p>
     538        <a
     539            class="button button-secondary"
     540            href="<?php echo esc_url( self::disconnect_url( $user->ID ) ); ?>"
     541        >
     542            <?php esc_html_e( 'Disconnect Google Account', 'google-site-kit' ); ?>
     543        </a>
     544    </p>
     545</div>
     546        <?php
     547    }
    396548}
  • google-site-kit/trunk/includes/Modules/Tag_Manager.php

    r3118692 r3201134  
    174174        return array(
    175175            'tagmanager_account_id'       => array(
    176                 'label' => __( 'Tag Manager account ID', 'google-site-kit' ),
     176                'label' => __( 'Tag Manager: Account ID', 'google-site-kit' ),
    177177                'value' => $settings['accountID'],
    178178                'debug' => Debug_Data::redact_debug_value( $settings['accountID'] ),
    179179            ),
    180180            'tagmanager_container_id'     => array(
    181                 'label' => __( 'Tag Manager container ID', 'google-site-kit' ),
     181                'label' => __( 'Tag Manager: Container ID', 'google-site-kit' ),
    182182                'value' => $settings['containerID'],
    183183                'debug' => Debug_Data::redact_debug_value( $settings['containerID'], 7 ),
    184184            ),
    185185            'tagmanager_amp_container_id' => array(
    186                 'label' => __( 'Tag Manager AMP container ID', 'google-site-kit' ),
     186                'label' => __( 'Tag Manager: AMP Container ID', 'google-site-kit' ),
    187187                'value' => $settings['ampContainerID'],
    188188                'debug' => Debug_Data::redact_debug_value( $settings['ampContainerID'], 7 ),
    189189            ),
    190190            'tagmanager_use_snippet'      => array(
    191                 'label' => __( 'Tag Manager snippet placed', 'google-site-kit' ),
     191                'label' => __( 'Tag Manager: Snippet placed', 'google-site-kit' ),
    192192                'value' => $settings['useSnippet'] ? __( 'Yes', 'google-site-kit' ) : __( 'No', 'google-site-kit' ),
    193193                'debug' => $settings['useSnippet'] ? 'yes' : 'no',
  • google-site-kit/trunk/includes/Plugin.php

    r3164469 r3201134  
    227227                ( new Core\Tags\GTag() )->register();
    228228                ( new Core\Conversion_Tracking\Conversion_Tracking( $this->context, $options ) )->register();
     229                if ( Feature_Flags::enabled( 'firstPartyMode' ) ) {
     230                    ( new Core\Tags\First_Party_Mode\First_Party_Mode( $this->context, $options ) )->register();
     231                }
    229232
    230233                // If a login is happening (runs after 'init'), update current user in dependency chain.
  • google-site-kit/trunk/includes/vendor/composer/autoload_classmap.php

    r3191565 r3201134  
    177177    'Google\\Site_Kit\\Core\\Storage\\User_Transients' => $baseDir . '/Core/Storage/User_Transients.php',
    178178    'Google\\Site_Kit\\Core\\Tags\\Blockable_Tag_Interface' => $baseDir . '/Core/Tags/Blockable_Tag_Interface.php',
     179    'Google\\Site_Kit\\Core\\Tags\\First_Party_Mode\\First_Party_Mode' => $baseDir . '/Core/Tags/First_Party_Mode/First_Party_Mode.php',
     180    'Google\\Site_Kit\\Core\\Tags\\First_Party_Mode\\First_Party_Mode_Settings' => $baseDir . '/Core/Tags/First_Party_Mode/First_Party_Mode_Settings.php',
     181    'Google\\Site_Kit\\Core\\Tags\\First_Party_Mode\\REST_First_Party_Mode_Controller' => $baseDir . '/Core/Tags/First_Party_Mode/REST_First_Party_Mode_Controller.php',
    179182    'Google\\Site_Kit\\Core\\Tags\\GTag' => $baseDir . '/Core/Tags/GTag.php',
    180183    'Google\\Site_Kit\\Core\\Tags\\Guards\\Tag_Environment_Type_Guard' => $baseDir . '/Core/Tags/Guards/Tag_Environment_Type_Guard.php',
     
    301304    'Google\\Site_Kit\\Modules\\Reader_Revenue_Manager' => $baseDir . '/Modules/Reader_Revenue_Manager.php',
    302305    'Google\\Site_Kit\\Modules\\Reader_Revenue_Manager\\Settings' => $baseDir . '/Modules/Reader_Revenue_Manager/Settings.php',
     306    'Google\\Site_Kit\\Modules\\Reader_Revenue_Manager\\Synchronize_OnboardingState' => $baseDir . '/Modules/Reader_Revenue_Manager/Synchronize_OnboardingState.php',
    303307    'Google\\Site_Kit\\Modules\\Reader_Revenue_Manager\\Tag_Guard' => $baseDir . '/Modules/Reader_Revenue_Manager/Tag_Guard.php',
    304308    'Google\\Site_Kit\\Modules\\Reader_Revenue_Manager\\Tag_Matchers' => $baseDir . '/Modules/Reader_Revenue_Manager/Tag_Matchers.php',
     
    307311    'Google\\Site_Kit\\Modules\\Search_Console\\Settings' => $baseDir . '/Modules/Search_Console/Settings.php',
    308312    'Google\\Site_Kit\\Modules\\Sign_In_With_Google' => $baseDir . '/Modules/Sign_In_With_Google.php',
     313    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Authenticator' => $baseDir . '/Modules/Sign_In_With_Google/Authenticator.php',
     314    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Authenticator_Interface' => $baseDir . '/Modules/Sign_In_With_Google/Authenticator_Interface.php',
     315    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Hashed_User_ID' => $baseDir . '/Modules/Sign_In_With_Google/Hashed_User_ID.php',
     316    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Profile_Reader' => $baseDir . '/Modules/Sign_In_With_Google/Profile_Reader.php',
     317    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Profile_Reader_Interface' => $baseDir . '/Modules/Sign_In_With_Google/Profile_Reader_Interface.php',
    309318    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Settings' => $baseDir . '/Modules/Sign_In_With_Google/Settings.php',
    310319    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Tag_Matchers' => $baseDir . '/Modules/Sign_In_With_Google/Tag_Matchers.php',
  • google-site-kit/trunk/readme.txt

    r3191565 r3201134  
    55Tested up to:      6.7
    66Requires PHP:      7.4
    7 Stable tag:        1.140.0
     7Stable tag:        1.141.0
    88License:           Apache License 2.0
    99License URI:       https://www.apache.org/licenses/LICENSE-2.0
     
    110110== Changelog ==
    111111
    112 = 1.140.0 =
     112= 1.141.0 =
    113113
    114114**Added**
    115115
    116 * Add Sign in with Google to Site Health. See [#9571](https://github.com/google/site-kit-wp/issues/9571).
    117 * Add new feature notification for Sign in with Google module. See [#9335](https://github.com/google/site-kit-wp/issues/9335).
     116* Add Sign in with Google to WooCommerce login page. See [#9340](https://github.com/google/site-kit-wp/issues/9340).
    118117
    119118**Enhanced**
    120119
    121 * Add a survey to be triggered when audience groups are set up. See [#9656](https://github.com/google/site-kit-wp/issues/9656).
    122 * Update styles for the admin settings. See [#9580](https://github.com/google/site-kit-wp/issues/9580).
    123 * Add GA event tracking for user interactions with the Audience Segmentation Setup in the Settings section. See [#9499](https://github.com/google/site-kit-wp/issues/9499).
    124 * Add opt-in event tracking for the Audience Segmentation introductory popup/banner. See [#9498](https://github.com/google/site-kit-wp/issues/9498).
    125 * Add GA event tracking for user interactions with the Audience Selection Panel. See [#9497](https://github.com/google/site-kit-wp/issues/9497).
    126 * Add opt-in user activity tracking in the audience tiles area. See [#9494](https://github.com/google/site-kit-wp/issues/9494).
    127 * Add opt-in user activity tracking in the audience setup CTA widget and related setting areas. See [#9493](https://github.com/google/site-kit-wp/issues/9493).
    128 * Don't unnecessarily render the Key Metrics Selection Panel into the DOM. See [#9468](https://github.com/google/site-kit-wp/issues/9468).
    129 * Add a stub survey trigger that is called when viewing the Reader Revenue Manager Setup CTA. See [#9447](https://github.com/google/site-kit-wp/issues/9447).
    130 * Update the widget area renderer to accept React components for subtitles. See [#9444](https://github.com/google/site-kit-wp/issues/9444).
    131 * Add modal of tailored metrics to User Input Questionnaire. See [#9439](https://github.com/google/site-kit-wp/issues/9439).
    132 * Add confirmation modal for users changing key metrics. See [#9438](https://github.com/google/site-kit-wp/issues/9438).
    133 * Add support for lost events to Conversion Reporting events datastore. See [#9379](https://github.com/google/site-kit-wp/issues/9379).
    134 * Add a new "Chip Tab Group" component. See [#9378](https://github.com/google/site-kit-wp/issues/9378).
    135 * Add new notification to Key Metrics Widget Settings Area. See [#9344](https://github.com/google/site-kit-wp/issues/9344).
    136 * Implement the Sign in with Google callback action. See [#9338](https://github.com/google/site-kit-wp/issues/9338).
    137 * Fix a bug that prevented the appearance of the Reader Revenue Manager setup banner graphic. See [#9329](https://github.com/google/site-kit-wp/issues/9329).
    138 * Include a "Learn more" link on the Reader Revenue Manager setup screen shown when the user doesn't have an existing publication. See [#9259](https://github.com/google/site-kit-wp/issues/9259).
     120* Update Sign in with Google descriptions in Site Health. See [#9680](https://github.com/google/site-kit-wp/issues/9680).
     121* Update the Sign in with Google login to use the popup approach. See [#9677](https://github.com/google/site-kit-wp/issues/9677).
     122* Integrate the First-party mode proxy script that will allow Analytics events to be tracked via requests made from the browser to the user's site rather than directly to Google's servers. See [#9665](https://github.com/google/site-kit-wp/issues/9665).
     123* Add info to the "One-tap" option in Sign in with Google settings. See [#9643](https://github.com/google/site-kit-wp/issues/9643).
     124* Do not show "Maybe later" in Key Metrics Admin Settings callout banner. See [#9636](https://github.com/google/site-kit-wp/issues/9636).
     125* Implement the `fetchGetFPMServerRequirementStatus()` Redux action used to retrieve the FPM server requirement status. See [#9634](https://github.com/google/site-kit-wp/issues/9634).
     126* Add an `fpm-server-requirement-status` API endpoint to verify First-Party Mode readiness by performing FPFE health checks and verifying direct PHP script access. See [#9632](https://github.com/google/site-kit-wp/issues/9632).
     127* Add a partial datastore for First-Party Mode in the `core/site` datastore to manage its settings. See [#9628](https://github.com/google/site-kit-wp/issues/9628).
     128* Add REST endpoints for First-Party Mode module settings. See [#9625](https://github.com/google/site-kit-wp/issues/9625).
     129* Update "Get your Client ID" link in Sign in with Google setup. See [#9621](https://github.com/google/site-kit-wp/issues/9621).
     130* Ensure tailored metrics override previous metrics when switching from manually-selected metrics. See [#9613](https://github.com/google/site-kit-wp/issues/9613).
     131* Improve the accuracy of the mechanism that scrolls the user to a widget area. See [#9603](https://github.com/google/site-kit-wp/issues/9603).
     132* Improve visitor groups selection panel to prevent a console warning. See [#9602](https://github.com/google/site-kit-wp/issues/9602).
     133* Add an external icon to external links in the audience selection panel and placeholder tile. See [#9598](https://github.com/google/site-kit-wp/issues/9598).
     134* Remove visitor groups setup success notifications when the user chooses not to display visitor groups in dashboard. See [#9596](https://github.com/google/site-kit-wp/issues/9596).
     135* Introduce grouping of notification queues. See [#9568](https://github.com/google/site-kit-wp/issues/9568).
     136* Add notice for users who used a legacy answer in Key Metrics settings. See [#9518](https://github.com/google/site-kit-wp/issues/9518).
     137* Split the "Sell products or services" answer in the User Input app. See [#9489](https://github.com/google/site-kit-wp/issues/9489).
     138* Persist selection group in Key Metrics selection panel. See [#9385](https://github.com/google/site-kit-wp/issues/9385).
     139* Add support for disconnecting associated Google account for sign in from WordPress user edit screen. See [#9380](https://github.com/google/site-kit-wp/issues/9380).
     140* Implement new subtle notification banner in KMW dashboard area. See [#9371](https://github.com/google/site-kit-wp/issues/9371).
     141* Move on-demand onboarding state synchronization to the server side, avoiding the need to reload the full list of publications. See [#9363](https://github.com/google/site-kit-wp/issues/9363).
     142* Improve selection panels so that they perform actions only when in view. See [#9312](https://github.com/google/site-kit-wp/issues/9312).
     143* Improve Reader Revenue Manager publication onboarding state synchronization. See [#9149](https://github.com/google/site-kit-wp/issues/9149).
     144* Add Key Metrics info to Site Health report. See [#9112](https://github.com/google/site-kit-wp/issues/9112).
     145
     146**Changed**
     147
     148* Implement settings view for Sign in with Google. See [#9477](https://github.com/google/site-kit-wp/issues/9477).
     149* Implement Sign in with Google token response login handling. See [#9339](https://github.com/google/site-kit-wp/issues/9339).
    139150
    140151**Fixed**
    141152
    142 * Only place the Reader Revenue Manager snippet on singular WordPress posts. See [#9670](https://github.com/google/site-kit-wp/issues/9670).
    143 * Fix typo in Key Metrics Widget. See [#9614](https://github.com/google/site-kit-wp/issues/9614).
    144 * Fix the issue where an extra "Failed to enable metric" modal appears when canceled in the Audience Segmentation "Top Content" custom dimension creation flow. See [#9563](https://github.com/google/site-kit-wp/issues/9563).
    145 * Fix dashboard error when selecting specific key metrics on the view-only dashboard. See [#9548](https://github.com/google/site-kit-wp/issues/9548).
    146 * Remove the “Temporarily hidden” badge when temporarily hidden tiles reappear with only a single tile visible. See [#9472](https://github.com/google/site-kit-wp/issues/9472).
    147 * Ensure "Add a metric" tiles are always visible on the view-only dashboard when fewer than 4 metrics are available or fewer than 8 metrics if the `conversionReporting` feature flag is enabled. See [#8712](https://github.com/google/site-kit-wp/issues/8712).
     153* Fix a bug that caused a custom dimension to not be created while setting up visitor groups. See [#9597](https://github.com/google/site-kit-wp/issues/9597).
    148154
    149155[See changelog for all versions](https://raw.githubusercontent.com/google/site-kit-wp/main/changelog.txt).
Note: See TracChangeset for help on using the changeset viewer.