Search Analytics WordPress Plugin

Search Analytics will keep history of the search terms used by your users and groups them in a way that will show you where are the loopholes in your website’s content.

As a result, it can easily aid you in finding what your users are really searching for on your website and make sure you provide them the content they need.

Features of Search Analytics

  • Record all the search queries made using the standard WordPress search form.
  • Skip searches made by users with certain user roles or with certain IP addresses
  • Exclude duplicate searches made in certain conditions (GDPR compliant)
  • Choose which user roles are allowed to see the statistics
  • Filter statistics by time periods, with/without results, strings/sub strings
  • View each term individual statistics
  • Export data in the current view to CSV
  • Delete certain search terms from history with ease
  • Easily erase all history from the database in case a reset is needed
  • Easy erase history older than in case a general cleanup is needed
  • Dashboard widget for a quick glance over your last week’s search stats
  • Multisite compatible
  • Country Geolocation

Development Road Map

The Search Analytics WordPress Plugin has a clearly defined development road map which you can always check by visiting the Trello Board

Trello Board


I have added a GitHub repository for the plugin so that whoever wants to contribute to the plugin can do so by making pull requests on GitHub. The link to the repository is:

Search Analytics in action

Change Log

1.3.1 Hotfix

  • Bugfix: database not being updated correctly in case of plugin update. It only worked for manual plugin activation
  • Bugfix: search country locked to Canada.


  • Feature: add save_search_term() method to allow external search saving
  • Feature: add mwtsa_extra_exclude_conditions filter to allow more control over the conditions in which a search is processed
  • Feature: add mwtsa_exclude_term filter to allow more control over the conditions in which terms are saved
  • Feature: save searches by user so the user can see his search history
  • Feature: add country geolocation for the searches
  • Feature: add more options for the chart
  • Feature: add period comparison in the chart
  • Optimization: compatibility with version 5.2.2
  • Optimization: Add multisite support
  • Optimization: Build separate methods for displaying charts to be able to easily integrate it in other views
  • Optimization: Make chart include “today”
  • Optimization: general code optimizations


  • Feature: add ability to delete all search history older than a selected number of days
  • Feature: add setting: “Exclude searches from IPs list”
  • Feature: add setting: “Only record searches with at least the number of characters”
  • Feature: add “Ungroup” view for the list of terms for having a chronological data view
  • Optimization: compatibility with version 5.1
  • Optimization: change default sort to last search date
  • Optimization: average number of results column to only 2 decimals
  • Optimization: update the singleton pattern


  • Bugfix: fix bug in the database version update
  • Bugfix: “By Hour” group is not working correctly
  • Bugfix: “Hide graphical charts” setting not working correctly
  • Feature: Add a setting for using a cookie for previously logged in user for not counting searches made by users having a user role in the excluded roles list
  • Feature: Add a setting for not counting duplicate searches over a period of time
  • Feature: add role visibility for the dashboard widget
  • Optimization: update the way Group By works on the term details view
  • Optimization: use function_exists() and class_exists() for all function/class declarations
  • Optimization: add javascript graph compatibility with older IE versions
  • Optimization: show fewer points on the Y axis on the graphical chart if search count gets high


  • Bugfix: fix “Unknown column ‘average_posts’ in ‘where clause’” error on single term view ( introduced in v1.2.0 )
  • Bugfix: remove bulk actions on single term view ( introduced in v1.2.0 )
  • Bugfix: fix “Last 24 hours” time filter ( introduced in v1.2.0 )
  • Feature: add admin dashboard widget with last week stats
  • Feature: add possibility to group single term view results by day and hour
  • Feature: add charts for graphical data representation
  • Optimization: add link on searched term for faster navigation
  • Optimization: make custom views and filters language variables ( introduced in v1.2.0 )
  • Optimization: make all date and time columns use WP date and time format settings
  • Optimization: code updates to better comply to the WP coding standards


  • Bugfix: fix PHP notice on the settings page ( introduced in v1.0.3 )
  • Bugfix: fix search resetting time and result filters ( introduced in v1.1.2 )
  • Bugfix: fix notice “Undefined index: date_from” ( introduced in v1.1.2 )
  • Bugfix: fix notice “Undefined index: date_to” ( introduced in v1.1.2 )
  • Feature: ability to download history in a CSV file
  • Feature: add single term view with detailed search historical stats
  • Feature: ability to choose which user roles can see the search history stats
  • Optimization: set table names in plugin constants for cleaner calls
  • Optimization: move history data return from db function to independent static class.
  • Optimization: change time filter default to “All Time”


  • Bugfix: fix jquery.ui load over https ( introduced in v1.1.2 )


  • Bugfix: make stats page full responsive ( introduced in v1.1 )
  • Feature: add filters: all, only successful, only unsuccessful ( 0 posts ) results
  • Feature: Time range filters
  • Optimization: make bulk action “Delete” use language variable ( introduced in v1.1.1 )
  • Optimization: add screen option to allow selection of number of results per page
  • Optimization: last search date – sortable column
  • Optimization: add “clear” option to the date pickers
  • Optimization: add 2 months view on the calendars


  • Bugfix: remove limit of results on the table ( introduced in v1.1 )
  • Feature: ability to delete terms from the results
  • Feature: bulk terms delete action
  • Optimization: results per page reduced from 30 to 20


  • Bugfix: exclude empty search strings ( introduced in v1.0 )
  • Design: display tables using the WordPress Admin Tables
  • Feature: pagination for better data analysis
  • Feature: custom sorting on all columns
  • Feature: filter results by string


  • fix a warning occurring in certain cases on search


  • Add ability to delete all history
  • Add ability to remove the tables on plugin deactivate
  • Stats page restyling


  • Update results sorting for better viewing the data
  • Minimum styling on the stats page
  • Add link to the settings page


  • Fix deprecated notice


  • Initial Release

