summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/google-analytics')
-rw-r--r--plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-legacy.php5
-rw-r--r--plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-universal.php6
2 files changed, 7 insertions, 4 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 1b85567e..ddca0e46 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
@@ -77,7 +77,10 @@ class Jetpack_Google_Analytics_Legacy {
if ( is_404() ) {
// This is a 404 and we are supposed to track them.
$custom_vars[] = "_gaq.push(['_trackEvent', '404', document.location.href, document.referrer]);";
- } elseif ( is_search() ) {
+ } elseif (
+ is_search()
+ && isset( $_REQUEST['s'] )
+ ) {
// Set track for searches, if it's a search, and we are supposed to.
$track['data'] = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ); // Input var okay.
$track['code'] = 'search';
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 8c1b4167..eb6734b3 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
@@ -5,7 +5,7 @@
* https://developers.google.com/analytics/devguides/collection/analyticsjs/
* https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce
*
-* @author allendav
+* @author allendav
*/
/**
@@ -263,7 +263,7 @@ class Jetpack_Google_Analytics_Universal {
esc_attr( $product->get_id() ),
esc_attr( $product->get_sku() )
);
- $url = str_replace( 'href=', $new_attributes );
+ $url = str_replace( 'href=', $new_attributes, $url );
return $url;
}
@@ -409,4 +409,4 @@ class Jetpack_Google_Analytics_Universal {
wc_enqueue_js( "ga( 'send', 'pageview' );" );
}
-} \ No newline at end of file
+}