10up / ElasticPress

A fast and flexible search and query engine for WordPress.
https://elasticpress.io
GNU General Public License v2.0
1.23k stars 312 forks source link

BUG: Autosuggest Results Unresponsive with Google Analytics Tracking Enabled and Script Blockers Active #3925

Open anjulahettige opened 1 month ago

anjulahettige commented 1 month ago

Describe the bug

Description

When Google Analytics tracking is enabled on a site using ElasticPress Autosuggest, the autosuggest functionality becomes unresponsive if script or tracking blockers are used in the browser. Clicking on autosuggest results fails, accompanied by a JavaScript TypeError in the console.

Expected Behavior

Autosuggest results should be clickable, and clicking on a result should navigate to the relevant content.

Actual Behavior

Clicks on autosuggest results do not respond. An error is logged in the browser's console.

Steps to Reproduce

  1. Visit https://demo.elasticpress.io/ using a browser with script blocking enabled (e.g., Brave's script blocker or the uBlock Origin extension).
  2. Enable tracking/script blocking features.
  3. Attempt to use the autosuggest feature by typing a search term in the search bar.
  4. Click on any of the autosuggest results.

Screenshots, screen recording, code snippet

No response

Environment information

WordPress and ElasticPress information

No response

Code of Conduct