20 thoughts on “Search Analytics WordPress Plugin”

  1. Hi there, great Plugin. One short question. We need two different search results.

    1) I am offering
    2) I need

    Right now both results land in the same graphic. But can we make a differentiation? So we need what is someone offering and what do they need?

    Thanks a lot for the answer. Helps us a lot.


    • Hi Michael,
      Thank you for the comment.

      I will think about doing some kind of a tagging system so you can tag searches made from different search forms and then filter them in the Search Analytics dashboard.
      Would that work?

      Looking forward to hearing from you,

  2. Great plugin, thank you for your hard work! There is a small but annoying bug though: No matter what setting is set under “Only display the statistics and settings page for these user roles” both settings and analytics page are only shown to administrator. Can you provide a fix for this bug? We need for the analytics page to be visible to editors as well. Thanks!

    • Hello! Thank you for letting me know about this issue.
      Can you please tell me on what WordPress version do you have this issue?
      I will launch a new version of the plugin with a few tweaks and bug fixes. Also with full latest WP compatibility.

      Thank you!

  3. Thanks for your fast response!! The WP version is v4.9.12. Could you maybe provide a fix (i.e. hack) to quicly solve this issue and make the analytics page available to editors until the next version will be released? Thank you very much in advance!

    • Hi Nicolai. Thank you for the extra details. I will try to replicate the issue today and as soon as I have a fix I will send you another reply with it.

      Thank you!

  4. Just recreated the issue with WP v5.3.2. For some reason the plugin does not show the setting & analytics page for any user other then administrator. The setting “Only display the statistics and settings page for these user roles” is respected somehow though, because if one removes the checkbox for “administrator” no one can view the pages anymore.

  5. forgot to mention: the WP v5.3.2 we just recreated the bug on was a vanilla sandbox WP version without any other plugins which could conflict

    • Understood. Thank you for the additional verification!
      I will create a fix and send it to you here.

      Also, in the next version of the plugin there will be 2 settings instead of one:
      “Only display the statistics and settings page for these user roles” will become:
      “Only display the statistics to these user roles”
      “Only display the settings page to these user roles”

      That way you will have even more control over the display.
      Thank you!

    • Hi. Someone got on the website with those details in the search param. Basically they searched for exactly that.
      The only way to exclude those at the moment is using WordPress filters and actions to stop the execution before it reaches the plugin.

      However, if you look at the Trello board, there is a plan for an exclude feature in version 1.4. I might move that one to version 1.3.2 in case it is something you really need.
      Also, I am thinking of adding a feature for removing all the entries matching certain string patterns so you can clean up the search history.

      Let me know if that is ok. I will work on the fix tomorrow morning and get back to you.

  6. An exclude function would be very useful for several reasons!! Would be very nice to have that already in v1.3.2.

    The feature for removing all the entries matching certain string patterns is nice too of course but that’s quite an “expert” feature, so maybe something for v1.4?

    Anyway, thanks for this your great work with this fantastic plugin and also the great support!! Can’t wait for the fix and of course the next version!!

    • Hi there, Here is the fix for the issue you mentioned. This is just a temporary fix and it is definitely not ideal, but it works.

      In ‘plugins/search-analytics/admin/includes/class.stats.php’ around the line 92 you will find the `add_admin_menu()` method.

      You have to change the content of that function with this:

      public function add_admin_menu() {
          $this_user_role = mwt_get_current_user_roles();
          $accepted_user_roles = array_intersect( $this_user_role, $this->plugin_options['mwtsa_display_stats_for_role'] );
          if ( ! isset( $this->plugin_options['mwtsa_display_stats_for_role'] ) || ! empty( $accepted_user_roles ) ) {
              add_submenu_page( 'index.php', __( 'Search Analytics', 'mwt-search-analytics' ), __( 'Search Analytics', 'mwt-search-analytics' ), $accepted_user_roles[0], __FILE__, array( $this, 'render_stats_page' ) );

      This adjustment will display the analytics page to the other user roles as well but keep the settings page only visible to the users that have an user role that has the “manage_options” capability

      • An update with the included fix was released yesterday. If you update the plugin you should see it all working correctly now. Thank you!

  7. Thanks so much for the speedy fix, already applied it and it works like a charm!!

    About this strange “node/” thingy: the term “node” is now occuring for about 1/3 of the time as part of other seemingly normal search terms. I uploaded an excel export for you here:

    I don’t think anyone would enter “node/” that many times on purpose so maybe this is triggered by some kind of bot?

    • The only thing I can think of is some kind of another app or website that links back to the website with the url set as: ‘site-name/?s=node/whatever’

      Or maybe there is an internal area that does links like this. This is a clear use case for the exclude setting I will add in the next update.

  8. Only Administrators can see Dashboard > Search Analytics, even though I have ticked all in General Settings:
    Only display the statistics and settings page for these user roles:
    SEO Manager
    SEO Editor

    How can I allow an ‘Editor’ to see the full stats?

    • Hello Simon.
      Thanks for reaching out!

      This is a bug I am currently aware of which will be fixed in the next update.
      As a quick fix you can follow the instructions here:

      In ‘plugins/search-analytics/admin/includes/class.stats.php’ around the line 92 you will find the `add_admin_menu()` method.

      You have to change the content of that function with this:

      public function add_admin_menu() {
          $this_user_role = mwt_get_current_user_roles();
          $accepted_user_roles = array_intersect( $this_user_role, $this->plugin_options['mwtsa_display_stats_for_role'] );
          if ( ! isset( $this->plugin_options['mwtsa_display_stats_for_role'] ) || ! empty( $accepted_user_roles ) ) {
              add_submenu_page( 'index.php', __( 'Search Analytics', 'mwt-search-analytics' ), __( 'Search Analytics', 'mwt-search-analytics' ), $accepted_user_roles[0], __FILE__, array( $this, 'render_stats_page' ) );

      Please let me know if that helped.

    • An update with the included fix was released yesterday. If you update the plugin you should see it all working correctly now. Thank you!


Leave a Comment