summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/google-analytics/wp-google-analytics.php')
-rw-r--r--plugins/jetpack/modules/google-analytics/wp-google-analytics.php4
1 files changed, 3 insertions, 1 deletions
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();