diff --git a/projects/packages/google-analytics/changelog/update-move-google-analytics-apis b/projects/packages/google-analytics/changelog/update-move-google-analytics-apis new file mode 100644 index 0000000000000..91029d87f6988 --- /dev/null +++ b/projects/packages/google-analytics/changelog/update-move-google-analytics-apis @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Add the GA API handling moved from Jetpack. diff --git a/projects/packages/google-analytics/composer.json b/projects/packages/google-analytics/composer.json index 023b775759583..0c3966e0d2e42 100644 --- a/projects/packages/google-analytics/composer.json +++ b/projects/packages/google-analytics/composer.json @@ -4,7 +4,8 @@ "type": "jetpack-library", "license": "GPL-2.0-or-later", "require": { - "php": ">=7.0" + "php": ">=7.0", + "automattic/jetpack-status": "@dev" }, "require-dev": { "yoast/phpunit-polyfills": "1.1.0", @@ -42,7 +43,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "0.1.x-dev" + "dev-trunk": "0.2.x-dev" }, "changelogger": { "link-template": "https://github.com/Automattic/jetpack-google-analytics/compare/v${old}...v${new}" diff --git a/projects/packages/google-analytics/package.json b/projects/packages/google-analytics/package.json index 46c6c8579bdec..27bebca220893 100644 --- a/projects/packages/google-analytics/package.json +++ b/projects/packages/google-analytics/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-google-analytics", - "version": "0.1.0", + "version": "0.2.0-alpha", "description": "Set up Google Analytics without touching a line of code.", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/google-analytics/#readme", "bugs": { diff --git a/projects/packages/google-analytics/src/class-ga-manager.php b/projects/packages/google-analytics/src/class-ga-manager.php index c2677af93b000..c2b08c9a517ef 100644 --- a/projects/packages/google-analytics/src/class-ga-manager.php +++ b/projects/packages/google-analytics/src/class-ga-manager.php @@ -10,12 +10,15 @@ namespace Automattic\Jetpack\Google_Analytics; +use Automattic\Jetpack\Modules; +use WP_Error; + /** * The Facade class of the package. */ class GA_Manager { - const PACKAGE_VERSION = '0.1.0'; + const PACKAGE_VERSION = '0.2.0-alpha'; /** * Jetpack_Google_Analytics singleton instance. @@ -31,6 +34,34 @@ class GA_Manager { */ public static $analytics = false; + /** + * Defaults for the API version >=1.3. + * + * @var array + */ + private $api_defaults = array( + '1.3' => array( + 'code' => '', + 'anonymize_ip' => false, + 'ec_track_purchases' => false, + 'ec_track_add_to_cart' => false, + ), + '1.4' => array( + 'is_active' => false, // This default value will most likely be overwritten by the current status of the GA module. + 'code' => '', + 'anonymize_ip' => false, + 'honor_dnt' => false, + 'ec_track_purchases' => false, + 'ec_track_add_to_cart' => false, + 'enh_ec_tracking' => false, + 'enh_ec_track_remove_from_cart' => false, + 'enh_ec_track_prod_impression' => false, + 'enh_ec_track_prod_click' => false, + 'enh_ec_track_prod_detail_view' => false, + 'enh_ec_track_checkout_started' => false, + ), + ); + /** * This is our constructor, which is private to force the use of get_instance() * @@ -46,6 +77,12 @@ private function __construct() { } else { self::$analytics = new Legacy(); } + + add_filter( 'site_settings_endpoint_get', array( $this, 'site_settings_fetch' ), 10, 2 ); + add_filter( 'site_settings_endpoint_update_wga', array( $this, 'site_settings_update' ), 10, 2 ); + add_filter( 'site_settings_endpoint_update_jetpack_wga', array( $this, 'site_settings_update' ) ); + add_action( 'jetpack_activate_module_google-analytics', array( $this, 'set_status_from_module' ) ); + add_action( 'jetpack_deactivate_module_google-analytics', array( $this, 'set_status_from_module' ) ); } /** @@ -59,6 +96,159 @@ public static function get_instance() { return self::$instance; } + /** + * Includes the GA settings into site settings during a fetch request. + * + * @phan-suppress PhanUndeclaredTypeParameter,PhanUndeclaredClassInstanceof,PhanUndeclaredClassProperty + * + * @param array $settings The fetched settings. + * @param \WPCOM_JSON_API_Site_Settings_Endpoint $api_handler The API handler object. + * + * @return array|mixed + */ + public function site_settings_fetch( $settings = array(), $api_handler = null ) { + if ( ! is_array( $settings ) || ! $api_handler instanceof \WPCOM_JSON_API_Site_Settings_Endpoint ) { + // Safeguard against something that should never happen. + return $settings; + } + + $settings['wga'] = $this->get_google_analytics_settings(); + + if ( array_key_exists( $api_handler->min_version, $this->api_defaults ) ) { + $settings['wga'] = wp_parse_args( $settings['wga'], $this->api_defaults[ $api_handler->min_version ] ); + } + + return $settings; + } + + /** + * Modifies the GA settings into site settings during an update request. + * + * @phan-suppress PhanUndeclaredTypeParameter,PhanUndeclaredClassInstanceof,PhanUndeclaredClassProperty + * + * @param array $value The settings to update. + * @param \WPCOM_JSON_API_Site_Settings_Endpoint $api_handler The API handler object. + * + * @return array|mixed + */ + public function site_settings_update( $value, $api_handler = null ) { + if ( ! is_array( $value ) || ! $api_handler instanceof \WPCOM_JSON_API_Site_Settings_Endpoint ) { + // This should never happen. + return $value; + } + + if ( ! isset( $value['code'] ) || ! preg_match( '/^$|^(UA-\d+-\d+)|(G-[A-Z0-9]+)$/i', $value['code'] ) ) { + return new WP_Error( 'invalid_code', 'Invalid UA ID' ); + } + + $option_name = $this->get_google_analytics_option_name(); + + $wga = get_option( $option_name, array() ); + $wga['code'] = $value['code']; + + if ( ! array_key_exists( 'is_active', $wga ) ) { + // The `is_active` flag is missing from the settings, add a default value based on the module status. + $wga['is_active'] = ( new Modules() )->is_active( 'google-analytics', false ); + } + + /** + * Allow newer versions of this endpoint to filter in additional fields for Google Analytics + * + * @since Jetpack 5.4.0 + * @since $$next-version$$ + * + * @param array $wga Associative array of existing Google Analytics settings. + * @param array $value Associative array of new Google Analytics settings passed to the endpoint. + */ + $wga = apply_filters( 'site_settings_update_wga', $wga, $value ); + + if ( array_key_exists( $api_handler->min_version, $this->api_defaults ) ) { + $wga_keys = array_keys( $this->api_defaults[ $api_handler->min_version ] ); + foreach ( $wga_keys as $wga_key ) { + // Skip code since it's already handled. + if ( 'code' === $wga_key ) { + continue; + } + + // All our new keys are booleans, so let's coerce each key's value + // before updating the value in settings + if ( array_key_exists( $wga_key, $value ) ) { + $wga[ $wga_key ] = Utils::is_truthy( $value[ $wga_key ] ); + } + } + } + + $is_updated = update_option( $option_name, $wga ); + + $enabled_or_disabled = $wga['code'] ? 'enabled' : 'disabled'; + + /** + * Fires for each settings update. + * + * @since Jetpack 3.6.0 + * @since $$next-version$$ + * + * @param string $action_type Type of settings to track. + * @param string $val The settings value. + */ + do_action( 'jetpack_bump_stats_extras', 'google-analytics', $enabled_or_disabled ); + + return $is_updated ? $wga : null; + } + + /** + * Update the `is_active` settings flag depending on the Google Analytics module status. + * + * @return void + */ + public function set_status_from_module() { + $option_name = $this->get_google_analytics_option_name(); + + $wga = get_option( $option_name, array() ); + $is_active = ( new Modules() )->is_active( 'google-analytics', false ); + + if ( $is_active !== $wga['is_active'] ) { + $wga['is_active'] = $is_active; + } + + update_option( $option_name, $wga ); + } + + /** + * Get the GA settings option name. + * + * @return string + */ + public function get_google_analytics_option_name() { + /** + * Filter whether the current site is a Jetpack site. + * + * @since Jetpack 3.3.0 + * @since $$next-version$$ + * + * @param bool $is_jetpack Is the current site a Jetpack site. Default to false. + * @param int $blog_id Blog ID. + */ + $is_jetpack = true === apply_filters( 'is_jetpack_site', false, get_current_blog_id() ); + return $is_jetpack ? 'jetpack_wga' : 'wga'; + } + + /** + * Get GA settings. + * + * @return array + */ + public function get_google_analytics_settings() { + $settings = get_option( $this->get_google_analytics_option_name() ); + + // The `is_active` flag is missing from the settings, add a value based on the module status. + if ( is_array( $settings ) && ! array_key_exists( 'is_active', $settings ) ) { + $settings['is_active'] = ( new Modules() )->is_active( 'google-analytics', false ); + } + + return $settings; + } + /** * Add amp-analytics tags. * diff --git a/projects/packages/google-analytics/src/class-utils.php b/projects/packages/google-analytics/src/class-utils.php index 0ee9c08e9ad2b..26a1d0885c8af 100644 --- a/projects/packages/google-analytics/src/class-utils.php +++ b/projects/packages/google-analytics/src/class-utils.php @@ -94,4 +94,36 @@ public static function is_dnt_enabled() { return false; } + + /** + * Determine if a string is truthy. If it's not a string, which can happen with + * not well-formed data coming from Jetpack sites, we still consider it a truthy value. + * + * @since $$next-version$$ + * + * @param mixed $value true, 1, "1", "t", and "true" (case insensitive) are truthy, everything else isn't. + * @return bool + */ + public static function is_truthy( $value ) { + if ( true === $value ) { + return true; + } + + if ( 1 === $value ) { + return true; + } + + if ( ! is_string( $value ) ) { + return false; + } + + switch ( strtolower( $value ) ) { + case '1': + case 't': + case 'true': + return true; + } + + return false; + } } diff --git a/projects/packages/status/changelog/update-move-google-analytics-apis b/projects/packages/status/changelog/update-move-google-analytics-apis new file mode 100644 index 0000000000000..9237447d57e9d --- /dev/null +++ b/projects/packages/status/changelog/update-move-google-analytics-apis @@ -0,0 +1,4 @@ +Significance: patch +Type: added + +Check for active modules among the unavailable ones. diff --git a/projects/packages/status/src/class-modules.php b/projects/packages/status/src/class-modules.php index 670b658fd1378..4418f563c02b3 100644 --- a/projects/packages/status/src/class-modules.php +++ b/projects/packages/status/src/class-modules.php @@ -22,14 +22,16 @@ class Modules { * Check whether or not a Jetpack module is active. * * @param string $module The slug of a Jetpack module. + * @param bool $available_only Whether to only check among available modules. + * * @return bool */ - public function is_active( $module ) { + public function is_active( $module, $available_only = true ) { if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) { return true; } - return in_array( $module, self::get_active(), true ); + return in_array( $module, self::get_active( $available_only ), true ); } /** @@ -184,8 +186,12 @@ public function get_file_data( $file, $headers ) { /** * Get a list of activated modules as an array of module slugs. + * + * @param bool $available_only Filter out the unavailable (deleted) modules. + * + * @return array */ - public function get_active() { + public function get_active( $available_only = true ) { $active = \Jetpack_Options::get_option( 'active_modules' ); if ( ! is_array( $active ) ) { @@ -206,9 +212,11 @@ public function get_active() { $active[] = 'protect'; } - // If it's not available, it shouldn't be active. - // We don't delete it from the options though, as it will be active again when a plugin gets reactivated. - $active = array_intersect( $active, $this->get_available() ); + if ( $available_only ) { + // If it's not available, it shouldn't be active. + // We don't delete it from the options though, as it will be active again when a plugin gets reactivated. + $active = array_intersect( $active, $this->get_available() ); + } /** * Allow filtering of the active modules. diff --git a/projects/plugins/jetpack/.phan/baseline.php b/projects/plugins/jetpack/.phan/baseline.php index 2424568527cd6..d8c4fed09d7c7 100644 --- a/projects/plugins/jetpack/.phan/baseline.php +++ b/projects/plugins/jetpack/.phan/baseline.php @@ -275,7 +275,7 @@ 'json-endpoints/class.wpcom-json-api-render-endpoint.php' => ['PhanPluginSimplifyExpressionBool', 'PhanTypeMismatchArgument'], 'json-endpoints/class.wpcom-json-api-render-shortcode-endpoint.php' => ['PhanNoopNew', 'PhanTypeMismatchReturn'], 'json-endpoints/class.wpcom-json-api-sharing-buttons-endpoint.php' => ['PhanNoopNew', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturn', 'PhanTypePossiblyInvalidDimOffset'], - 'json-endpoints/class.wpcom-json-api-site-settings-endpoint.php' => ['PhanDeprecatedFunction', 'PhanNoopNew', 'PhanParamTooMany', 'PhanRedundantCondition', 'PhanRedundantConditionInLoop', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypePossiblyInvalidDimOffset'], + 'json-endpoints/class.wpcom-json-api-site-settings-endpoint.php' => ['PhanDeprecatedFunction', 'PhanNoopNew', 'PhanParamTooMany', 'PhanRedundantCondition', 'PhanRedundantConditionInLoop', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturn', 'PhanTypePossiblyInvalidDimOffset'], 'json-endpoints/class.wpcom-json-api-site-settings-v1-2-endpoint.php' => ['PhanNoopNew'], 'json-endpoints/class.wpcom-json-api-site-settings-v1-3-endpoint.php' => ['PhanNoopNew'], 'json-endpoints/class.wpcom-json-api-site-settings-v1-4-endpoint.php' => ['PhanNoopNew'], diff --git a/projects/plugins/jetpack/changelog/update-move-google-analytics-apis b/projects/plugins/jetpack/changelog/update-move-google-analytics-apis new file mode 100644 index 0000000000000..6edef052bdda2 --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-move-google-analytics-apis @@ -0,0 +1,4 @@ +Significance: minor +Type: other + +Extract the Google Analytics API into the package. diff --git a/projects/plugins/jetpack/composer.lock b/projects/plugins/jetpack/composer.lock index 6b94e4771a0bd..d492d9427a6ee 100644 --- a/projects/plugins/jetpack/composer.lock +++ b/projects/plugins/jetpack/composer.lock @@ -1347,9 +1347,10 @@ "dist": { "type": "path", "url": "../../packages/google-analytics", - "reference": "0d84900e8c06cdb72abcc2d37f04b3dfdec33034" + "reference": "9aacc5acb62eda87adf12a76dcc1d006103adf5c" }, "require": { + "automattic/jetpack-status": "@dev", "php": ">=7.0" }, "require-dev": { @@ -1364,7 +1365,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "0.1.x-dev" + "dev-trunk": "0.2.x-dev" }, "changelogger": { "link-template": "https://github.com/Automattic/jetpack-google-analytics/compare/v${old}...v${new}" diff --git a/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-site-settings-endpoint.php b/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-site-settings-endpoint.php index e86818642debc..4afafc8f25aec 100644 --- a/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-site-settings-endpoint.php +++ b/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-site-settings-endpoint.php @@ -5,6 +5,7 @@ * @package automattic/jetpack */ +use Automattic\Jetpack\Google_Analytics\GA_Manager; use Automattic\Jetpack\Waf\Brute_Force_Protection\Brute_Force_Protection_Shared_Functions; new WPCOM_JSON_API_Site_Settings_Endpoint( @@ -422,7 +423,6 @@ function ( $newsletter_category ) { ? get_lang_id_by_code( wpcom_l10n_get_blog_locale_variant( $blog_id, true ) ) : get_option( 'lang_id' ), 'site_vertical_id' => (string) get_option( 'site_vertical_id' ), - 'wga' => $this->get_google_analytics(), 'jetpack_cloudflare_analytics' => get_option( 'jetpack_cloudflare_analytics' ), 'disabled_likes' => (bool) get_option( 'disabled_likes' ), 'disabled_reblogs' => (bool) get_option( 'disabled_reblogs' ), @@ -512,10 +512,12 @@ function ( $newsletter_category ) { * @module json-api * * @since 3.9.3 + * @since $$next-version$$ Added the API object parameter. * * @param mixed $response_item A single site setting. + * @param WPCOM_JSON_API_Site_Settings_Endpoint $this The API object. */ - $response[ $key ] = apply_filters( 'site_settings_endpoint_get', $response[ $key ] ); + $response[ $key ] = apply_filters( 'site_settings_endpoint_get', $response[ $key ], $this ); if ( class_exists( 'Sharing_Service' ) ) { $ss = new Sharing_Service(); @@ -592,17 +594,29 @@ protected function get_locale( $key ) { /** * Get GA tracking code. + * + * @deprecated $$next-version$$ */ protected function get_google_analytics() { - $option_name = $this->get_google_analytics_option_name(); + if ( class_exists( GA_Manager::class ) ) { + $option_name = GA_Manager::get_instance()->get_google_analytics_option_name(); + } else { + $option_name = $this->get_google_analytics_option_name(); + } return get_option( $option_name ); } /** * Get GA tracking code option name. + * + * @deprecated $$next-version$$ */ protected function get_google_analytics_option_name() { + if ( class_exists( GA_Manager::class ) ) { + return GA_Manager::get_instance()->get_google_analytics_option_name(); + } + /** This filter is documented in class.json-api-endpoints.php */ $is_jetpack = true === apply_filters( 'is_jetpack_site', false, get_current_blog_id() ); $option_name = $is_jetpack ? 'jetpack_wga' : 'wga'; @@ -613,7 +627,7 @@ protected function get_google_analytics_option_name() { /** * Updates site settings for authorized users * - * @return array + * @return array|WP_Error */ public function update_settings() { /* @@ -718,42 +732,6 @@ public function update_settings() { $updated[ $key ] = $value; } break; - case 'wga': - case 'jetpack_wga': - if ( ! isset( $value['code'] ) || ! preg_match( '/^$|^(UA-\d+-\d+)|(G-[A-Z0-9]+)$/i', $value['code'] ) ) { - return new WP_Error( 'invalid_code', 'Invalid UA ID' ); - } - - $option_name = $this->get_google_analytics_option_name(); - - $wga = get_option( $option_name, array() ); - $wga['code'] = $value['code']; // maintain compatibility with wp-google-analytics. - - /** - * Allow newer versions of this endpoint to filter in additional fields for Google Analytics - * - * @since 5.4.0 - * - * @param array $wga Associative array of existing Google Analytics settings. - * @param array $value Associative array of new Google Analytics settings passed to the endpoint. - */ - $wga = apply_filters( 'site_settings_update_wga', $wga, $value ); - - if ( update_option( $option_name, $wga ) ) { - $updated[ $key ] = $value; - } - - $enabled_or_disabled = $wga['code'] ? 'enabled' : 'disabled'; - - /** This action is documented in modules/widgets/social-media-icons.php */ - do_action( 'jetpack_bump_stats_extras', 'google-analytics', $enabled_or_disabled ); - - $is_wpcom = defined( 'IS_WPCOM' ) && IS_WPCOM; - if ( $is_wpcom ) { - $business_plugins = WPCOM_Business_Plugins::instance(); - $business_plugins->activate_plugin( 'wp-google-analytics' ); - } - break; case 'cloudflare_analytics': if ( ! isset( $value['code'] ) || ! preg_match( '/^$|^[a-fA-F0-9]+$/i', $value['code'] ) ) { @@ -1214,11 +1192,20 @@ function ( $category_id ) { * @module json-api * * @since 3.9.3 + * @since $$next-version$$ Added the API object parameter. * * @param mixed $response_item A single site setting value. + * @param WPCOM_JSON_API_Site_Settings_Endpoint The API object parameter. */ - $value = apply_filters( 'site_settings_endpoint_update_' . $key, $value ); - $updated[ $key ] = $value; + $value = apply_filters( 'site_settings_endpoint_update_' . $key, $value, $this ); + + if ( is_wp_error( $value ) ) { + return $value; + } + + if ( $value ) { + $updated[ $key ] = $value; + } break; } // no worries, we've already whitelisted and casted arguments above. diff --git a/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-site-settings-v1-3-endpoint.php b/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-site-settings-v1-3-endpoint.php index 8ff59dba4f8ab..7be80d40eb2a3 100644 --- a/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-site-settings-v1-3-endpoint.php +++ b/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-site-settings-v1-3-endpoint.php @@ -1,5 +1,7 @@ 'Get detailed settings information about a site.', @@ -136,30 +138,24 @@ protected function get_defaults() { ); } - /** - * API Callback - * - * @param string $path - the path. - * @param int $blog_id - the blog ID. - * - * @return array|WP_Error - */ - public function callback( $path = '', $blog_id = 0 ) { - add_filter( 'site_settings_endpoint_get', array( $this, 'filter_site_settings_endpoint_get' ) ); - add_filter( 'site_settings_update_wga', array( $this, 'filter_update_google_analytics' ), 10, 2 ); - return parent::callback( $path, $blog_id ); - } - /** * Filter the parent's response to include the fields * added to 1.3 (and their defaults) * + * @deprecated $$next-version$$ + * * @param array $settings - the settings array. * * @return array */ public function filter_site_settings_endpoint_get( $settings ) { - $option_name = $this->get_google_analytics_option_name(); + if ( class_exists( GA_Manager::class ) ) { + $option_name = GA_Manager::get_instance()->get_google_analytics_option_name(); + } else { + // @phan-suppress-next-line PhanDeprecatedFunction + $option_name = $this->get_google_analytics_option_name(); + } + $option = get_option( $option_name, array() ); $settings['wga'] = wp_parse_args( $option, $this->get_defaults() ); return $settings; @@ -171,6 +167,8 @@ public function filter_site_settings_endpoint_get( $settings ) { * @param array $wga - Array of existing Google Analytics settings. * @param array $new_values - the new values we're adding. * + * @deprecated $$next-version$$ + * * @return array */ public function filter_update_google_analytics( $wga, $new_values ) { diff --git a/projects/plugins/jetpack/tests/php/json-api/test-class.wpcom-json-api-site-settings-v1-4-endpoint.php b/projects/plugins/jetpack/tests/php/json-api/test-class.wpcom-json-api-site-settings-v1-4-endpoint.php index 3755dfbfec2af..a331dbf845819 100644 --- a/projects/plugins/jetpack/tests/php/json-api/test-class.wpcom-json-api-site-settings-v1-4-endpoint.php +++ b/projects/plugins/jetpack/tests/php/json-api/test-class.wpcom-json-api-site-settings-v1-4-endpoint.php @@ -296,22 +296,6 @@ public function setting_default_key_values() { 'woocommerce_default_country' => array( 'woocommerce_default_country', '' ), 'woocommerce_store_postcode' => array( 'woocommerce_store_postcode', '' ), 'woocommerce_onboarding_profile' => array( 'woocommerce_onboarding_profile', array() ), - 'wga' => array( - 'wga', - array( - 'code' => '', - 'anonymize_ip' => false, - 'honor_dnt' => false, - 'ec_track_purchases' => false, - 'ec_track_add_to_cart' => false, - 'enh_ec_tracking' => false, - 'enh_ec_track_remove_from_cart' => false, - 'enh_ec_track_prod_impression' => false, - 'enh_ec_track_prod_click' => false, - 'enh_ec_track_prod_detail_view' => false, - 'enh_ec_track_checkout_started' => false, - ), - ), ); } @@ -328,23 +312,6 @@ public function setting_value_pairs_get_request() { 'woocommerce_default_country' => array( 'woocommerce_default_country', 'woocommerce_default_country', 'US:NY' ), 'woocommerce_store_postcode' => array( 'woocommerce_store_postcode', 'woocommerce_store_postcode', '98738' ), 'woocommerce_onboarding_profile' => array( 'woocommerce_onboarding_profile', 'woocommerce_onboarding_profile', array( 'test' => 'test value' ) ), - 'wga' => array( - 'jetpack_wga', - 'wga', - array( - 'code' => 'G-TESTING', - 'anonymize_ip' => false, - 'honor_dnt' => false, - 'ec_track_purchases' => false, - 'ec_track_add_to_cart' => false, - 'enh_ec_tracking' => false, - 'enh_ec_track_remove_from_cart' => false, - 'enh_ec_track_prod_impression' => false, - 'enh_ec_track_prod_click' => false, - 'enh_ec_track_prod_detail_view' => false, - 'enh_ec_track_checkout_started' => false, - ), - ), ); } @@ -378,15 +345,6 @@ public function setting_value_pairs_post_request() { 'comment_follow' => "Test string 2\n\n Other line", ), ), - 'wga' => array( - 'wga', - array( - 'code' => 'G-TESTING', - ), - array( - 'code' => 'G-TESTING', - ), - ), ); } }