diff options
Diffstat (limited to 'plugins/jetpack/modules/google-analytics')
-rw-r--r-- | plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-universal.php | 6 | ||||
-rw-r--r-- | plugins/jetpack/modules/google-analytics/wp-google-analytics.php | 4 |
2 files changed, 3 insertions, 7 deletions
diff --git a/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-universal.php b/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-universal.php index f86edf65..999fffbd 100644 --- a/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-universal.php +++ b/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-universal.php @@ -49,12 +49,6 @@ class Jetpack_Google_Analytics_Universal { return; } - // At this time, we only leverage universal analytics for enhanced ecommerce. If WooCommerce is not - // present, don't bother emitting the tracking ID or fetching analytics.js - if ( ! class_exists( 'WooCommerce' ) ) { - return; - } - /** * Allow for additional elements to be added to the universal Google Analytics queue (ga) array * diff --git a/plugins/jetpack/modules/google-analytics/wp-google-analytics.php b/plugins/jetpack/modules/google-analytics/wp-google-analytics.php index b4824a6a..8d7cdf24 100644 --- a/plugins/jetpack/modules/google-analytics/wp-google-analytics.php +++ b/plugins/jetpack/modules/google-analytics/wp-google-analytics.php @@ -50,7 +50,9 @@ class Jetpack_Google_Analytics { * @return void */ private function __construct() { - if ( Jetpack_Google_Analytics_Options::enhanced_ecommerce_tracking_is_enabled() ) { + // At this time, we only leverage universal analytics when enhanced ecommerce is selected and WooCommerce is active. + // Otherwise, don't bother emitting the tracking ID or fetching analytics.js + if ( class_exists( 'WooCommerce' ) && Jetpack_Google_Analytics_Options::enhanced_ecommerce_tracking_is_enabled() ) { $analytics = new Jetpack_Google_Analytics_Universal(); } else { $analytics = new Jetpack_Google_Analytics_Legacy(); |