Description
Search Analytics for WP logs what visitors search for on your WordPress site and how many results each search returned. You see which search terms are popular and which came up empty. Everything is stored in your own database.
Your site search shows what people came for, in their words rather than yours. Say “opening hours” got 41 searches last month and zero results every time. Either the page is missing or it says “business hours”. The no-results filter lists every gap like that.
What your search log tells you
What to write next. Searches with no results are topics people expect to find on your site. Sorted by number of searches, they become a to-do list with the most requested topics on top. On a blog, that’s your next post. In a help center, it’s the answer people keep missing.
Which pages people can’t find. Sometimes the page exists and visitors still search for it. If “contact” or “shipping” shows up week after week, the link is probably too hard to spot.
In a WooCommerce shop, every product search is saved with the number of products it found. A run of searches for a brand or size you don’t carry is demand you’d otherwise never hear about.
Often the lesson is simply vocabulary. Visitors type “couch” when your store says “sofa”. Their search terms are the words to use in your titles and menus.
Key features
- Records searches from your normal WordPress search, including theme search boxes and the WooCommerce product search.
- Also covers wpForo forum searches and custom URL parameters you add, such as Toolset’s
wpv_post_search, including REST API requests that use them. - AJAX live search can be recorded too, with one line of code (see For developers).
- Every search term in a sortable table, with the number of searches, average results and last search date.
- Time filters from the last 24 hours to all time, or any date range you pick.
- A no-results filter that shows only the searches that found nothing.
- Each term’s history by date or by hour, plus a “No Group” view that lists every search in order.
- A daily chart compared with the previous period, and a “When people search” chart with the busiest days and times.
- A dashboard widget with the last 7 days: searches compared with the week before, trending terms, searches with no results and your busiest day and time.
- CSV export of whatever view you’re on.
- Keep your own searches out, even after you log out. You can also skip repeat searches, listed IP addresses, very short terms and words you block.
- Leaves out searches made by bots, and junk searches that contain a link or HTML.
- Optional country and logged-in user for each search, both off by default.
- Popular Searches and Latest Searches blocks to show what people search for on your site, with a live preview in the editor. Both are also available as shortcodes.
- Separate role access for viewing the statistics and changing the settings.
- Works on multisite, with separate data for each site, and is translation-ready.
Getting started
Recording starts as soon as you activate the plugin. Run a search on your site, then open Search Analytics in the admin menu to see it.
One setting is worth changing on day one: exclude your own role, so your test searches don’t count. The FAQ below covers the rest, from WooCommerce to live search.
Privacy
There’s no account to create and no API key. No search data is sent anywhere unless you turn on “Save Search Country”, which is off by default. It sends visitors’ IP addresses to ip-api.com or ip2c.org to look up the country (see External services below).
When you deactivate the plugin, it asks why. Answering is optional, and only an answer you choose to send leaves your site.
IP addresses are never saved with the searches, and no cookies are set unless you use one of two optional settings. The FAQ lists exactly what is stored.
For developers
To record searches from your own code, such as an AJAX live search, call mwtsa_process_search_term( $term, $result_count ). It runs the same exclusion checks as a normal search and returns whether the search was saved.
Filters: mwtsa_do_not_save_search, mwtsa_exclude_term, mwtsa_extra_exclude_conditions, mwtsa_result_count, mwtsa_export_filename, mwtsa_term_search_link, mwtsa_is_bot, mwtsa_is_junk_term, mwtsa_live_search_merge_seconds, plus filters on the shortcode output, which apply to the blocks too. Actions: mwtsa_after_term_save, mwtsa_after_history_term_save. The code is on GitHub.
Support
Questions and ideas are welcome in the support forum. If the plugin is useful to you, a review helps other site owners find it.
External services
The plugin connects to outside services for two things only: the country lookup, which is off by default, and the answer to the optional question it asks when you deactivate it. Both are described below.
Search Analytics for WP can look up the country each search was made from. This only happens when the “Save Search Country” setting is enabled; it is off by default.
When a search is recorded, the visitor’s IP address is sent to the service chosen in the “Country lookup service” setting. Each IP address is looked up at most once per day, and private or reserved addresses are never sent.
IP-API (ip-api.com)
The default service. The IP address is sent over HTTP, as the free service does not support HTTPS. The free service only allows non-commercial use and 45 requests per minute.
Terms of service and privacy policy: https://ip-api.com/docs/legal
ip2c.org
The IP address is sent over HTTPS. The service is free (LGPL) and allows around 10 requests per second. It only supports IPv4 addresses, so searches from IPv6 addresses are saved without a country.
Service terms and privacy policy: https://about.ip2c.org
Feedback when deactivating (wpsearchanalytics.com)
When you click Deactivate on the Plugins screen, the plugin asks why. Nothing is sent unless you pick an answer and click “Send & Deactivate”. Then your answer, any text you typed, the plugin, WordPress and PHP versions and the site language are sent over HTTPS to wpsearchanalytics.com, the plugin’s website. Your site address, your email address and your search data are not sent. Answers are kept for a year and used to decide what to fix and build next.
Terms: https://wpsearchanalytics.com/terms
Privacy policy: https://wpsearchanalytics.com/privacy
Credits
Country flags on Windows use the “Twemoji Country Flags” font from country-flag-emoji-polyfill by TalkJS (MIT license). The flag artwork comes from Twemoji and is licensed under CC-BY 4.0. The font and polyfill are bundled with the plugin and loaded from your own site.
Installation
Search Analytics for WP can be installed via the WordPress Automatic Plugin Install page in the admin panel.
It can also be downloaded from the WordPress Plugin Directory and installed manually.
After the installation and activation is complete you should visit the plugin’s settings page ( Search Analytics -> Settings ) to make sure it is properly configured for your needs.
FAQ
Does it work with WooCommerce product search?
Yes. WooCommerce’s product search box opens the normal search results page, so each product search is recorded with the number of products it found, just like a blog search. A live search that only shows results in a dropdown needs a line of code (see “Why aren’t some searches being recorded?” below).
How do I find searches that returned no results?
On the Search Analytics page, click “Only Without Results” and pick a time range. Then sort by “No. of Searches” to put the most common dead ends first.
Can I keep my own searches out of the statistics?
Yes. In the settings, choose the roles to ignore under “Ignore search queries for these user roles”, for example Administrator and Editor. To keep ignoring those users after they log out, also tick “Ignore search queries for the above user roles even after the user has logged out”. This sets a cookie in their browser when they log in. You can list IP addresses to ignore too, like your office’s.
Are searches made by bots counted?
No. Searches made by search engine crawlers, AI assistants, link previews, monitoring tools and scripts are skipped. They are recognized by their user agent, so a bot that presents itself as a normal browser still gets through. If one keeps coming back, add its IP address to the excluded ones.
Searches that contain a link or HTML, or that are longer than 100 characters, are skipped too, because they are almost always spam or probes. Each of the two checks has a setting. Turn the second one off if your visitors search for web addresses or HTML tags, as on a web development site.
Why aren’t some searches being recorded?
The plugin records searches that load your site’s search results page (the ?s= address). If one is missing, check these:
- Ignored roles, IP addresses, the minimum length, blocked words and the repeat-search interval all skip searches on purpose. If your own role is ignored, test in a private browser window.
- Searches made by bots are skipped, and so are searches that contain a link or HTML or are longer than 100 characters. Both have a setting.
- Opening page 2 of the results or the search feed doesn’t count as a new search. Neither does following a term’s link in the Popular Searches or Latest Searches block, unless you turned that on in the block.
- A live search asks for results every few keystrokes. Requests from the same visitor that follow each other within 20 seconds are merged into one search, so typing “sofa” records “sofa” and not “sof” as well. Pressing Enter right after doesn’t count it a second time.
- If your search form uses its own URL parameter instead of
s, add it under “Add custom search parameters for recording the searches”. -
A live search that shows results without loading the search results page, and without a parameter you can add there, has to record its searches itself. Call this from the code that handles it:
if ( function_exists( ‘mwtsa_process_search_term’ ) ) { mwtsa_process_search_term( $term, $result_count ); }
mwtsa_process_search_term() applies the same settings as a normal search, and the same merging, so it can be called on every request the live search makes. For anything else, ask on the Support Forum.
Will it slow down my site?
Only searches do any work. Each search is saved with a few small database queries. Other pages only check whether they are a search, and the plugin loads no scripts or styles on the front end.
With “Save Search Country” on, the first search from a new IP address waits for the country lookup, which gives up after 2 seconds. The result is then cached for a day.
The history table grows with every search and nothing is deleted automatically. To trim it, use “Delete data older than” in the Erase History section of the settings.
Does it store personal data or send it anywhere?
Here is everything it keeps and shares, so you can check it against the GDPR or your local rules:
- Each search is saved with the term, the date and time, and the number of results. IP addresses are not saved.
- Search terms are whatever visitors type, which now and then includes a name or an email address. You can delete any term from the statistics page.
- “Save Search Country” (off by default) adds the visitor’s country. To find it, the visitor’s IP address is sent to ip-api.com or ip2c.org (see External services), and the country is cached for a day under a hash of the IP address.
- “Save Search By User” (off by default) links logged-in users’ searches to their accounts.
- A cookie is only set if you use the repeat-search interval or the “even after the user has logged out” option. It holds the IDs of recently searched terms and when they were searched, or a flag that the user’s role is ignored.
- To merge the requests a live search sends while a visitor types, the plugin keeps a note of the last term under a hash of the visitor’s IP address and browser. The note expires after one minute, and nothing about the visitor is saved with the search.
- You can erase all data, or everything older than a number of days, from the settings at any time.
- When you deactivate the plugin, it asks why. If you send an answer, it goes to wpsearchanalytics.com with the plugin, WordPress and PHP versions and the site language (see External services). Your site address and search data are not sent.
Can I export the search data?
Yes. The “Export Data” button on the statistics page downloads what you’re looking at as a CSV file, with the same time range, filters and grouping.
Can I show popular searches on my site?
Yes. Add the Popular Searches or Latest Searches block to a page, a post or a widget area. The editor shows a live preview, and a block with nothing to list stays hidden on your site. The blocks need WordPress 5.6 or later.
The same lists are available as shortcodes:
[mwtsa_display_search_stats]lists the most searched terms, plus the visitor’s own recent searches if they’re logged in and “Save Search By User” is on. The Popular Searches block shows the same.[mwtsa_display_latest_searches]lists the most recent search terms, like the Latest Searches block.
Both hide terms with no results by default and take options for the period, the number of terms and the text above the list, which show_label="false" leaves out. For example, [mwtsa_display_latest_searches unit="month" count="5"] shows the five most recent terms from the past month.
Each term can link to its search results. The blocks do that unless you turn it off, and the shortcodes do it with link_terms="true". A search opened from one of these links isn’t recorded, so the listed terms don’t keep themselves on top. To count those searches too, turn on “Count clicks on these links as searches” in the block, or add count_link_clicks="true" to the shortcode.
Paste one of these shortcodes into the block editor, or convert classic content to blocks, and it becomes the matching block with the same settings. A Shortcode block can be transformed into it too.
With classic widgets, put the shortcode in a Text widget. On WordPress 4.7 and 4.8, also add add_filter( 'widget_text', 'do_shortcode' ); to your child theme’s functions.php.
Does deactivating the plugin delete my search data?
No. Deactivating the plugin always keeps the search history. To remove it, check “Delete all search data and settings when the plugin is deleted” on the plugin’s settings page, then delete the plugin from the Plugins screen. On multisite, each site’s data is only removed if that site has the setting checked.
Where can I make feature requests or report non-security related bugs?
You can use the Support Forum or open new issues on the GitHub repository: Search Analytics for WP.
Where do I report security bugs?
Please report security bugs found in the source code of the Search Analytics for WP plugin through the Patchstack Vulnerability Disclosure Program. The Patchstack team will assist you with verification, CVE assignment, and notify me, the developer of Search Analytics for WP.
Screenshots







