Finding your next read
Practical craft for people building for the web.
Explore DevelopmentFinding your next read
THE FINDERPRESS TOOL DIRECTORY
Explore this tool and check the official listing for its latest features and requirements.
01 / SOURCE DETAILS
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 dashboard widget with last week’s numbers. 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. Optional country and logged-in user for each search, both off by default. Two shortcodes to show popular or recent searches on your site. 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. Nothing 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). 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 , plus filters on the shortcode output. 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 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 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.
02 / SOURCE DETAILS
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.
03 / SOURCE DETAILS
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. 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. Opening page 2 of the results or the search feed doesn’t count as a new search. 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 has to record its searches itself. Call this from the code that handles it, once per finished search rather than on every keystroke: 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. 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. You can erase all data, or everything older than a number of days, from the settings at any time. 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, with two 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. [mwtsa_display_latest_searches] lists the most recent search terms. Both hide terms with no results by default and take options for the period, the number of terms and the labels. For example, [mwtsa_display_latest_searches unit="month" count="5"] shows the five most recent terms from the past month. In a widget area, use the Shortcode block, or the Text widget on WordPress 4.9 and later. On 4.7 and 4.8, 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.
KEEP EXPLORING