diff options
Diffstat (limited to 'plugins/jetpack/modules/google-analytics/classes')
-rw-r--r-- | plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-legacy.php | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-legacy.php b/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-legacy.php index ddca0e46..5356e7f4 100644 --- a/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-legacy.php +++ b/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-legacy.php @@ -236,19 +236,15 @@ class Jetpack_Google_Analytics_Legacy { global $product; $product_sku_or_id = $product->get_sku() ? $product->get_sku() : "#" + $product->get_id(); wc_enqueue_js( - "jQuery( function( $ ) { - $( '.single_add_to_cart_button' ).click( function() { - _gaq.push(['_trackEvent', 'Products', 'Add to Cart', '#" . esc_js( $product_sku_or_id ) . "']); - } ); + "$( '.single_add_to_cart_button' ).click( function() { + _gaq.push(['_trackEvent', 'Products', 'Add to Cart', '#" . esc_js( $product_sku_or_id ) . "']); } );" ); } else if ( is_woocommerce() ) { // any other page that uses templates (like product lists, archives, etc) wc_enqueue_js( - "jQuery( function( $ ) { - $( '.add_to_cart_button:not(.product_type_variable, .product_type_grouped)' ).click( function() { - var label = $( this ).data( 'product_sku' ) ? $( this ).data( 'product_sku' ) : '#' + $( this ).data( 'product_id' ); - _gaq.push(['_trackEvent', 'Products', 'Add to Cart', label]); - } ); + "$( '.add_to_cart_button:not(.product_type_variable, .product_type_grouped)' ).click( function() { + var label = $( this ).data( 'product_sku' ) ? $( this ).data( 'product_sku' ) : '#' + $( this ).data( 'product_id' ); + _gaq.push(['_trackEvent', 'Products', 'Add to Cart', label]); } );" ); } |