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.

NOTE: The plugin stores all the statistics in your WordPress database. No info is sent to third-party services!

Main 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 for the Search Analytics WordPress Plugin

The plugin has a clearly defined development road map which you can always check by visiting the Trello Board

Trello Board

Repository

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. Click to view the repository.

Changelog

The plugin changelog can be seen here: Changelog

Some screenshots

34 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.

    Greetings

    Reply
    • 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,
      Cornel

      Reply
  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!

    Reply
    • 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!

      Reply
  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!

    Reply
    • 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!

      Reply
  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.

    Reply
  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

    Reply
    • 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!

      Reply
    • 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.

      Reply
  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!!

    Reply
    • 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

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

        Reply
  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:

    https://www.dropbox.com/s/zct0bnf9eo8fkdc/export-c630648d1357106d948b4004c9d42f11.csv?dl=1

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

    Reply
    • 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.

      Reply
    • Hello Nicolai!

      I just released a new update that allows you to add sub-strings to exclude searches.

      In this case if you enter “node/” ( without the ” ) in the new field I added in the settings page you will be bale to get rid of all the “node/” search entries.

      Please let me know if that works correctly. It is currently an experimental feature and I am looking forward to receiving some feedback on it.

      Also, if you like the plugin, please add a review on the plugin page. I would really appreciate it and it will help the plugin grow!

      Thank you!
      Cornel

      Reply
  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:
    Administrator
    Editor
    Author
    Contributor
    Subscriber
    SEO Manager
    SEO Editor

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

    Reply
    • 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.

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

      Reply
      • Hi Randall!

        I am not sure about your particular setup. I will tell you how I made use of it on a project where I had a custom search functionality.

        WordPress uses the `s=` parameter as the default search parameter. However, on that project I had the search parameter like: `wpx_qs=`. So, in the `custom search parameters` field, I just added `wpx_qs` and it started recording the searches.

        In case this does not work, please get back to me and we can work on finding a solution that works in your case.

        Looking forward to hearing from you.
        Cornel

        Reply
  9. Thank you so much! The plugin works fantastic, my site happens to be getting an huge amount of Spam searches for domain names, is that happening to everybody? Is there an anti Spam solution that works?

    Reply
    • Hello Joe!

      You can try turning on the IP checks for the Search Analytics plugin and then see which IPs or IP ranges send many requests.

      I had an issue on a website with SEMrush and their ways of indexing which ended up in 70k+ searches on 3 different search strings over a period of 5 days. If this is the case with you, you can visit this: https://www.semrush.com/bot/ and remove their bot from doing it since they said their bots strictly obey robots.txt.

      I hope that helps you.

      Reply
  10. This plugin only save Search Word not save string (full keyword).

    Ex: Keyword: WordPress tutorials, this plugin will save 2 words (WordPress, tutorials) not display “WordPress tutorials” when using shortcode [wp-frequently-searched-words] ???

    Thank you.

    Reply
    • Hello,

      Search Analytics will save the full keyword “WordPress tutorials”. You can check the screenshots and see how the search results look like.

      I am not sure about the `[wp-frequently-searched-words]` shortcode. It’s not a shortcode built into Search Analytics.
      The `Frequently Searched Words` plugin looks to count each individual word and save that information. Search Analytics will save the full search strings.

      Let me know if I can assist you with anything else.

      Thank you,
      Cornel

      Reply
    • Hi Tom,

      Thank you for your message.

      You can already do that by going into the plugin settings and checking the “Save Search By User” option. Using this feature will allow you to see which of your registered users searched things on the site.

      Let me know if that is what you need.

      Also, if you enjoy using my plugin, please add a review. That keeps me motivated to make it better and better.

      Thanks!

      Reply
  11. Hi, dear, I Hope you’re doing well.
    I’m using your plugin for more than a year now and it’s working great. Now I am facing one issue
    The plugin by default stores search queries of all users on the website and shows the search queries on the frontend right?
    is there any way I can show the search query of the same user to him?
    Mean let’s say I’ve 2 users
    1: user A
    2: user B
    On page 1 user A, and user B will see the mixed search terms they both have searched about on the website but
    on page 2 user A will only see the search terms he made on the website and user B will only see the search terms he made on the website.

    Is this possible? if yes then please tell me how.

    Thanks

    Reply
    • Hi Junaid,

      Thanks for reaching out and for using my plugin!

      Have you tried the “Save Search By User” setting in the plugin settings?

      Then, on the frontend, you may use this shortcode to display the stats: `[mwtsa_display_search_stats]`. Here are the accepted params for the shortcode: https://github.com/cornelRaiu/search-analytics#the-mwtsa_display_search_stats-shortcode. However, this will only display the search stats, not all the search terms.

      Are you using the `[mwtsa_display_latest_searches]` shortcode? This shortcode doesn’t currently have a user specific list of searched terms, but I can quickly do that and release it with an update.

      Looking forward to hearing from you!

      Reply
  12. hello i installed but i dont see any statistiques of searchs.

    I have the page : Search Filtering Settings

    But after cant see where to go to find the statistics and check the keywords search on my website

    Sincerely

    Reply
    • Hi Yohan,

      I have emailed you the information 2 days ago along with a screenshot.

      I will also add it here for future reference.

      The results are shown in Dashboard -> Search Analytics in your admin panel.

      I hope this helped.

      Reply

Leave a Comment