Skip to content

Commit

Permalink
Fixed: only add manual.js on Search pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan0sz committed Jul 17, 2024
1 parent d63fb1d commit 4c7f985
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function maybe_register_assets() {

// Track search results. Tracks a search event with the search term and the number of results, and a pageview with the site's search URL.
if ( Helpers::is_enhanced_measurement_enabled( 'search' ) && is_search() ) {
global $wp_rewrite, $wp_query;
global $wp_query;

$data = wp_json_encode(
[
Expand Down
2 changes: 1 addition & 1 deletion src/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static function get_filename( $local = false ) {
}

// Add the manual scripts as we need it to track the search parameter.
if ( self::is_enhanced_measurement_enabled( 'search' ) ) {
if ( is_search() && self::is_enhanced_measurement_enabled( 'search' ) ) {
$file_name .= '.manual'; // @codeCoverageIgnore
}

Expand Down

0 comments on commit 4c7f985

Please sign in to comment.