Plugin Directory

Changeset 3381521


Ignore:
Timestamp:
10/20/2025 09:00:16 PM (8 weeks ago)
Author:
google
Message:

Update to version 1.164.0 from GitHub

Location:
google-site-kit
Files:
102 added
78 deleted
30 edited
1 copied

Legend:

Unmodified
Added
Removed
  • google-site-kit/tags/1.164.0/dist/assets/blocks/reader-revenue-manager/contribute-with-google/block.json

    r3373932 r3381521  
    33    "apiVersion": 2,
    44    "name": "google-site-kit/rrm-contribute-with-google",
    5     "version": "1.163.0",
     5    "version": "1.164.0",
    66    "title": "Contribute with Google",
    77    "category": "widgets",
  • google-site-kit/tags/1.164.0/dist/assets/blocks/reader-revenue-manager/subscribe-with-google/block.json

    r3373932 r3381521  
    33    "apiVersion": 2,
    44    "name": "google-site-kit/rrm-subscribe-with-google",
    5     "version": "1.163.0",
     5    "version": "1.164.0",
    66    "title": "Subscribe with Google",
    77    "category": "widgets",
  • google-site-kit/tags/1.164.0/dist/assets/blocks/sign-in-with-google/block.json

    r3373932 r3381521  
    33    "apiVersion": 2,
    44    "name": "google-site-kit/sign-in-with-google",
    5     "version": "1.163.0",
     5    "version": "1.164.0",
    66    "title": "Sign in with Google",
    77    "category": "widgets",
  • google-site-kit/tags/1.164.0/dist/manifest.php

    r3373932 r3381521  
    99return array(
    1010    'googlesitekit-consent-mode'                                      => array( "googlesitekit-consent-mode-bc2e26cfa69fcd4a8261.js", null ),
    11     'googlesitekit-events-provider-contact-form-7'                    => array( "googlesitekit-events-provider-contact-form-7-4ce15f19b39e8d338e84.js", null ),
    12     'googlesitekit-events-provider-easy-digital-downloads'            => array( "googlesitekit-events-provider-easy-digital-downloads-68ebca75a7f452c38292.js", null ),
    13     'googlesitekit-events-provider-mailchimp'                         => array( "googlesitekit-events-provider-mailchimp-6c323aa9d38a48a4958a.js", null ),
    14     'googlesitekit-events-provider-ninja-forms'                       => array( "googlesitekit-events-provider-ninja-forms-6ebd2ddd813bfd42f15d.js", null ),
    15     'googlesitekit-events-provider-optin-monster'                     => array( "googlesitekit-events-provider-optin-monster-79041316fce555e24465.js", null ),
    16     'googlesitekit-events-provider-popup-maker'                       => array( "googlesitekit-events-provider-popup-maker-27e8987202d972244270.js", null ),
    17     'googlesitekit-events-provider-woocommerce'                       => array( "googlesitekit-events-provider-woocommerce-45c7b122796412f75851.js", null ),
    18     'googlesitekit-events-provider-wpforms'                           => array( "googlesitekit-events-provider-wpforms-3a5081f8ff3f186e8aa8.js", null ),
     11    'googlesitekit-events-provider-contact-form-7'                    => array( "googlesitekit-events-provider-contact-form-7-858d8c72283d3fbfaa98.js", null ),
     12    'googlesitekit-events-provider-easy-digital-downloads'            => array( "googlesitekit-events-provider-easy-digital-downloads-85026152b9292f580065.js", null ),
     13    'googlesitekit-events-provider-mailchimp'                         => array( "googlesitekit-events-provider-mailchimp-a4f9d772bc64ad5b383c.js", null ),
     14    'googlesitekit-events-provider-ninja-forms'                       => array( "googlesitekit-events-provider-ninja-forms-aa24820311d3e4ff028a.js", null ),
     15    'googlesitekit-events-provider-optin-monster'                     => array( "googlesitekit-events-provider-optin-monster-492972356bb4b9b04218.js", null ),
     16    'googlesitekit-events-provider-popup-maker'                       => array( "googlesitekit-events-provider-popup-maker-3e08ae2a503322243ba6.js", null ),
     17    'googlesitekit-events-provider-woocommerce'                       => array( "googlesitekit-events-provider-woocommerce-56777fd664fb7392edc2.js", null ),
     18    'googlesitekit-events-provider-wpforms'                           => array( "googlesitekit-events-provider-wpforms-9774e7805b244d82c869.js", null ),
    1919    'googlesitekit-i18n'                                              => array( "googlesitekit-i18n-f0c172b703253d0876a2.js", null ),
    2020    'analytics-advanced-tracking'                                     => array( "analytics-advanced-tracking-78f90889e2d99b97b685.js", null ),
     
    2828    'sign-in-with-google/index'                                       => array( "sign-in-with-google/index.js", null ),
    2929    'sign-in-with-google/editor-styles'                               => array( "sign-in-with-google/editor-styles.js", null ),
    30     'googlesitekit-admin-css'                                         => array( "googlesitekit-admin-css-22f04508597b8290d7e0.min.css", null ),
     30    'googlesitekit-admin-css'                                         => array( "googlesitekit-admin-css-0aa580d3c352ea32302e.min.css", null ),
    3131    'googlesitekit-adminbar-css'                                      => array( "googlesitekit-adminbar-css-d193e67e2cbecf306061.min.css", null ),
    3232    'googlesitekit-wp-dashboard-css'                                  => array( "googlesitekit-wp-dashboard-css-bd43e70c4bc5ecdc3695.min.css", null ),
    3333    'googlesitekit-authorize-application-css'                         => array( "googlesitekit-authorize-application-css-5b98b536e7f34c6411c1.min.css", null ),
    34     'googlesitekit-api'                                               => array( "googlesitekit-api-ac769981f51f9f187c4c.js", null ),
     34    'googlesitekit-api'                                               => array( "googlesitekit-api-5415d897f4cfe6af537a.js", null ),
    3535    'googlesitekit-data'                                              => array( "googlesitekit-data-a82cf53783cfc2587cae.js", null ),
    36     'googlesitekit-datastore-site'                                    => array( "googlesitekit-datastore-site-6e78d505525c43d1fee7.js", null ),
    37     'googlesitekit-datastore-user'                                    => array( "googlesitekit-datastore-user-a396bbd484143910c364.js", null ),
    38     'googlesitekit-datastore-forms'                                   => array( "googlesitekit-datastore-forms-1319eab27227c2d58008.js", null ),
     36    'googlesitekit-datastore-site'                                    => array( "googlesitekit-datastore-site-4fab9d4e493df1a7b75f.js", null ),
     37    'googlesitekit-datastore-user'                                    => array( "googlesitekit-datastore-user-9fbfa20e271014903635.js", null ),
     38    'googlesitekit-datastore-forms'                                   => array( "googlesitekit-datastore-forms-bb68e468edb671baec08.js", null ),
    3939    'googlesitekit-datastore-location'                                => array( "googlesitekit-datastore-location-a7fd5d1461e0562c934a.js", null ),
    40     'googlesitekit-datastore-ui'                                      => array( "googlesitekit-datastore-ui-02503b56b2bd8add7e48.js", null ),
    41     'googlesitekit-modules'                                           => array( "googlesitekit-modules-4dcef8d0c286e503409c.js", null ),
    42     'googlesitekit-notifications'                                     => array( "googlesitekit-notifications-c2d019e9ab99a53a8028.js", null ),
    43     'googlesitekit-widgets'                                           => array( "googlesitekit-widgets-cbc1910ab4a3eef79c0e.js", null ),
    44     'googlesitekit-modules-ads'                                       => array( "googlesitekit-modules-ads-c39576b28ea4de825758.js", null ),
    45     'googlesitekit-modules-adsense'                                   => array( "googlesitekit-modules-adsense-3d9f7107475b5c2c6074.js", null ),
    46     'googlesitekit-modules-analytics-4'                               => array( "googlesitekit-modules-analytics-4-414f4fdb74d373dae6a9.js", null ),
    47     'googlesitekit-modules-pagespeed-insights'                        => array( "googlesitekit-modules-pagespeed-insights-1a1b2161305dced52b73.js", null ),
    48     'googlesitekit-modules-reader-revenue-manager'                    => array( "googlesitekit-modules-reader-revenue-manager-ef0ee7bce6226a1397c1.js", null ),
    49     'googlesitekit-modules-search-console'                            => array( "googlesitekit-modules-search-console-88df71db4afc90a1ac90.js", null ),
    50     'googlesitekit-modules-sign-in-with-google'                       => array( "googlesitekit-modules-sign-in-with-google-d495f188f813c853af6a.js", null ),
    51     'googlesitekit-modules-tagmanager'                                => array( "googlesitekit-modules-tagmanager-e6521a0e9e254258edf6.js", null ),
    52     'googlesitekit-user-input'                                        => array( "googlesitekit-user-input-94a34d10e61746440cf4.js", null ),
    53     'googlesitekit-ad-blocking-recovery'                              => array( "googlesitekit-ad-blocking-recovery-c13f02312d76d6e6ad4b.js", null ),
     40    'googlesitekit-datastore-ui'                                      => array( "googlesitekit-datastore-ui-c4f0c0ecf7e603d255ac.js", null ),
     41    'googlesitekit-modules'                                           => array( "googlesitekit-modules-0a1c37f4c7f1ccba2e70.js", null ),
     42    'googlesitekit-notifications'                                     => array( "googlesitekit-notifications-3b99b45672b70fa6c0c3.js", null ),
     43    'googlesitekit-widgets'                                           => array( "googlesitekit-widgets-89e6cf33318a2b4218b2.js", null ),
     44    'googlesitekit-modules-ads'                                       => array( "googlesitekit-modules-ads-3afd4c0d0448a6b9e55d.js", null ),
     45    'googlesitekit-modules-adsense'                                   => array( "googlesitekit-modules-adsense-ff252ea79a88ca6ed113.js", null ),
     46    'googlesitekit-modules-analytics-4'                               => array( "googlesitekit-modules-analytics-4-a3afd3f605d1d6cee9ae.js", null ),
     47    'googlesitekit-modules-pagespeed-insights'                        => array( "googlesitekit-modules-pagespeed-insights-a520ab4105bdb8b21f4b.js", null ),
     48    'googlesitekit-modules-reader-revenue-manager'                    => array( "googlesitekit-modules-reader-revenue-manager-3f5c91790bc27a05a1af.js", null ),
     49    'googlesitekit-modules-search-console'                            => array( "googlesitekit-modules-search-console-e91f3b157dee1fcc67f4.js", null ),
     50    'googlesitekit-modules-sign-in-with-google'                       => array( "googlesitekit-modules-sign-in-with-google-b45a6047e0a41d61dea8.js", null ),
     51    'googlesitekit-modules-tagmanager'                                => array( "googlesitekit-modules-tagmanager-94a8d4227d2d26a44073.js", null ),
     52    'googlesitekit-user-input'                                        => array( "googlesitekit-user-input-066d7b88b430e4488323.js", null ),
     53    'googlesitekit-ad-blocking-recovery'                              => array( "googlesitekit-ad-blocking-recovery-720a286901e7b9d4dce3.js", null ),
    5454    'googlesitekit-block-tracking'                                    => array( "googlesitekit-block-tracking-1032e2e997b7685502b9.js", null ),
    5555    'googlesitekit-polyfills'                                         => array( "googlesitekit-polyfills-8b59b9627a8949df6deb.js", null ),
    56     'googlesitekit-components'                                        => array( "googlesitekit-components-8e484a48327f6b8ac232.js", null ),
    57     'googlesitekit-metric-selection'                                  => array( "googlesitekit-metric-selection-2852508a03964403b9b5.js", null ),
    58     'googlesitekit-key-metrics-setup'                                 => array( "googlesitekit-key-metrics-setup-1d4b4a3d18ab38d2858e.js", null ),
    59     'googlesitekit-activation'                                        => array( "googlesitekit-activation-7d8375e148518ec2e1b6.js", null ),
    60     'googlesitekit-adminbar'                                          => array( "googlesitekit-adminbar-35777edd8b27cc812b2b.js", null ),
    61     'googlesitekit-settings'                                          => array( "googlesitekit-settings-beb6719616e97ff17ebe.js", null ),
    62     'googlesitekit-main-dashboard'                                    => array( "googlesitekit-main-dashboard-548515dec90eb91159ff.js", null ),
    63     'googlesitekit-entity-dashboard'                                  => array( "googlesitekit-entity-dashboard-24e2fedfe7d84f208918.js", null ),
    64     'googlesitekit-splash'                                            => array( "googlesitekit-splash-5ba2224fcefddcc4c1d9.js", null ),
    65     'googlesitekit-wp-dashboard'                                      => array( "googlesitekit-wp-dashboard-aa7ac49c90b9b7f5aefc.js", null ),
    66     'googlesitekit-runtime'                                           => array( "runtime-bb64756252a68ebcdd2b.js", null ),
    67     'googlesitekit-vendor'                                            => array( "googlesitekit-vendor-ed1386e2b6878f804739.js", null ),
     56    'googlesitekit-components'                                        => array( "googlesitekit-components-3b61eacd2cb133eb7a54.js", null ),
     57    'googlesitekit-metric-selection'                                  => array( "googlesitekit-metric-selection-42ec83a16098134bfe05.js", null ),
     58    'googlesitekit-key-metrics-setup'                                 => array( "googlesitekit-key-metrics-setup-af470800b816f945f2ea.js", null ),
     59    'googlesitekit-activation'                                        => array( "googlesitekit-activation-265f42c4861de8dd5530.js", null ),
     60    'googlesitekit-adminbar'                                          => array( "googlesitekit-adminbar-516a7ae64b1fbe0dc86d.js", null ),
     61    'googlesitekit-settings'                                          => array( "googlesitekit-settings-b48696b40ea99bbb1ab5.js", null ),
     62    'googlesitekit-main-dashboard'                                    => array( "googlesitekit-main-dashboard-8c022ca3fc37671d18b6.js", null ),
     63    'googlesitekit-entity-dashboard'                                  => array( "googlesitekit-entity-dashboard-ff6cd35270edba385955.js", null ),
     64    'googlesitekit-splash'                                            => array( "googlesitekit-splash-4c8bdca6bedb04bc4242.js", null ),
     65    'googlesitekit-wp-dashboard'                                      => array( "googlesitekit-wp-dashboard-0e2822cc1689ca577f29.js", null ),
     66    'googlesitekit-runtime'                                           => array( "runtime-4300400569c01237fc9a.js", null ),
     67    'googlesitekit-vendor'                                            => array( "googlesitekit-vendor-599848015879dcc843df.js", null ),
    6868);
  • google-site-kit/tags/1.164.0/google-site-kit.php

    r3373932 r3381521  
    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.163.0
     14 * Version:           1.164.0
    1515 * Requires at least: 5.2
    1616 * Requires PHP:      7.4
     
    2727
    2828// Define most essential constants.
    29 define( 'GOOGLESITEKIT_VERSION', '1.163.0' );
     29define( 'GOOGLESITEKIT_VERSION', '1.164.0' );
    3030define( 'GOOGLESITEKIT_PLUGIN_MAIN_FILE', __FILE__ );
    3131define( 'GOOGLESITEKIT_PHP_MINIMUM', '7.4.0' );
  • google-site-kit/tags/1.164.0/includes/Core/Assets/Assets.php

    r3373932 r3381521  
    775775            'isNetworkMode'     => $this->context->is_network_mode(),
    776776            'timezone'          => get_option( 'timezone_string' ),
     777            'startOfWeek'       => (int) get_option( 'start_of_week' ),
    777778            'siteName'          => wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ),
    778779            'siteLocale'        => $this->context->get_locale(),
     
    875876                'id'      => $current_user->ID,
    876877                'email'   => $current_user->user_email,
     878                'wpEmail' => $current_user->user_email, // Preserved for features that need the original WP email (email gets overridden during proxy auth).
    877879                'name'    => $current_user->display_name,
    878880                'picture' => get_avatar_url( $current_user->user_email ),
  • google-site-kit/tags/1.164.0/includes/Core/Conversion_Tracking/Conversion_Event_Providers/Easy_Digital_Downloads.php

    r3127664 r3381521  
    1313use Google\Site_Kit\Core\Assets\Script;
    1414use Google\Site_Kit\Core\Conversion_Tracking\Conversion_Events_Provider;
     15use Google\Site_Kit\Core\Util\Feature_Flags;
     16use Google\Site_Kit\Core\Util\Method_Proxy_Trait;
     17use Google\Site_Kit\Modules\Ads\Enhanced_Conversions;
    1518
    1619/**
     
    2326class Easy_Digital_Downloads extends Conversion_Events_Provider {
    2427
     28    use Method_Proxy_Trait;
     29
    2530    const CONVERSION_EVENT_PROVIDER_SLUG = 'easy-digital-downloads';
    2631
     
    4449     */
    4550    public function get_event_names() {
    46         return array( 'add_to_cart' );
     51        $event_names = array( 'add_to_cart' );
     52
     53        if ( Feature_Flags::enabled( 'gtagUserData' ) ) {
     54            $event_names[] = 'purchase';
     55        }
     56
     57        return $event_names;
    4758    }
    4859
     
    6879        return $script;
    6980    }
     81
     82    /**
     83     * Registers hooks for the Easy Digital Downloads provider.
     84     *
     85     * @since 1.164.0
     86     */
     87    public function register_hooks() {
     88        if ( Feature_Flags::enabled( 'gtagUserData' ) ) {
     89            add_action(
     90                'wp_footer',
     91                $this->get_method_proxy( 'maybe_add_purchase_data_from_session' )
     92            );
     93        }
     94    }
     95
     96    /**
     97     * Prints the purchase data.
     98     *
     99     * @since 1.164.0
     100     */
     101    protected function maybe_add_purchase_data_from_session() {
     102        if ( ! function_exists( 'edd_get_purchase_session' ) || ! function_exists( 'edd_is_success_page' ) || ! edd_is_success_page() ) {
     103            return;
     104        }
     105
     106        $purchase_session = edd_get_purchase_session();
     107        $purchase_data    = $this->get_enhanced_conversions_data_from_session( $purchase_session );
     108
     109        wp_add_inline_script(
     110            'googlesitekit-events-provider-' . self::CONVERSION_EVENT_PROVIDER_SLUG,
     111            join(
     112                "\n",
     113                array(
     114                    'window._googlesitekit.edddata = window._googlesitekit.edddata || {};',
     115                    sprintf( 'window._googlesitekit.edddata.purchase = %s;', wp_json_encode( $purchase_data ) ),
     116                )
     117            ),
     118            'before'
     119        );
     120    }
     121
     122
     123    /**
     124     * Extracts Enhanced Conversions data from an EDD session.
     125     *
     126     * @since 1.164.0
     127     *
     128     * @param mixed|array|null $session_data An array containing EDD purchase session data.
     129     *
     130     * @return array
     131     */
     132    protected function get_enhanced_conversions_data_from_session( $session_data ) {
     133        if ( ! is_array( $session_data ) ) {
     134            return array();
     135        }
     136
     137        $user_data = $this->extract_user_data_from_session( $session_data );
     138
     139        if ( empty( $user_data ) ) {
     140            return array();
     141        }
     142
     143        return array(
     144            'user_data' => $user_data,
     145        );
     146    }
     147
     148
     149    /**
     150     * Extracts user data from an EDD session.
     151     *
     152     * @since 1.164.0
     153     *
     154     * @param array $session_data An array containing EDD purchase session data.
     155     *
     156     * @return array
     157     */
     158    protected function extract_user_data_from_session( $session_data ) {
     159        $user_data    = array();
     160        $address_data = array();
     161
     162        if ( isset( $session_data['user_info'] ) ) {
     163            $email = $session_data['user_info']['email'] ?? $session_data['user_email'] ?? '';
     164
     165            if ( ! empty( $email ) ) {
     166                $user_data['email'] = Enhanced_Conversions::get_normalized_email( $email );
     167            }
     168
     169            if ( ! empty( $session_data['user_info']['first_name'] ) ) {
     170                $address_data['first_name'] = Enhanced_Conversions::get_normalized_value( $session_data['user_info']['first_name'] );
     171            }
     172
     173            if ( ! empty( $session_data['user_info']['last_name'] ) ) {
     174                $address_data['last_name'] = Enhanced_Conversions::get_normalized_value( $session_data['user_info']['last_name'] );
     175            }
     176
     177            if ( isset( $session_data['user_info']['address'] ) ) {
     178
     179                if ( ! empty( $session_data['user_info']['address']['phone'] ) ) {
     180                    $user_data['phone_number'] = Enhanced_Conversions::get_normalized_value( $session_data['user_info']['address']['phone'] );
     181                }
     182
     183                if ( ! empty( $session_data['user_info']['address']['line1'] ) ) {
     184                    $address_data['street'] = Enhanced_Conversions::get_normalized_value( $session_data['user_info']['address']['line1'] );
     185                }
     186
     187                if ( ! empty( $session_data['user_info']['address']['city'] ) ) {
     188                    $address_data['city'] = Enhanced_Conversions::get_normalized_value( $session_data['user_info']['address']['city'] );
     189                }
     190
     191                if ( ! empty( $session_data['user_info']['address']['state'] ) ) {
     192                    $region = $session_data['user_info']['address']['state'];
     193
     194                    // Attempt to get full region name.
     195                    if ( function_exists( 'edd_get_state_name' ) && ! empty( $session_data['user_info']['address']['country'] ) ) {
     196                        $region = edd_get_state_name( $session_data['user_info']['address']['country'], $region );
     197                    }
     198
     199                    $address_data['region'] = Enhanced_Conversions::get_normalized_value( $region );
     200                }
     201
     202                if ( ! empty( $session_data['user_info']['address']['zip'] ) ) {
     203                    $address_data['postal_code'] = Enhanced_Conversions::get_normalized_value( $session_data['user_info']['address']['zip'] );
     204                }
     205
     206                if ( ! empty( $session_data['user_info']['address']['country'] ) ) {
     207                    $address_data['country'] = $session_data['user_info']['address']['country'];
     208                }
     209            }
     210        }
     211
     212        if ( ! empty( $address_data ) ) {
     213            $user_data['address'] = $address_data;
     214        }
     215
     216        return $user_data;
     217    }
    70218}
  • google-site-kit/tags/1.164.0/includes/Core/User/User.php

    r3366057 r3381521  
    4848
    4949    /**
     50     * Initial_Setup instance.
     51     *
     52     * @since 1.164.0
     53     * @var Initial_Setup
     54     */
     55    private $initial_setup;
     56
     57    /**
    5058     * Constructor.
    5159     *
    5260     * @since 1.134.0
    5361     * @since 1.162.0 Added Proactive User Engagement.
     62     * @since 1.164.0 Added Initial Setup.
    5463     *
    5564     * @param User_Options $user_options User_Options instance.
     
    6271            $this->proactive_user_engagement = new Proactive_User_Engagement( $user_options );
    6372        }
     73
     74        if ( Feature_Flags::enabled( 'setupFlowRefresh' ) ) {
     75            $this->initial_setup = new Initial_Setup( $user_options );
     76        }
    6477    }
    6578
     
    6982     * @since 1.134.0
    7083     * @since 1.162.0 Added Proactive User Engagement.
     84     * @since 1.164.0 Added Initial Setup.
    7185     */
    7286    public function register() {
     
    7791            $this->proactive_user_engagement->register();
    7892        }
     93
     94        if ( Feature_Flags::enabled( 'setupFlowRefresh' ) ) {
     95            $this->initial_setup->register();
     96        }
    7997    }
    8098}
  • google-site-kit/tags/1.164.0/includes/Modules/Analytics_4.php

    r3373932 r3381521  
    998998        $this->provision_property_webdatastream( $account_id, $account_ticket );
    999999
     1000        if ( Feature_Flags::enabled( 'setupFlowRefresh' ) ) {
     1001            wp_safe_redirect(
     1002                $this->context->admin_url(
     1003                    'key-metrics-setup',
     1004                )
     1005            );
     1006            exit;
     1007        }
     1008
    10001009        wp_safe_redirect(
    10011010            $this->context->admin_url(
  • google-site-kit/tags/1.164.0/includes/Modules/Sign_In_With_Google.php

    r3349867 r3381521  
    4747use Google\Site_Kit\Modules\Sign_In_With_Google\Web_Tag;
    4848use Google\Site_Kit\Modules\Sign_In_With_Google\WooCommerce_Authenticator;
     49use Google\Site_Kit\Modules\Sign_In_With_Google\Compatibility_Checks\Compatibility_Checks;
     50use Google\Site_Kit\Modules\Sign_In_With_Google\Compatibility_Checks\WP_Login_Accessible_Check;
     51use Google\Site_Kit\Modules\Sign_In_With_Google\Compatibility_Checks\WP_COM_Check;
     52use Google\Site_Kit\Modules\Sign_In_With_Google\Compatibility_Checks\Conflicting_Plugins_Check;
     53use Google\Site_Kit\Modules\Sign_In_With_Google\Datapoint\Compatibility_Checks as Compatibility_Checks_Datapoint;
    4954use WP_Error;
    5055use WP_User;
     
    139144
    140145        add_filter( 'wp_login_errors', array( $this, 'handle_login_errors' ) );
     146
     147        add_action( 'googlesitekit_render_sign_in_with_google_button', array( $this, 'render_sign_in_with_google_button' ), 10, 1 );
    141148
    142149        add_action(
     
    369376
    370377    /**
     378     * Gets the datapoint definitions for the module.
     379     *
     380     * @since 1.164.0
     381     *
     382     * @return array List of datapoint definitions.
     383     */
     384    protected function get_datapoint_definitions() {
     385        $checks = new Compatibility_Checks();
     386        $checks->add_check( new WP_Login_Accessible_Check() );
     387        $checks->add_check( new WP_COM_Check() );
     388        $checks->add_check( new Conflicting_Plugins_Check() );
     389
     390        return array(
     391            'GET:compatibility-checks' => new Compatibility_Checks_Datapoint( array( 'checks' => $checks ) ),
     392        );
     393    }
     394
     395    /**
    371396     * Renders the placeholder Sign in with Google div for the WooCommerce
    372397     * login form.
     
    385410        }
    386411
    387         ?>
    388 <div class="googlesitekit-sign-in-with-google__frontend-output-button woocommerce-form-row form-row"></div>
    389         <?php
     412        /**
     413         * Display the Sign in with Google button.
     414         *
     415         * @since 1.164.0
     416         *
     417         * @param array $args Optional arguments to customize button attributes.
     418         */
     419        do_action(
     420            'googlesitekit_render_sign_in_with_google_button',
     421            array(
     422                'class' => 'woocommerce-form-row form-row',
     423            )
     424        );
    390425    }
    391426
     
    422457    private function render_button_in_wp_login_form( $content ) {
    423458        if ( $this->can_render_signinwithgoogle() ) {
    424             $content .= '<div class="googlesitekit-sign-in-with-google__frontend-output-button"></div>';
     459            ob_start();
     460            /**
     461             * Display the Sign in with Google button.
     462             *
     463             * @since 1.164.0
     464             *
     465             * @param array $args Optional arguments to customize button attributes.
     466             */
     467            do_action( 'googlesitekit_render_sign_in_with_google_button' );
     468            $content .= ob_get_clean();
    425469        }
    426470        return $content;
     471    }
     472
     473    /**
     474     * Renders the Sign in with Google button markup.
     475     *
     476     * @since 1.164.0
     477     *
     478     * @param array $args Optional arguments to customize button attributes.
     479     */
     480    public function render_sign_in_with_google_button( $args = array() ) {
     481        if ( ! is_array( $args ) ) {
     482            $args = array();
     483        }
     484
     485        $default_classes   = array( 'googlesitekit-sign-in-with-google__frontend-output-button' );
     486        $classes_from_args = array();
     487        if ( ! empty( $args['class'] ) ) {
     488            $classes_from_args = is_array( $args['class'] ) ? $args['class'] : preg_split( '/\s+/', (string) $args['class'] );
     489        }
     490
     491        // Merge default HTML class names and class names passed as arguments
     492        // to the action, then sanitize each class name.
     493        $merged_classes    = array_merge( $default_classes, $classes_from_args );
     494        $sanitized_classes = array_map( 'sanitize_html_class', $merged_classes );
     495
     496        // Remove duplicates, empty values, and reindex array.
     497        $classes = array_values( array_unique( array_filter( $sanitized_classes ) ) );
     498
     499        $attributes = array(
     500            // HTML class attribute should be a string.
     501            'class' => implode( ' ', $classes ),
     502        );
     503
     504        $data_attributes = array( 'shape', 'text', 'theme' );
     505        foreach ( $data_attributes as $attribute ) {
     506            if ( empty( $args[ $attribute ] ) || ! is_scalar( $args[ $attribute ] ) ) {
     507                continue;
     508            }
     509
     510            $attributes[ 'data-googlesitekit-siwg-' . strtolower( $attribute ) ] = (string) $args[ $attribute ];
     511        }
     512
     513        $attribute_strings = array();
     514        foreach ( $attributes as $key => $value ) {
     515            $attribute_strings[] = sprintf( '%s="%s"', $key, esc_attr( $value ) );
     516        }
     517
     518        echo '<div ' . implode( ' ', $attribute_strings ) . '></div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    427519    }
    428520
  • google-site-kit/tags/1.164.0/includes/Modules/Sign_In_With_Google/Settings.php

    r3373932 r3381521  
    8787    protected function get_default() {
    8888        return array(
    89             'clientID'      => '',
    90             'text'          => self::TEXT_SIGN_IN_WITH_GOOGLE['value'],
    91             'theme'         => self::THEME_LIGHT['value'],
    92             'shape'         => self::SHAPE_RECTANGULAR['value'],
    93             'oneTapEnabled' => false,
     89            'clientID'                  => '',
     90            'text'                      => self::TEXT_SIGN_IN_WITH_GOOGLE['value'],
     91            'theme'                     => self::THEME_LIGHT['value'],
     92            'shape'                     => self::SHAPE_RECTANGULAR['value'],
     93            'oneTapEnabled'             => false,
     94            'showNextToCommentsEnabled' => false,
    9495        );
    9596    }
     
    152153            }
    153154
     155            if ( isset( $option['showNextToCommentsEnabled'] ) ) {
     156                $option['showNextToCommentsEnabled'] = (bool) $option['showNextToCommentsEnabled'];
     157            }
     158
    154159            return $option;
    155160        };
  • google-site-kit/tags/1.164.0/includes/Modules/Sign_In_With_Google/Sign_In_With_Google_Block.php

    r3335509 r3381521  
    8787        }
    8888
    89         return '<div class="googlesitekit-sign-in-with-google__frontend-output-button"></div>';
     89        ob_start();
     90        /**
     91         * Display the Sign in with Google button.
     92         *
     93         * @since 1.164.0
     94         *
     95         * @param array $args Optional arguments to customize button attributes.
     96         */
     97        do_action( 'googlesitekit_render_sign_in_with_google_button' );
     98        return ob_get_clean();
    9099    }
    91100}
  • google-site-kit/tags/1.164.0/includes/Modules/Sign_In_With_Google/Web_Tag.php

    r3373932 r3381521  
    191191             */
    192192            ?>
    193         document.querySelectorAll( '.googlesitekit-sign-in-with-google__frontend-output-button' ).forEach( ( siwgButtonDiv ) => {
    194             google.accounts.id.renderButton( siwgButtonDiv, <?php echo wp_json_encode( $btn_args ); ?> );
    195         });
     193    const defaultButtonOptions = <?php echo wp_json_encode( $btn_args ); ?>;
     194    document.querySelectorAll( '.googlesitekit-sign-in-with-google__frontend-output-button' ).forEach( ( siwgButtonDiv ) => {
     195        const buttonOptions = {
     196            shape: siwgButtonDiv.getAttribute( 'data-googlesitekit-siwg-shape' ) || defaultButtonOptions.shape,
     197            text: siwgButtonDiv.getAttribute( 'data-googlesitekit-siwg-text' ) || defaultButtonOptions.text,
     198            theme: siwgButtonDiv.getAttribute( 'data-googlesitekit-siwg-theme' ) || defaultButtonOptions.theme,
     199        };
     200
     201        google.accounts.id.renderButton( siwgButtonDiv, buttonOptions );
     202    });
    196203    <?php endif; // phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect ?>
    197204
  • google-site-kit/tags/1.164.0/includes/vendor/composer/autoload_classmap.php

    r3373932 r3381521  
    208208    'Google\\Site_Kit\\Core\\User\\Conversion_Reporting' => $baseDir . '/Core/User/Conversion_Reporting.php',
    209209    'Google\\Site_Kit\\Core\\User\\Conversion_Reporting_Settings' => $baseDir . '/Core/User/Conversion_Reporting_Settings.php',
     210    'Google\\Site_Kit\\Core\\User\\Initial_Setup' => $baseDir . '/Core/User/Initial_Setup.php',
     211    'Google\\Site_Kit\\Core\\User\\Initial_Setup_Settings' => $baseDir . '/Core/User/Initial_Setup_Settings.php',
    210212    'Google\\Site_Kit\\Core\\User\\Proactive_User_Engagement' => $baseDir . '/Core/User/Proactive_User_Engagement.php',
    211213    'Google\\Site_Kit\\Core\\User\\Proactive_User_Engagement_Settings' => $baseDir . '/Core/User/Proactive_User_Engagement_Settings.php',
    212214    'Google\\Site_Kit\\Core\\User\\REST_Audience_Settings_Controller' => $baseDir . '/Core/User/REST_Audience_Settings_Controller.php',
    213215    'Google\\Site_Kit\\Core\\User\\REST_Conversion_Reporting_Controller' => $baseDir . '/Core/User/REST_Conversion_Reporting_Controller.php',
     216    'Google\\Site_Kit\\Core\\User\\REST_Initial_Setup_Controller' => $baseDir . '/Core/User/REST_Initial_Setup_Controller.php',
    214217    'Google\\Site_Kit\\Core\\User\\REST_Proactive_User_Engagement_Controller' => $baseDir . '/Core/User/REST_Proactive_User_Engagement_Controller.php',
    215218    'Google\\Site_Kit\\Core\\User\\User' => $baseDir . '/Core/User/User.php',
     
    340343    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Authenticator' => $baseDir . '/Modules/Sign_In_With_Google/Authenticator.php',
    341344    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Authenticator_Interface' => $baseDir . '/Modules/Sign_In_With_Google/Authenticator_Interface.php',
     345    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Compatibility_Checks\\Compatibility_Check' => $baseDir . '/Modules/Sign_In_With_Google/Compatibility_Checks/Compatibility_Check.php',
     346    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Compatibility_Checks\\Compatibility_Checks' => $baseDir . '/Modules/Sign_In_With_Google/Compatibility_Checks/Compatibility_Checks.php',
     347    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Compatibility_Checks\\Conflicting_Plugins_Check' => $baseDir . '/Modules/Sign_In_With_Google/Compatibility_Checks/Conflicting_Plugins_Check.php',
     348    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Compatibility_Checks\\WP_COM_Check' => $baseDir . '/Modules/Sign_In_With_Google/Compatibility_Checks/WP_COM_Check.php',
     349    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Compatibility_Checks\\WP_Login_Accessible_Check' => $baseDir . '/Modules/Sign_In_With_Google/Compatibility_Checks/WP_Login_Accessible_Check.php',
     350    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Datapoint\\Compatibility_Checks' => $baseDir . '/Modules/Sign_In_With_Google/Datapoint/Compatibility_Checks.php',
    342351    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Existing_Client_ID' => $baseDir . '/Modules/Sign_In_With_Google/Existing_Client_ID.php',
    343352    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Hashed_User_ID' => $baseDir . '/Modules/Sign_In_With_Google/Hashed_User_ID.php',
  • google-site-kit/tags/1.164.0/readme.txt

    r3373932 r3381521  
    55Tested up to:      6.8
    66Requires PHP:      7.4
    7 Stable tag:        1.163.0
     7Stable tag:        1.164.0
    88License:           Apache License 2.0
    99License URI:       https://www.apache.org/licenses/LICENSE-2.0
     
    110110== Changelog ==
    111111
    112 = 1.163.0 =
     112= 1.164.0 =
     113
     114**Added**
     115
     116* Add setting for using Sign in with Google for WordPress comments. See [#11472](https://github.com/google/site-kit-wp/issues/11472).
     117* Add One-Tap to Sign in with Google setup when user registrations are open. See [#11469](https://github.com/google/site-kit-wp/issues/11469).
    113118
    114119**Enhanced**
    115120
    116 * Update `service_version` to `v3` in proxy metadata when the `setupFlowRefresh` feature flag is enabled. See [#11488](https://github.com/google/site-kit-wp/issues/11488).
    117 * Add "manage email reports" link for Proactive User Engagement feature. See [#11423](https://github.com/google/site-kit-wp/issues/11423).
    118 * Implement Conversion Events, ABR, Consent Mode, SiwG and Key Metrics feature metrics tracking. See [#11422](https://github.com/google/site-kit-wp/issues/11422).
    119 * Implement Audience Segmentation, AdSense reporting, Dashboard Sharing and RRM feature metrics tracking. See [#11421](https://github.com/google/site-kit-wp/issues/11421).
    120 * Add the `googlesitekit-key-metrics-setup` screen, with stub content. See [#11373](https://github.com/google/site-kit-wp/issues/11373).
    121 * Ensure the `analytics.edit` scope is included in the set of required scopes for the Analytics module when the `setupFlowRefresh` feature flag is enabled. See [#11372](https://github.com/google/site-kit-wp/issues/11372).
    122 * Conditionally display a “Search Console was successfully set up” toast notification on the Analytics setup screen. See [#11339](https://github.com/google/site-kit-wp/issues/11339).
    123 * Create `ToastNotice`, a generic component for displaying short-lived "toast" messages. See [#11338](https://github.com/google/site-kit-wp/issues/11338).
    124 * Ensure all occurrences of the term "consent mode" have the correct casing. Props cnaples79. See [#11076](https://github.com/google/site-kit-wp/issues/11076).
    125 * Revise the wording on the "Congrats on completing the setup for Site Kit!" banner. See [#9001](https://github.com/google/site-kit-wp/issues/9001).
    126 
    127 **Changed**
    128 
    129 * Consolidate One-tap settings to a single setting. See [#11466](https://github.com/google/site-kit-wp/issues/11466).
    130 * Update version of NodeJS used to build Site Kit. See [#6026](https://github.com/google/site-kit-wp/issues/6026).
     121* Add client side compatibility checks for Sign in with Google. See [#11505](https://github.com/google/site-kit-wp/issues/11505).
     122* Add ability to load Sign in with Google compatibility checks from Site Kit. See [#11463](https://github.com/google/site-kit-wp/issues/11463).
     123* Add support for detecting plugins/hosting environments incompatible with Sign in with Google. See [#11458](https://github.com/google/site-kit-wp/issues/11458).
     124* Add third-party support for the Sign in with Google button via a WordPress Action: `do_action( 'googlesitekit_render_sign_in_with_google_button' )`. See [#11455](https://github.com/google/site-kit-wp/issues/11455).
     125* Add the email reporting settings selection panel. See [#11424](https://github.com/google/site-kit-wp/issues/11424).
     126* Add API and data store infrastructure to preserve initial settings accompanying the new setup flow. See [#11387](https://github.com/google/site-kit-wp/issues/11387).
     127* Add Analytics setup success toast notice in the Key Metrics setup screen. See [#11384](https://github.com/google/site-kit-wp/issues/11384).
     128* Display the progress indicator on the Analytics setup screen when it's navigated to in the new setup flow. See [#11379](https://github.com/google/site-kit-wp/issues/11379).
     129* Add the progress indicator to the new version of the splash screen. See [#11378](https://github.com/google/site-kit-wp/issues/11378).
     130* Add a `ProgressIndicator` component to display progressions in user flows. See [#11377](https://github.com/google/site-kit-wp/issues/11377).
     131* Redirect users to the Key Metrics setup screen after successfully connecting Analytics when the `setupFlowRefresh` feature flag is enabled. See [#11375](https://github.com/google/site-kit-wp/issues/11375).
     132* Add Key Metrics setup screen with site purpose questionnaire and dashboard redirection functionality. See [#11374](https://github.com/google/site-kit-wp/issues/11374).
     133* Implement the foundation for the forthcoming splash screen update. See [#11333](https://github.com/google/site-kit-wp/issues/11333).
     134* Add a selector to allow users to customize frequency of reports when Proactive User Engagement is enabled. See [#11155](https://github.com/google/site-kit-wp/issues/11155).
     135* Add the email reporting overlay notification. See [#11147](https://github.com/google/site-kit-wp/issues/11147).
     136* Add Enhanced Conversions support for Mailchimp for WordPress by capturing and sending user data. See [#11127](https://github.com/google/site-kit-wp/issues/11127).
     137* Add Enhanced Conversions support for OptinMonster by capturing and sending user data. See [#11126](https://github.com/google/site-kit-wp/issues/11126).
     138* Add Enhanced Conversions support for Easy Digital Downloads by capturing and sending user data. See [#11011](https://github.com/google/site-kit-wp/issues/11011).
     139* Add "Learn more" link to Visitor Groups notification banner. See [#10964](https://github.com/google/site-kit-wp/issues/10964).
     140* Include Reader Revenue Manager in the list of services identified by the unsatisfied scopes alert. See [#10797](https://github.com/google/site-kit-wp/issues/10797).
     141* Don't show the "How to Improve" tab in the Pagespeed Insights widget when no recommendations are available. See [#7612](https://github.com/google/site-kit-wp/issues/7612).
     142* Standardize font sizes for Key Metric Widget subheadings. See [#6107](https://github.com/google/site-kit-wp/issues/6107).
    131143
    132144**Fixed**
    133145
    134 * Fix bug that caused sites that may be unable to install Site Kit from seeing a warning message during plugin setup. See [#11574](https://github.com/google/site-kit-wp/issues/11574).
    135 * Prevent the checkbox hover/focus state from being clipped on the Ad Blocking Recovery screen. See [#11309](https://github.com/google/site-kit-wp/issues/11309).
    136 * Fix bug that could cause Enhanced Conversion Tracking to be enabled when it shouldn't be after OAuth login. See [#11196](https://github.com/google/site-kit-wp/issues/11196).
     146* Fix Reader Revenue Manager setup screen displaying empty content when API errors occur. See [#11581](https://github.com/google/site-kit-wp/issues/11581).
     147* Add "pinned notifications" to the notifications API, and use it to ensure the Audience Segmentation and Enhanced Measurement setup banners continue to be shown when returning from OAuth. See [#10890](https://github.com/google/site-kit-wp/issues/10890).
    137148
    138149[See changelog for all versions](https://raw.githubusercontent.com/google/site-kit-wp/main/changelog.txt).
  • google-site-kit/trunk/dist/assets/blocks/reader-revenue-manager/contribute-with-google/block.json

    r3373932 r3381521  
    33    "apiVersion": 2,
    44    "name": "google-site-kit/rrm-contribute-with-google",
    5     "version": "1.163.0",
     5    "version": "1.164.0",
    66    "title": "Contribute with Google",
    77    "category": "widgets",
  • google-site-kit/trunk/dist/assets/blocks/reader-revenue-manager/subscribe-with-google/block.json

    r3373932 r3381521  
    33    "apiVersion": 2,
    44    "name": "google-site-kit/rrm-subscribe-with-google",
    5     "version": "1.163.0",
     5    "version": "1.164.0",
    66    "title": "Subscribe with Google",
    77    "category": "widgets",
  • google-site-kit/trunk/dist/assets/blocks/sign-in-with-google/block.json

    r3373932 r3381521  
    33    "apiVersion": 2,
    44    "name": "google-site-kit/sign-in-with-google",
    5     "version": "1.163.0",
     5    "version": "1.164.0",
    66    "title": "Sign in with Google",
    77    "category": "widgets",
  • google-site-kit/trunk/dist/manifest.php

    r3373932 r3381521  
    99return array(
    1010    'googlesitekit-consent-mode'                                      => array( "googlesitekit-consent-mode-bc2e26cfa69fcd4a8261.js", null ),
    11     'googlesitekit-events-provider-contact-form-7'                    => array( "googlesitekit-events-provider-contact-form-7-4ce15f19b39e8d338e84.js", null ),
    12     'googlesitekit-events-provider-easy-digital-downloads'            => array( "googlesitekit-events-provider-easy-digital-downloads-68ebca75a7f452c38292.js", null ),
    13     'googlesitekit-events-provider-mailchimp'                         => array( "googlesitekit-events-provider-mailchimp-6c323aa9d38a48a4958a.js", null ),
    14     'googlesitekit-events-provider-ninja-forms'                       => array( "googlesitekit-events-provider-ninja-forms-6ebd2ddd813bfd42f15d.js", null ),
    15     'googlesitekit-events-provider-optin-monster'                     => array( "googlesitekit-events-provider-optin-monster-79041316fce555e24465.js", null ),
    16     'googlesitekit-events-provider-popup-maker'                       => array( "googlesitekit-events-provider-popup-maker-27e8987202d972244270.js", null ),
    17     'googlesitekit-events-provider-woocommerce'                       => array( "googlesitekit-events-provider-woocommerce-45c7b122796412f75851.js", null ),
    18     'googlesitekit-events-provider-wpforms'                           => array( "googlesitekit-events-provider-wpforms-3a5081f8ff3f186e8aa8.js", null ),
     11    'googlesitekit-events-provider-contact-form-7'                    => array( "googlesitekit-events-provider-contact-form-7-858d8c72283d3fbfaa98.js", null ),
     12    'googlesitekit-events-provider-easy-digital-downloads'            => array( "googlesitekit-events-provider-easy-digital-downloads-85026152b9292f580065.js", null ),
     13    'googlesitekit-events-provider-mailchimp'                         => array( "googlesitekit-events-provider-mailchimp-a4f9d772bc64ad5b383c.js", null ),
     14    'googlesitekit-events-provider-ninja-forms'                       => array( "googlesitekit-events-provider-ninja-forms-aa24820311d3e4ff028a.js", null ),
     15    'googlesitekit-events-provider-optin-monster'                     => array( "googlesitekit-events-provider-optin-monster-492972356bb4b9b04218.js", null ),
     16    'googlesitekit-events-provider-popup-maker'                       => array( "googlesitekit-events-provider-popup-maker-3e08ae2a503322243ba6.js", null ),
     17    'googlesitekit-events-provider-woocommerce'                       => array( "googlesitekit-events-provider-woocommerce-56777fd664fb7392edc2.js", null ),
     18    'googlesitekit-events-provider-wpforms'                           => array( "googlesitekit-events-provider-wpforms-9774e7805b244d82c869.js", null ),
    1919    'googlesitekit-i18n'                                              => array( "googlesitekit-i18n-f0c172b703253d0876a2.js", null ),
    2020    'analytics-advanced-tracking'                                     => array( "analytics-advanced-tracking-78f90889e2d99b97b685.js", null ),
     
    2828    'sign-in-with-google/index'                                       => array( "sign-in-with-google/index.js", null ),
    2929    'sign-in-with-google/editor-styles'                               => array( "sign-in-with-google/editor-styles.js", null ),
    30     'googlesitekit-admin-css'                                         => array( "googlesitekit-admin-css-22f04508597b8290d7e0.min.css", null ),
     30    'googlesitekit-admin-css'                                         => array( "googlesitekit-admin-css-0aa580d3c352ea32302e.min.css", null ),
    3131    'googlesitekit-adminbar-css'                                      => array( "googlesitekit-adminbar-css-d193e67e2cbecf306061.min.css", null ),
    3232    'googlesitekit-wp-dashboard-css'                                  => array( "googlesitekit-wp-dashboard-css-bd43e70c4bc5ecdc3695.min.css", null ),
    3333    'googlesitekit-authorize-application-css'                         => array( "googlesitekit-authorize-application-css-5b98b536e7f34c6411c1.min.css", null ),
    34     'googlesitekit-api'                                               => array( "googlesitekit-api-ac769981f51f9f187c4c.js", null ),
     34    'googlesitekit-api'                                               => array( "googlesitekit-api-5415d897f4cfe6af537a.js", null ),
    3535    'googlesitekit-data'                                              => array( "googlesitekit-data-a82cf53783cfc2587cae.js", null ),
    36     'googlesitekit-datastore-site'                                    => array( "googlesitekit-datastore-site-6e78d505525c43d1fee7.js", null ),
    37     'googlesitekit-datastore-user'                                    => array( "googlesitekit-datastore-user-a396bbd484143910c364.js", null ),
    38     'googlesitekit-datastore-forms'                                   => array( "googlesitekit-datastore-forms-1319eab27227c2d58008.js", null ),
     36    'googlesitekit-datastore-site'                                    => array( "googlesitekit-datastore-site-4fab9d4e493df1a7b75f.js", null ),
     37    'googlesitekit-datastore-user'                                    => array( "googlesitekit-datastore-user-9fbfa20e271014903635.js", null ),
     38    'googlesitekit-datastore-forms'                                   => array( "googlesitekit-datastore-forms-bb68e468edb671baec08.js", null ),
    3939    'googlesitekit-datastore-location'                                => array( "googlesitekit-datastore-location-a7fd5d1461e0562c934a.js", null ),
    40     'googlesitekit-datastore-ui'                                      => array( "googlesitekit-datastore-ui-02503b56b2bd8add7e48.js", null ),
    41     'googlesitekit-modules'                                           => array( "googlesitekit-modules-4dcef8d0c286e503409c.js", null ),
    42     'googlesitekit-notifications'                                     => array( "googlesitekit-notifications-c2d019e9ab99a53a8028.js", null ),
    43     'googlesitekit-widgets'                                           => array( "googlesitekit-widgets-cbc1910ab4a3eef79c0e.js", null ),
    44     'googlesitekit-modules-ads'                                       => array( "googlesitekit-modules-ads-c39576b28ea4de825758.js", null ),
    45     'googlesitekit-modules-adsense'                                   => array( "googlesitekit-modules-adsense-3d9f7107475b5c2c6074.js", null ),
    46     'googlesitekit-modules-analytics-4'                               => array( "googlesitekit-modules-analytics-4-414f4fdb74d373dae6a9.js", null ),
    47     'googlesitekit-modules-pagespeed-insights'                        => array( "googlesitekit-modules-pagespeed-insights-1a1b2161305dced52b73.js", null ),
    48     'googlesitekit-modules-reader-revenue-manager'                    => array( "googlesitekit-modules-reader-revenue-manager-ef0ee7bce6226a1397c1.js", null ),
    49     'googlesitekit-modules-search-console'                            => array( "googlesitekit-modules-search-console-88df71db4afc90a1ac90.js", null ),
    50     'googlesitekit-modules-sign-in-with-google'                       => array( "googlesitekit-modules-sign-in-with-google-d495f188f813c853af6a.js", null ),
    51     'googlesitekit-modules-tagmanager'                                => array( "googlesitekit-modules-tagmanager-e6521a0e9e254258edf6.js", null ),
    52     'googlesitekit-user-input'                                        => array( "googlesitekit-user-input-94a34d10e61746440cf4.js", null ),
    53     'googlesitekit-ad-blocking-recovery'                              => array( "googlesitekit-ad-blocking-recovery-c13f02312d76d6e6ad4b.js", null ),
     40    'googlesitekit-datastore-ui'                                      => array( "googlesitekit-datastore-ui-c4f0c0ecf7e603d255ac.js", null ),
     41    'googlesitekit-modules'                                           => array( "googlesitekit-modules-0a1c37f4c7f1ccba2e70.js", null ),
     42    'googlesitekit-notifications'                                     => array( "googlesitekit-notifications-3b99b45672b70fa6c0c3.js", null ),
     43    'googlesitekit-widgets'                                           => array( "googlesitekit-widgets-89e6cf33318a2b4218b2.js", null ),
     44    'googlesitekit-modules-ads'                                       => array( "googlesitekit-modules-ads-3afd4c0d0448a6b9e55d.js", null ),
     45    'googlesitekit-modules-adsense'                                   => array( "googlesitekit-modules-adsense-ff252ea79a88ca6ed113.js", null ),
     46    'googlesitekit-modules-analytics-4'                               => array( "googlesitekit-modules-analytics-4-a3afd3f605d1d6cee9ae.js", null ),
     47    'googlesitekit-modules-pagespeed-insights'                        => array( "googlesitekit-modules-pagespeed-insights-a520ab4105bdb8b21f4b.js", null ),
     48    'googlesitekit-modules-reader-revenue-manager'                    => array( "googlesitekit-modules-reader-revenue-manager-3f5c91790bc27a05a1af.js", null ),
     49    'googlesitekit-modules-search-console'                            => array( "googlesitekit-modules-search-console-e91f3b157dee1fcc67f4.js", null ),
     50    'googlesitekit-modules-sign-in-with-google'                       => array( "googlesitekit-modules-sign-in-with-google-b45a6047e0a41d61dea8.js", null ),
     51    'googlesitekit-modules-tagmanager'                                => array( "googlesitekit-modules-tagmanager-94a8d4227d2d26a44073.js", null ),
     52    'googlesitekit-user-input'                                        => array( "googlesitekit-user-input-066d7b88b430e4488323.js", null ),
     53    'googlesitekit-ad-blocking-recovery'                              => array( "googlesitekit-ad-blocking-recovery-720a286901e7b9d4dce3.js", null ),
    5454    'googlesitekit-block-tracking'                                    => array( "googlesitekit-block-tracking-1032e2e997b7685502b9.js", null ),
    5555    'googlesitekit-polyfills'                                         => array( "googlesitekit-polyfills-8b59b9627a8949df6deb.js", null ),
    56     'googlesitekit-components'                                        => array( "googlesitekit-components-8e484a48327f6b8ac232.js", null ),
    57     'googlesitekit-metric-selection'                                  => array( "googlesitekit-metric-selection-2852508a03964403b9b5.js", null ),
    58     'googlesitekit-key-metrics-setup'                                 => array( "googlesitekit-key-metrics-setup-1d4b4a3d18ab38d2858e.js", null ),
    59     'googlesitekit-activation'                                        => array( "googlesitekit-activation-7d8375e148518ec2e1b6.js", null ),
    60     'googlesitekit-adminbar'                                          => array( "googlesitekit-adminbar-35777edd8b27cc812b2b.js", null ),
    61     'googlesitekit-settings'                                          => array( "googlesitekit-settings-beb6719616e97ff17ebe.js", null ),
    62     'googlesitekit-main-dashboard'                                    => array( "googlesitekit-main-dashboard-548515dec90eb91159ff.js", null ),
    63     'googlesitekit-entity-dashboard'                                  => array( "googlesitekit-entity-dashboard-24e2fedfe7d84f208918.js", null ),
    64     'googlesitekit-splash'                                            => array( "googlesitekit-splash-5ba2224fcefddcc4c1d9.js", null ),
    65     'googlesitekit-wp-dashboard'                                      => array( "googlesitekit-wp-dashboard-aa7ac49c90b9b7f5aefc.js", null ),
    66     'googlesitekit-runtime'                                           => array( "runtime-bb64756252a68ebcdd2b.js", null ),
    67     'googlesitekit-vendor'                                            => array( "googlesitekit-vendor-ed1386e2b6878f804739.js", null ),
     56    'googlesitekit-components'                                        => array( "googlesitekit-components-3b61eacd2cb133eb7a54.js", null ),
     57    'googlesitekit-metric-selection'                                  => array( "googlesitekit-metric-selection-42ec83a16098134bfe05.js", null ),
     58    'googlesitekit-key-metrics-setup'                                 => array( "googlesitekit-key-metrics-setup-af470800b816f945f2ea.js", null ),
     59    'googlesitekit-activation'                                        => array( "googlesitekit-activation-265f42c4861de8dd5530.js", null ),
     60    'googlesitekit-adminbar'                                          => array( "googlesitekit-adminbar-516a7ae64b1fbe0dc86d.js", null ),
     61    'googlesitekit-settings'                                          => array( "googlesitekit-settings-b48696b40ea99bbb1ab5.js", null ),
     62    'googlesitekit-main-dashboard'                                    => array( "googlesitekit-main-dashboard-8c022ca3fc37671d18b6.js", null ),
     63    'googlesitekit-entity-dashboard'                                  => array( "googlesitekit-entity-dashboard-ff6cd35270edba385955.js", null ),
     64    'googlesitekit-splash'                                            => array( "googlesitekit-splash-4c8bdca6bedb04bc4242.js", null ),
     65    'googlesitekit-wp-dashboard'                                      => array( "googlesitekit-wp-dashboard-0e2822cc1689ca577f29.js", null ),
     66    'googlesitekit-runtime'                                           => array( "runtime-4300400569c01237fc9a.js", null ),
     67    'googlesitekit-vendor'                                            => array( "googlesitekit-vendor-599848015879dcc843df.js", null ),
    6868);
  • google-site-kit/trunk/google-site-kit.php

    r3373932 r3381521  
    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.163.0
     14 * Version:           1.164.0
    1515 * Requires at least: 5.2
    1616 * Requires PHP:      7.4
     
    2727
    2828// Define most essential constants.
    29 define( 'GOOGLESITEKIT_VERSION', '1.163.0' );
     29define( 'GOOGLESITEKIT_VERSION', '1.164.0' );
    3030define( 'GOOGLESITEKIT_PLUGIN_MAIN_FILE', __FILE__ );
    3131define( 'GOOGLESITEKIT_PHP_MINIMUM', '7.4.0' );
  • google-site-kit/trunk/includes/Core/Assets/Assets.php

    r3373932 r3381521  
    775775            'isNetworkMode'     => $this->context->is_network_mode(),
    776776            'timezone'          => get_option( 'timezone_string' ),
     777            'startOfWeek'       => (int) get_option( 'start_of_week' ),
    777778            'siteName'          => wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ),
    778779            'siteLocale'        => $this->context->get_locale(),
     
    875876                'id'      => $current_user->ID,
    876877                'email'   => $current_user->user_email,
     878                'wpEmail' => $current_user->user_email, // Preserved for features that need the original WP email (email gets overridden during proxy auth).
    877879                'name'    => $current_user->display_name,
    878880                'picture' => get_avatar_url( $current_user->user_email ),
  • google-site-kit/trunk/includes/Core/Conversion_Tracking/Conversion_Event_Providers/Easy_Digital_Downloads.php

    r3127664 r3381521  
    1313use Google\Site_Kit\Core\Assets\Script;
    1414use Google\Site_Kit\Core\Conversion_Tracking\Conversion_Events_Provider;
     15use Google\Site_Kit\Core\Util\Feature_Flags;
     16use Google\Site_Kit\Core\Util\Method_Proxy_Trait;
     17use Google\Site_Kit\Modules\Ads\Enhanced_Conversions;
    1518
    1619/**
     
    2326class Easy_Digital_Downloads extends Conversion_Events_Provider {
    2427
     28    use Method_Proxy_Trait;
     29
    2530    const CONVERSION_EVENT_PROVIDER_SLUG = 'easy-digital-downloads';
    2631
     
    4449     */
    4550    public function get_event_names() {
    46         return array( 'add_to_cart' );
     51        $event_names = array( 'add_to_cart' );
     52
     53        if ( Feature_Flags::enabled( 'gtagUserData' ) ) {
     54            $event_names[] = 'purchase';
     55        }
     56
     57        return $event_names;
    4758    }
    4859
     
    6879        return $script;
    6980    }
     81
     82    /**
     83     * Registers hooks for the Easy Digital Downloads provider.
     84     *
     85     * @since 1.164.0
     86     */
     87    public function register_hooks() {
     88        if ( Feature_Flags::enabled( 'gtagUserData' ) ) {
     89            add_action(
     90                'wp_footer',
     91                $this->get_method_proxy( 'maybe_add_purchase_data_from_session' )
     92            );
     93        }
     94    }
     95
     96    /**
     97     * Prints the purchase data.
     98     *
     99     * @since 1.164.0
     100     */
     101    protected function maybe_add_purchase_data_from_session() {
     102        if ( ! function_exists( 'edd_get_purchase_session' ) || ! function_exists( 'edd_is_success_page' ) || ! edd_is_success_page() ) {
     103            return;
     104        }
     105
     106        $purchase_session = edd_get_purchase_session();
     107        $purchase_data    = $this->get_enhanced_conversions_data_from_session( $purchase_session );
     108
     109        wp_add_inline_script(
     110            'googlesitekit-events-provider-' . self::CONVERSION_EVENT_PROVIDER_SLUG,
     111            join(
     112                "\n",
     113                array(
     114                    'window._googlesitekit.edddata = window._googlesitekit.edddata || {};',
     115                    sprintf( 'window._googlesitekit.edddata.purchase = %s;', wp_json_encode( $purchase_data ) ),
     116                )
     117            ),
     118            'before'
     119        );
     120    }
     121
     122
     123    /**
     124     * Extracts Enhanced Conversions data from an EDD session.
     125     *
     126     * @since 1.164.0
     127     *
     128     * @param mixed|array|null $session_data An array containing EDD purchase session data.
     129     *
     130     * @return array
     131     */
     132    protected function get_enhanced_conversions_data_from_session( $session_data ) {
     133        if ( ! is_array( $session_data ) ) {
     134            return array();
     135        }
     136
     137        $user_data = $this->extract_user_data_from_session( $session_data );
     138
     139        if ( empty( $user_data ) ) {
     140            return array();
     141        }
     142
     143        return array(
     144            'user_data' => $user_data,
     145        );
     146    }
     147
     148
     149    /**
     150     * Extracts user data from an EDD session.
     151     *
     152     * @since 1.164.0
     153     *
     154     * @param array $session_data An array containing EDD purchase session data.
     155     *
     156     * @return array
     157     */
     158    protected function extract_user_data_from_session( $session_data ) {
     159        $user_data    = array();
     160        $address_data = array();
     161
     162        if ( isset( $session_data['user_info'] ) ) {
     163            $email = $session_data['user_info']['email'] ?? $session_data['user_email'] ?? '';
     164
     165            if ( ! empty( $email ) ) {
     166                $user_data['email'] = Enhanced_Conversions::get_normalized_email( $email );
     167            }
     168
     169            if ( ! empty( $session_data['user_info']['first_name'] ) ) {
     170                $address_data['first_name'] = Enhanced_Conversions::get_normalized_value( $session_data['user_info']['first_name'] );
     171            }
     172
     173            if ( ! empty( $session_data['user_info']['last_name'] ) ) {
     174                $address_data['last_name'] = Enhanced_Conversions::get_normalized_value( $session_data['user_info']['last_name'] );
     175            }
     176
     177            if ( isset( $session_data['user_info']['address'] ) ) {
     178
     179                if ( ! empty( $session_data['user_info']['address']['phone'] ) ) {
     180                    $user_data['phone_number'] = Enhanced_Conversions::get_normalized_value( $session_data['user_info']['address']['phone'] );
     181                }
     182
     183                if ( ! empty( $session_data['user_info']['address']['line1'] ) ) {
     184                    $address_data['street'] = Enhanced_Conversions::get_normalized_value( $session_data['user_info']['address']['line1'] );
     185                }
     186
     187                if ( ! empty( $session_data['user_info']['address']['city'] ) ) {
     188                    $address_data['city'] = Enhanced_Conversions::get_normalized_value( $session_data['user_info']['address']['city'] );
     189                }
     190
     191                if ( ! empty( $session_data['user_info']['address']['state'] ) ) {
     192                    $region = $session_data['user_info']['address']['state'];
     193
     194                    // Attempt to get full region name.
     195                    if ( function_exists( 'edd_get_state_name' ) && ! empty( $session_data['user_info']['address']['country'] ) ) {
     196                        $region = edd_get_state_name( $session_data['user_info']['address']['country'], $region );
     197                    }
     198
     199                    $address_data['region'] = Enhanced_Conversions::get_normalized_value( $region );
     200                }
     201
     202                if ( ! empty( $session_data['user_info']['address']['zip'] ) ) {
     203                    $address_data['postal_code'] = Enhanced_Conversions::get_normalized_value( $session_data['user_info']['address']['zip'] );
     204                }
     205
     206                if ( ! empty( $session_data['user_info']['address']['country'] ) ) {
     207                    $address_data['country'] = $session_data['user_info']['address']['country'];
     208                }
     209            }
     210        }
     211
     212        if ( ! empty( $address_data ) ) {
     213            $user_data['address'] = $address_data;
     214        }
     215
     216        return $user_data;
     217    }
    70218}
  • google-site-kit/trunk/includes/Core/User/User.php

    r3366057 r3381521  
    4848
    4949    /**
     50     * Initial_Setup instance.
     51     *
     52     * @since 1.164.0
     53     * @var Initial_Setup
     54     */
     55    private $initial_setup;
     56
     57    /**
    5058     * Constructor.
    5159     *
    5260     * @since 1.134.0
    5361     * @since 1.162.0 Added Proactive User Engagement.
     62     * @since 1.164.0 Added Initial Setup.
    5463     *
    5564     * @param User_Options $user_options User_Options instance.
     
    6271            $this->proactive_user_engagement = new Proactive_User_Engagement( $user_options );
    6372        }
     73
     74        if ( Feature_Flags::enabled( 'setupFlowRefresh' ) ) {
     75            $this->initial_setup = new Initial_Setup( $user_options );
     76        }
    6477    }
    6578
     
    6982     * @since 1.134.0
    7083     * @since 1.162.0 Added Proactive User Engagement.
     84     * @since 1.164.0 Added Initial Setup.
    7185     */
    7286    public function register() {
     
    7791            $this->proactive_user_engagement->register();
    7892        }
     93
     94        if ( Feature_Flags::enabled( 'setupFlowRefresh' ) ) {
     95            $this->initial_setup->register();
     96        }
    7997    }
    8098}
  • google-site-kit/trunk/includes/Modules/Analytics_4.php

    r3373932 r3381521  
    998998        $this->provision_property_webdatastream( $account_id, $account_ticket );
    999999
     1000        if ( Feature_Flags::enabled( 'setupFlowRefresh' ) ) {
     1001            wp_safe_redirect(
     1002                $this->context->admin_url(
     1003                    'key-metrics-setup',
     1004                )
     1005            );
     1006            exit;
     1007        }
     1008
    10001009        wp_safe_redirect(
    10011010            $this->context->admin_url(
  • google-site-kit/trunk/includes/Modules/Sign_In_With_Google.php

    r3349867 r3381521  
    4747use Google\Site_Kit\Modules\Sign_In_With_Google\Web_Tag;
    4848use Google\Site_Kit\Modules\Sign_In_With_Google\WooCommerce_Authenticator;
     49use Google\Site_Kit\Modules\Sign_In_With_Google\Compatibility_Checks\Compatibility_Checks;
     50use Google\Site_Kit\Modules\Sign_In_With_Google\Compatibility_Checks\WP_Login_Accessible_Check;
     51use Google\Site_Kit\Modules\Sign_In_With_Google\Compatibility_Checks\WP_COM_Check;
     52use Google\Site_Kit\Modules\Sign_In_With_Google\Compatibility_Checks\Conflicting_Plugins_Check;
     53use Google\Site_Kit\Modules\Sign_In_With_Google\Datapoint\Compatibility_Checks as Compatibility_Checks_Datapoint;
    4954use WP_Error;
    5055use WP_User;
     
    139144
    140145        add_filter( 'wp_login_errors', array( $this, 'handle_login_errors' ) );
     146
     147        add_action( 'googlesitekit_render_sign_in_with_google_button', array( $this, 'render_sign_in_with_google_button' ), 10, 1 );
    141148
    142149        add_action(
     
    369376
    370377    /**
     378     * Gets the datapoint definitions for the module.
     379     *
     380     * @since 1.164.0
     381     *
     382     * @return array List of datapoint definitions.
     383     */
     384    protected function get_datapoint_definitions() {
     385        $checks = new Compatibility_Checks();
     386        $checks->add_check( new WP_Login_Accessible_Check() );
     387        $checks->add_check( new WP_COM_Check() );
     388        $checks->add_check( new Conflicting_Plugins_Check() );
     389
     390        return array(
     391            'GET:compatibility-checks' => new Compatibility_Checks_Datapoint( array( 'checks' => $checks ) ),
     392        );
     393    }
     394
     395    /**
    371396     * Renders the placeholder Sign in with Google div for the WooCommerce
    372397     * login form.
     
    385410        }
    386411
    387         ?>
    388 <div class="googlesitekit-sign-in-with-google__frontend-output-button woocommerce-form-row form-row"></div>
    389         <?php
     412        /**
     413         * Display the Sign in with Google button.
     414         *
     415         * @since 1.164.0
     416         *
     417         * @param array $args Optional arguments to customize button attributes.
     418         */
     419        do_action(
     420            'googlesitekit_render_sign_in_with_google_button',
     421            array(
     422                'class' => 'woocommerce-form-row form-row',
     423            )
     424        );
    390425    }
    391426
     
    422457    private function render_button_in_wp_login_form( $content ) {
    423458        if ( $this->can_render_signinwithgoogle() ) {
    424             $content .= '<div class="googlesitekit-sign-in-with-google__frontend-output-button"></div>';
     459            ob_start();
     460            /**
     461             * Display the Sign in with Google button.
     462             *
     463             * @since 1.164.0
     464             *
     465             * @param array $args Optional arguments to customize button attributes.
     466             */
     467            do_action( 'googlesitekit_render_sign_in_with_google_button' );
     468            $content .= ob_get_clean();
    425469        }
    426470        return $content;
     471    }
     472
     473    /**
     474     * Renders the Sign in with Google button markup.
     475     *
     476     * @since 1.164.0
     477     *
     478     * @param array $args Optional arguments to customize button attributes.
     479     */
     480    public function render_sign_in_with_google_button( $args = array() ) {
     481        if ( ! is_array( $args ) ) {
     482            $args = array();
     483        }
     484
     485        $default_classes   = array( 'googlesitekit-sign-in-with-google__frontend-output-button' );
     486        $classes_from_args = array();
     487        if ( ! empty( $args['class'] ) ) {
     488            $classes_from_args = is_array( $args['class'] ) ? $args['class'] : preg_split( '/\s+/', (string) $args['class'] );
     489        }
     490
     491        // Merge default HTML class names and class names passed as arguments
     492        // to the action, then sanitize each class name.
     493        $merged_classes    = array_merge( $default_classes, $classes_from_args );
     494        $sanitized_classes = array_map( 'sanitize_html_class', $merged_classes );
     495
     496        // Remove duplicates, empty values, and reindex array.
     497        $classes = array_values( array_unique( array_filter( $sanitized_classes ) ) );
     498
     499        $attributes = array(
     500            // HTML class attribute should be a string.
     501            'class' => implode( ' ', $classes ),
     502        );
     503
     504        $data_attributes = array( 'shape', 'text', 'theme' );
     505        foreach ( $data_attributes as $attribute ) {
     506            if ( empty( $args[ $attribute ] ) || ! is_scalar( $args[ $attribute ] ) ) {
     507                continue;
     508            }
     509
     510            $attributes[ 'data-googlesitekit-siwg-' . strtolower( $attribute ) ] = (string) $args[ $attribute ];
     511        }
     512
     513        $attribute_strings = array();
     514        foreach ( $attributes as $key => $value ) {
     515            $attribute_strings[] = sprintf( '%s="%s"', $key, esc_attr( $value ) );
     516        }
     517
     518        echo '<div ' . implode( ' ', $attribute_strings ) . '></div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    427519    }
    428520
  • google-site-kit/trunk/includes/Modules/Sign_In_With_Google/Settings.php

    r3373932 r3381521  
    8787    protected function get_default() {
    8888        return array(
    89             'clientID'      => '',
    90             'text'          => self::TEXT_SIGN_IN_WITH_GOOGLE['value'],
    91             'theme'         => self::THEME_LIGHT['value'],
    92             'shape'         => self::SHAPE_RECTANGULAR['value'],
    93             'oneTapEnabled' => false,
     89            'clientID'                  => '',
     90            'text'                      => self::TEXT_SIGN_IN_WITH_GOOGLE['value'],
     91            'theme'                     => self::THEME_LIGHT['value'],
     92            'shape'                     => self::SHAPE_RECTANGULAR['value'],
     93            'oneTapEnabled'             => false,
     94            'showNextToCommentsEnabled' => false,
    9495        );
    9596    }
     
    152153            }
    153154
     155            if ( isset( $option['showNextToCommentsEnabled'] ) ) {
     156                $option['showNextToCommentsEnabled'] = (bool) $option['showNextToCommentsEnabled'];
     157            }
     158
    154159            return $option;
    155160        };
  • google-site-kit/trunk/includes/Modules/Sign_In_With_Google/Sign_In_With_Google_Block.php

    r3335509 r3381521  
    8787        }
    8888
    89         return '<div class="googlesitekit-sign-in-with-google__frontend-output-button"></div>';
     89        ob_start();
     90        /**
     91         * Display the Sign in with Google button.
     92         *
     93         * @since 1.164.0
     94         *
     95         * @param array $args Optional arguments to customize button attributes.
     96         */
     97        do_action( 'googlesitekit_render_sign_in_with_google_button' );
     98        return ob_get_clean();
    9099    }
    91100}
  • google-site-kit/trunk/includes/Modules/Sign_In_With_Google/Web_Tag.php

    r3373932 r3381521  
    191191             */
    192192            ?>
    193         document.querySelectorAll( '.googlesitekit-sign-in-with-google__frontend-output-button' ).forEach( ( siwgButtonDiv ) => {
    194             google.accounts.id.renderButton( siwgButtonDiv, <?php echo wp_json_encode( $btn_args ); ?> );
    195         });
     193    const defaultButtonOptions = <?php echo wp_json_encode( $btn_args ); ?>;
     194    document.querySelectorAll( '.googlesitekit-sign-in-with-google__frontend-output-button' ).forEach( ( siwgButtonDiv ) => {
     195        const buttonOptions = {
     196            shape: siwgButtonDiv.getAttribute( 'data-googlesitekit-siwg-shape' ) || defaultButtonOptions.shape,
     197            text: siwgButtonDiv.getAttribute( 'data-googlesitekit-siwg-text' ) || defaultButtonOptions.text,
     198            theme: siwgButtonDiv.getAttribute( 'data-googlesitekit-siwg-theme' ) || defaultButtonOptions.theme,
     199        };
     200
     201        google.accounts.id.renderButton( siwgButtonDiv, buttonOptions );
     202    });
    196203    <?php endif; // phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect ?>
    197204
  • google-site-kit/trunk/includes/vendor/composer/autoload_classmap.php

    r3373932 r3381521  
    208208    'Google\\Site_Kit\\Core\\User\\Conversion_Reporting' => $baseDir . '/Core/User/Conversion_Reporting.php',
    209209    'Google\\Site_Kit\\Core\\User\\Conversion_Reporting_Settings' => $baseDir . '/Core/User/Conversion_Reporting_Settings.php',
     210    'Google\\Site_Kit\\Core\\User\\Initial_Setup' => $baseDir . '/Core/User/Initial_Setup.php',
     211    'Google\\Site_Kit\\Core\\User\\Initial_Setup_Settings' => $baseDir . '/Core/User/Initial_Setup_Settings.php',
    210212    'Google\\Site_Kit\\Core\\User\\Proactive_User_Engagement' => $baseDir . '/Core/User/Proactive_User_Engagement.php',
    211213    'Google\\Site_Kit\\Core\\User\\Proactive_User_Engagement_Settings' => $baseDir . '/Core/User/Proactive_User_Engagement_Settings.php',
    212214    'Google\\Site_Kit\\Core\\User\\REST_Audience_Settings_Controller' => $baseDir . '/Core/User/REST_Audience_Settings_Controller.php',
    213215    'Google\\Site_Kit\\Core\\User\\REST_Conversion_Reporting_Controller' => $baseDir . '/Core/User/REST_Conversion_Reporting_Controller.php',
     216    'Google\\Site_Kit\\Core\\User\\REST_Initial_Setup_Controller' => $baseDir . '/Core/User/REST_Initial_Setup_Controller.php',
    214217    'Google\\Site_Kit\\Core\\User\\REST_Proactive_User_Engagement_Controller' => $baseDir . '/Core/User/REST_Proactive_User_Engagement_Controller.php',
    215218    'Google\\Site_Kit\\Core\\User\\User' => $baseDir . '/Core/User/User.php',
     
    340343    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Authenticator' => $baseDir . '/Modules/Sign_In_With_Google/Authenticator.php',
    341344    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Authenticator_Interface' => $baseDir . '/Modules/Sign_In_With_Google/Authenticator_Interface.php',
     345    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Compatibility_Checks\\Compatibility_Check' => $baseDir . '/Modules/Sign_In_With_Google/Compatibility_Checks/Compatibility_Check.php',
     346    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Compatibility_Checks\\Compatibility_Checks' => $baseDir . '/Modules/Sign_In_With_Google/Compatibility_Checks/Compatibility_Checks.php',
     347    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Compatibility_Checks\\Conflicting_Plugins_Check' => $baseDir . '/Modules/Sign_In_With_Google/Compatibility_Checks/Conflicting_Plugins_Check.php',
     348    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Compatibility_Checks\\WP_COM_Check' => $baseDir . '/Modules/Sign_In_With_Google/Compatibility_Checks/WP_COM_Check.php',
     349    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Compatibility_Checks\\WP_Login_Accessible_Check' => $baseDir . '/Modules/Sign_In_With_Google/Compatibility_Checks/WP_Login_Accessible_Check.php',
     350    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Datapoint\\Compatibility_Checks' => $baseDir . '/Modules/Sign_In_With_Google/Datapoint/Compatibility_Checks.php',
    342351    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Existing_Client_ID' => $baseDir . '/Modules/Sign_In_With_Google/Existing_Client_ID.php',
    343352    'Google\\Site_Kit\\Modules\\Sign_In_With_Google\\Hashed_User_ID' => $baseDir . '/Modules/Sign_In_With_Google/Hashed_User_ID.php',
  • google-site-kit/trunk/readme.txt

    r3373932 r3381521  
    55Tested up to:      6.8
    66Requires PHP:      7.4
    7 Stable tag:        1.163.0
     7Stable tag:        1.164.0
    88License:           Apache License 2.0
    99License URI:       https://www.apache.org/licenses/LICENSE-2.0
     
    110110== Changelog ==
    111111
    112 = 1.163.0 =
     112= 1.164.0 =
     113
     114**Added**
     115
     116* Add setting for using Sign in with Google for WordPress comments. See [#11472](https://github.com/google/site-kit-wp/issues/11472).
     117* Add One-Tap to Sign in with Google setup when user registrations are open. See [#11469](https://github.com/google/site-kit-wp/issues/11469).
    113118
    114119**Enhanced**
    115120
    116 * Update `service_version` to `v3` in proxy metadata when the `setupFlowRefresh` feature flag is enabled. See [#11488](https://github.com/google/site-kit-wp/issues/11488).
    117 * Add "manage email reports" link for Proactive User Engagement feature. See [#11423](https://github.com/google/site-kit-wp/issues/11423).
    118 * Implement Conversion Events, ABR, Consent Mode, SiwG and Key Metrics feature metrics tracking. See [#11422](https://github.com/google/site-kit-wp/issues/11422).
    119 * Implement Audience Segmentation, AdSense reporting, Dashboard Sharing and RRM feature metrics tracking. See [#11421](https://github.com/google/site-kit-wp/issues/11421).
    120 * Add the `googlesitekit-key-metrics-setup` screen, with stub content. See [#11373](https://github.com/google/site-kit-wp/issues/11373).
    121 * Ensure the `analytics.edit` scope is included in the set of required scopes for the Analytics module when the `setupFlowRefresh` feature flag is enabled. See [#11372](https://github.com/google/site-kit-wp/issues/11372).
    122 * Conditionally display a “Search Console was successfully set up” toast notification on the Analytics setup screen. See [#11339](https://github.com/google/site-kit-wp/issues/11339).
    123 * Create `ToastNotice`, a generic component for displaying short-lived "toast" messages. See [#11338](https://github.com/google/site-kit-wp/issues/11338).
    124 * Ensure all occurrences of the term "consent mode" have the correct casing. Props cnaples79. See [#11076](https://github.com/google/site-kit-wp/issues/11076).
    125 * Revise the wording on the "Congrats on completing the setup for Site Kit!" banner. See [#9001](https://github.com/google/site-kit-wp/issues/9001).
    126 
    127 **Changed**
    128 
    129 * Consolidate One-tap settings to a single setting. See [#11466](https://github.com/google/site-kit-wp/issues/11466).
    130 * Update version of NodeJS used to build Site Kit. See [#6026](https://github.com/google/site-kit-wp/issues/6026).
     121* Add client side compatibility checks for Sign in with Google. See [#11505](https://github.com/google/site-kit-wp/issues/11505).
     122* Add ability to load Sign in with Google compatibility checks from Site Kit. See [#11463](https://github.com/google/site-kit-wp/issues/11463).
     123* Add support for detecting plugins/hosting environments incompatible with Sign in with Google. See [#11458](https://github.com/google/site-kit-wp/issues/11458).
     124* Add third-party support for the Sign in with Google button via a WordPress Action: `do_action( 'googlesitekit_render_sign_in_with_google_button' )`. See [#11455](https://github.com/google/site-kit-wp/issues/11455).
     125* Add the email reporting settings selection panel. See [#11424](https://github.com/google/site-kit-wp/issues/11424).
     126* Add API and data store infrastructure to preserve initial settings accompanying the new setup flow. See [#11387](https://github.com/google/site-kit-wp/issues/11387).
     127* Add Analytics setup success toast notice in the Key Metrics setup screen. See [#11384](https://github.com/google/site-kit-wp/issues/11384).
     128* Display the progress indicator on the Analytics setup screen when it's navigated to in the new setup flow. See [#11379](https://github.com/google/site-kit-wp/issues/11379).
     129* Add the progress indicator to the new version of the splash screen. See [#11378](https://github.com/google/site-kit-wp/issues/11378).
     130* Add a `ProgressIndicator` component to display progressions in user flows. See [#11377](https://github.com/google/site-kit-wp/issues/11377).
     131* Redirect users to the Key Metrics setup screen after successfully connecting Analytics when the `setupFlowRefresh` feature flag is enabled. See [#11375](https://github.com/google/site-kit-wp/issues/11375).
     132* Add Key Metrics setup screen with site purpose questionnaire and dashboard redirection functionality. See [#11374](https://github.com/google/site-kit-wp/issues/11374).
     133* Implement the foundation for the forthcoming splash screen update. See [#11333](https://github.com/google/site-kit-wp/issues/11333).
     134* Add a selector to allow users to customize frequency of reports when Proactive User Engagement is enabled. See [#11155](https://github.com/google/site-kit-wp/issues/11155).
     135* Add the email reporting overlay notification. See [#11147](https://github.com/google/site-kit-wp/issues/11147).
     136* Add Enhanced Conversions support for Mailchimp for WordPress by capturing and sending user data. See [#11127](https://github.com/google/site-kit-wp/issues/11127).
     137* Add Enhanced Conversions support for OptinMonster by capturing and sending user data. See [#11126](https://github.com/google/site-kit-wp/issues/11126).
     138* Add Enhanced Conversions support for Easy Digital Downloads by capturing and sending user data. See [#11011](https://github.com/google/site-kit-wp/issues/11011).
     139* Add "Learn more" link to Visitor Groups notification banner. See [#10964](https://github.com/google/site-kit-wp/issues/10964).
     140* Include Reader Revenue Manager in the list of services identified by the unsatisfied scopes alert. See [#10797](https://github.com/google/site-kit-wp/issues/10797).
     141* Don't show the "How to Improve" tab in the Pagespeed Insights widget when no recommendations are available. See [#7612](https://github.com/google/site-kit-wp/issues/7612).
     142* Standardize font sizes for Key Metric Widget subheadings. See [#6107](https://github.com/google/site-kit-wp/issues/6107).
    131143
    132144**Fixed**
    133145
    134 * Fix bug that caused sites that may be unable to install Site Kit from seeing a warning message during plugin setup. See [#11574](https://github.com/google/site-kit-wp/issues/11574).
    135 * Prevent the checkbox hover/focus state from being clipped on the Ad Blocking Recovery screen. See [#11309](https://github.com/google/site-kit-wp/issues/11309).
    136 * Fix bug that could cause Enhanced Conversion Tracking to be enabled when it shouldn't be after OAuth login. See [#11196](https://github.com/google/site-kit-wp/issues/11196).
     146* Fix Reader Revenue Manager setup screen displaying empty content when API errors occur. See [#11581](https://github.com/google/site-kit-wp/issues/11581).
     147* Add "pinned notifications" to the notifications API, and use it to ensure the Audience Segmentation and Enhanced Measurement setup banners continue to be shown when returning from OAuth. See [#10890](https://github.com/google/site-kit-wp/issues/10890).
    137148
    138149[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.