Changelog
1.6.2
Others:
- A new Extensions page in the Search Analytics menu lists MWT Search Steer, a free plugin by the same author that gives posts search keywords, with buttons to install or activate it. The page is shown to users who can activate plugins
- When the statistics page lists searches that found nothing, a line points to MWT Search Steer, so those searches can find a post. It links to installing or activating it for users who are allowed to, and each user can dismiss it. It is not shown on sites below WordPress 6.6 or PHP 7.4, which Search Steer needs
- Deactivating the plugin asks why, in a short optional form. Nothing is sent unless you click “Send & Deactivate”, and the answers about the plugin not working link to the support forum. See External services for what is sent
- The plugin’s row on the Plugins screen has Docs and Settings links before Deactivate. Settings is only shown to users who can open the settings page
1.6.1
Features:
- The dashboard widget is redesigned. For the last 7 days it shows the searches, the searches with no results and the unique terms compared with the 7 days before, the last search, a bar per day, the trending terms, the top searches and the top searches with no results. It also shows the busiest day and time of the last 4 weeks
- The new “When people search” chart on the statistics page shows the searches of the last 4 weeks by day of the week and 4-hour interval. It follows the “Show results dates as UTC” setting
- New Popular Searches and Latest Searches blocks show the same lists as the
[mwtsa_display_search_stats]and[mwtsa_display_latest_searches]shortcodes, with the same settings and a live preview in the editor. Pasted shortcodes and Shortcode blocks can be turned into them. The blocks need WordPress 5.6 or later - The shortcodes and blocks can link each term to its search results, with
link_terms="true"in the shortcodes and by default in the blocks. Searches opened from those links are only recorded if you turn that on, withcount_link_clicks="true"or the setting in the blocks - The text above the lists can be left out, with
show_label="false"in the shortcodes and a setting in the blocks - Searches made by bots are no longer recorded. Crawlers, AI assistants, link previews, monitoring tools and scripts are recognized by their user agent. Searches that contain a link or HTML, or that are longer than 100 characters, are skipped as junk. Both checks are on by default and have a setting
Bugfixes:
- The time filters, the shortcodes and the dashboard widget failed on SQLite databases, such as the one WordPress Playground uses for the Live Preview
- The “Your Last Searches” list of the
[mwtsa_display_search_stats]shortcode showed the terms the visitor searched most often instead of the latest ones - A live search whose requests the plugin records, such as FiboSearch or a custom live search with its parameter listed in the settings, stored a search for every few keystrokes. Successive requests from the same visitor are now merged into one search, and the results page that follows is not counted again
Optimizations:
- Statistics for the time filters are cached for up to a minute, and old cache entries expire after an hour
- The
[mwtsa_display_search_stats]shortcode only loads the terms it shows, instead of every term searched in the period
Others:
- After at least a week of use, the statistics and settings pages show a notice asking for a review. It appears once, and you can dismiss it for good
- The Search Analytics admin menu item uses the plugin’s new icon instead of a generic chart icon
- The statistics and settings pages have a box with a link to the Search Analytics Pro waitlist on wpsearchanalytics.com. The plugin sends nothing to that site
1.6.0
Structure:
- Search data is now only removed when the plugin is deleted and the setting is checked, never on deactivation. The setting is now called “Delete all search data and settings when the plugin is deleted”
- The minimum WordPress version is now 4.7 (1.5.0 already needed it)
Features:
- The country lookup can use ip2c.org (HTTPS, IPv4 only) instead of ip-api.com. Choose it under “Country lookup service”; ip-api.com stays the default
- The new
mwtsa_process_search_term()function records searches from your own code, such as an AJAX live search, with the same checks as a normal search
Bugfixes:
- The statistics charts were not loading since 1.5.0
- The charts and the “By date” view grouped searches by day of the month, merging e.g. 26 August with 26 September. Comparison periods overlapped by a day and the charts showed an extra day
- On multisite, deactivating the plugin on one site with “Remove plugin tables on deactivate” checked removed the search data of every site in the network. New sites now get their tables reliably, and deleting a site removes its search data
- A trailing comma in “Exclude search in case it contains certain substring” excluded every search. Matching now also works for non-English text
- “Last 24 hours”, “Last week” and “Last month” now cover exactly that period instead of starting at midnight
- Loading the second page of search results or the search feed no longer counts as a new search
- Terms with leading or repeated spaces, or longer than 100 characters, got a new row on every search
- The minimum characters setting now counts characters instead of bytes
- The CSV export headers were wrong in the “No Group” view
- Saving the settings reset the chart defaults
- Deleting terms, and the old Dashboard and Settings menu entries, left a half-rendered page instead of redirecting
- The roles allowed on the settings page could not save it, and the roles allowed on the statistics page could not export
- The erase confirmation was skipped in translations containing an apostrophe
Security:
- CSV exports no longer let search terms run as spreadsheet formulas
- The tracking cookie is validated (a malformed cookie made every request fail) and is now HttpOnly and SameSite
- Every action now checks the user’s role, including the chart requests and erasing the history
Optimizations:
- Countries are shown with flag emoji instead of 249 bundled flag images (about 1 MB). Browsers that can’t draw flag emoji, such as Chrome and Edge on Windows, load a small flag font bundled with the plugin
- Added database indexes to the search history and search terms tables. Database upgrades now run from the admin, never during a visitor’s search
- The country lookup only runs for recorded searches, is cached per IP for a day and times out after 2 seconds
- The tracking cookie is no longer re-sent on every page, which kept pages out of full-page caches
- Searches through the REST API are counted without loading every matching post
- The plugin’s stylesheet only loads on its own screens
Deprecations:
- The
mwtsa_stats_table_*andmwtsa_term_stats_table_*filters are deprecated. Search Analytics 2.0 replaces the statistics screens and they will no longer run there
1.5.0
- Structure: Changed the main page from
wp-admin/index.php?page=search-analytics%2Fadmin%2Fincludes%2Fclass.stats.phptowp-admin/admin.php?page=mwtsa-search-analytics. A proper redirect was added to the old route - Structure: Changed the settings page from
wp-admin/options-general.php?page=search-analyticstowp-admin/admin.php?page=mwtsa-search-analytics-settings. A proper redirect was added to the old route - Structure: Added a new way to access the plugin main page as a section on the sidebar.
- Bugfix: Fix a possible crash in case ip-api.com did not return a valid response
- Bugfix: Fix potential IP spoofing when running a search with save country on
- Feature: Added
mwtsa_run_terms_history_data_query_argsfilter for changing the args before history data gets queried - Feature: Added a link to the statistics page on the dashboard widget
- Optimization: Security improvements and general code optimization. Fixed Cross-Site Request Forgery (CSRF) vulnerability
- Optimization: Performance improvements
- Optimization: Added the select2 and jQuery UI Smoothness theme as assets in the plugin
- Optimization: Deprecated the global
$mwtsa. It will be removed in a later version. Use theMWTSAI()to get the instance - Deprecations: Deprecated the helper functions with
mwt_prefix and renamed them to the proper prefixmwtsa_to prevent possible collisions - Deprecations: Deprecated the
mwtsa_run_terms_history_data_queryfilter. It could be used by bad actors to modify the query and pass a not sanitized query through
1.4.16
- Bugfix: Fix bug related to exclude keywords setting, reported here. Thank you @luislu for the report!
1.4.15
- Bugfix: Fix country not being saved, reported here. Thank you @mikeeiler for the report!
1.4.14
- Bugfix: Fix bulk deletion not working.
1.4.13
- Optimization: Security improvements and general code optimization.
1.4.12
- Others: Rename plugin to “Search Analytics for WP”
1.4.11
- Optimization: Security improvements and general code optimization. Fixed Reflected Cross-Site Scripting vulnerability reported by vgo0
1.4.10
- Optimization: Security improvements and general code optimization. Fixed Broken Access Control vulnerability reported by Abdi Pranata. Thank you for the responsible disclosure!
- Optimization: Compatibility with WP 6.6.x
1.4.9
- Bugfix: Fixed warnings showing on specific combination of filters and grouping. Reported here. Thank you @sadesades for the detailed report!
1.4.8
- Optimization: (ENCORE) Security improvements and general code optimization. Fixed this vulnerability
- Optimization: adjust some translations
1.4.7
- Optimization: Security improvements and general code optimization. Fixed this vulnerability
1.4.6
- Optimization: Security improvements and general code optimization. Fixed this vulnerability
- Bugfix: Charts not working after changing interval or chart type
1.4.5
- Bugfix: Fix PHP Compatibility issue: PHP 5.6 – 7.2
1.4.4
- Bugfix: Date filters not working if the browser is set in a language different from English
- Feature: Add setting: “Show results dates as UTC”, default: true
- Feature: Make dates in the results list show as UTC by default.
- Feature: Add 6 more filters and 2 actions for developers to be able to extend the plugin. An overview post will be published here: Search Analytics for WP: Filters Reference
- Optimization: Security improvements and general code optimization
- Optimization: Updates to the settings page
- Deprecations: Deprecated the
mwt_wp_date_format_to_js_datepicker_format()helper function
1.4.3
- Bugfix: Make sure that shortcode mwtsa_display_latest_searches displays unique terms
- Feature: Add more parameters to some filters. An overview post will be published here: Search Analytics for WP: Filters Reference
1.4.2 Hotfix
- Bugfix: fix default filters in the results view
1.4.1
- Feature: Add shortcode mwtsa_display_latest_searches for displaying the latest searches on the frontend of the website
- Feature: Add 3 more filters for developers to be able to extend the plugin. An overview post will be published here: Search Analytics for WP: Filters Reference
- Optimization: Security improvements and general code optimization
- Others: Add link to the complete changelog
1.4.0
- Feature: Add REST API search support
- Feature: Add 9 filters for developers to be able to extend the plugin. An overview post will be published here: Search Analytics for WP: Filters Reference
- Optimization: Add the search term to the mwtsa_extra_exclude_conditions filter
- Optimization: Check for minimum PHP and WP versions when activating the plugin
- Optimization: Compatibility with WP versions up to 6.0.1
- Optimization: Compatibility with PHP v8.1
- Optimization: Security improvements and general code optimization
- Bugfix: Fix styling on WP 4.4.0 – 4.9.20
- Bugfix: Fix broken settings page URL from the results page
- Others: Rename the plugin to “WP Search Analytics”
Older versions
The changes in versions 1.0 to 1.3.6 are listed in the full changelog.
