Adding Search to a Business Website

A search box is the quickest route for visitors who know what they want, and a useful source of data about what they came for. A poor one does more harm than none: empty results, odd suggestions and a box nobody can find. This guide covers when a site needs search, how to design the box, the suggestions and the results page, and how to measure searches in Google Analytics 4. It draws on Nielsen Norman Group usability research, the W3C's WCAG 2.2, MDN and Google's Analytics documentation, checked on 3 November 2026.

Does your site need search?

Not every site does. A ten-page service site with a clear menu may be easier to use without a search box than with one that returns poor results. Search becomes more useful as a site grows: a shop with many products, a blog or help centre with hundreds of articles, a member area full of documents. If most visitors arrive from ads or emails for one offer, a focused page may serve them better; see our guide to landing page basics.

Nielsen Norman Group (NN/g) gave a rule of thumb back in 1997, in Search and You May Find: "sites with more than about 200 pages should offer search". The same article describes "search-dominant" users, who "will usually go straight for the search button when they enter a website", alongside link-dominant users who prefer to follow menus. So search adds to good navigation rather than replacing it. As NN/g puts it, users who arrive through search "still need structure to understand the nature of the page relative to the rest of the site".

Search also helps accessibility. WCAG 2.2 success criterion 2.4.5, Multiple Ways, asks that "more than one way is available to locate a web page within a set of web pages". The W3C notes that people using a screen magnifier or screen reader "may find it easier to navigate to the correct part of the site by using a search", and that some people with cognitive limitations find search easier than a hierarchical menu. A search function is one way to meet it; a site map or links between related pages are others.

The search box

NN/g's article Search: Visible and Simple (2001, with later updates) found that users scan the page looking for "the little box where I can type". Its main advice:

  • Show search as a box people can type in, not just a link or an icon that has to be opened first, at least on the home page.
  • Put it at the top of the page, where people look for it, and on every page, because "you cannot predict where users will be when they decide they are lost".
  • Make the field wide enough for a typical query.
  • Search the whole site by default. NN/g warns that users "often overlook the scope" when a search is limited to one section.
  • Keep advanced options off the home page. In the same study, the average query was 2.0 words long.

On small phone screens a search icon that opens the box is common; make sure the icon is recognisable and has an accessible name such as "Search". In the code, MDN explains that the HTML <search> element "defines a search landmark", which lets screen reader users jump straight to it. Give the input a visible or programmatic label too; our website accessibility guide covers labels and keyboard use.

Search suggestions (autocomplete)

Search suggestions are the list of queries that appears under the box as people type. In NN/g's article on site search suggestions (2018), they have "become an expected sign of a well-designed search feature". They help people pick a term that has good results, type less and avoid typos. In NN/g's ecommerce study people chose a suggestion in "only 23% of the instances where they were offered", but still used the list as a reference for spelling and for what the site offers.

NN/g's main rules:

  • Don't suggest bad results. "Make sure every suggested query actually has good, relevant results." Suggestions that lead to nothing "are worse than unhelpful".
  • Style the two parts differently. Use bold or colour to separate what the person typed from what the system adds.
  • Watch what is missing. If a product does not appear after a few letters, some users may conclude the site doesn't offer it and leave without searching.

The results page

NN/g found that "users almost never look beyond the second page of search results", so the order matters more than the count. A few practical points:

  • Keep the query in the search box at the top, so people can edit it.
  • Show each result with its page title, a short extract and, for products, a photo and price.
  • Put the pages people most often want first, even if a weaker match mentions the words more often. NN/g recommends checking "the most common queries" and choosing the best landing page for each.
  • Leave out pages nobody should land on, such as thank-you pages, old drafts and admin screens.

When there are no results

NN/g's guidelines for "No Results" pages (2014) warn that these pages often "become a dead end", and that in its research people often hit them "when the content exists, but for some reason doesn't show up as a match for their query". Its three guidelines:

  1. Clearly explain that there are no matching results. In NN/g's eye-tracking, one user did not see a small "no matches" message at all.
  2. Offer starting points. Restate the query, keep it in an editable search box, and offer spelling corrections, similar queries that do have results, and advice to try different or fewer words.
  3. Don't mock the user.

The same thinking applies to missing pages; see our guide to 404 pages and redirects.

Tuning results with real queries

NN/g calls the analysis of site-search logs "one of the biggest missed opportunities in UX research". Its search-log analysis article suggests pulling the top query terms over three to six months, grouping terms with similar meanings, and getting "the list of search terms with no results". From there, most search tools let you:

  • pin the best page to the top for a common query (NN/g calls these "best bets");
  • add synonyms, so a search for one word also finds another, including common misspellings;
  • spot content you do not have yet, or pages whose titles use different words from your customers.

The words people search for are often the words to use in menus and headings; our guide to writing website copy covers that side. NN/g also warns that raw logs with IP addresses or user identifiers are sensitive: "don't lose control of this data".

Measuring searches in GA4

Google Analytics 4 can record searches without extra code. Google's help page on enhanced measurement events says the view_search_results event fires "each time a user is presented with a search results page, as indicated by the presence of a URL query parameter". By default it looks for five parameters: q, s, search, query and keyword, and you can add others. The search_term parameter fills the "Search term" dimension. You turn these events on or off under Admin, Data streams.

If your search shows results without changing the address, for example in a pop-up, it will not be picked up. Google's recommended events reference describes a search event with a search_term parameter that your developer can send instead. Google also says "you're required to ensure that no personally identifiable information is collected", which matters if people might type an email address or order number into the box. For setting up GA4 itself, see our Google Analytics 4 guide.

A checklist

  • The site is large enough to need search, and the menus still work without it.
  • A visible search box at the top of every page, searching the whole site.
  • The box has a label and sits in a search landmark.
  • Every suggestion leads to good results.
  • The most wanted pages come first; thank-you and admin pages are excluded.
  • The no-results page says so clearly and offers ways forward.
  • Searches are recorded in GA4 without personal data, and reviewed every few months.

Frequently asked questions

When does a website need a search box?

When people cannot reliably find things through the menus alone, usually because the site is large: a shop, a blog or help centre, or a document library. NN/g's old rule of thumb was about 200 pages. A small service site with clear menus may not need one.

Should search suggestions (autocomplete) be added?

NN/g calls them an expected sign of a well-designed search feature. Only suggest queries that return good results, and style the typed text differently from the suggested part.

What should a no-results page show?

A clear statement that nothing matched, the query in an editable search box, spelling corrections or similar queries that do have results, and links to the main sections or a way to contact you.

How do I see what people search for in Google Analytics 4?

With enhanced measurement on, GA4 records a view_search_results event when the results page address contains a query parameter such as q, s, search, query or keyword. The search term appears in the Search term dimension.

Is site search data personal data?

It can be. People sometimes type names, email addresses or order numbers into a search box, and raw logs may hold IP addresses. Google requires that no personally identifiable information is sent to Analytics, so filter it out.

Planning a new website? We start with a sitemap and the key page layouts, so you can see how people will find things before any design work, and check speed, forms and accessibility before launch. See our website development service and all our services, or email [email protected].