Skip to content
SilktideHelp

Site search

The Site search screen shows what people type into your site's own search boxes: how many searches there were, the terms searched most, and how any one term rises or falls over time.

It answers questions such as: what are people looking for that they cannot find from the menu? Did a new page stop people searching for it? What did everyone search for after a news story?

Set it up

Silktide records nothing anyone types until you tell it which boxes are search boxes. Go to Analytics > Settings > Data, and under Site search list a CSS selector for each search box, one per line:

#search
input[name=q]
.site-header input[type=search]

Name the box itself, not the form around it: #search-form input matches the box inside the form, #search-form alone matches nothing that can be typed in.

A selector has to name the box by its id, a class or an attribute. A bare input or form input is refused, because it would match every text box on your site.

Saving updates your Silktide Script for you. Visitors' browsers can keep the old script for up to an hour, so the first searches can take that long to appear.

Before a visitor consents: search terms are recorded at every consent level except Nothing, including before a visitor has answered your cookie banner. At Basic they are kept with no visitor ID or IP address, but people can type personal details into a search box, such as their own name or a reference number. Check this fits your privacy policy before you choose a box. To record nothing until a visitor consents, set the level before consent to Nothing.

Read searches from your results page

Listing search boxes records what people type. It cannot tell you whether a search found anything, and a search box that runs its own code when someone presses Enter can be missed. To see which searches found nothing, describe your search results page under Site search instead:

SettingWhat to enterExample
Page addressThe path of the page that shows results/search
Search box on that pageA CSS selector for the box holding what was searched for#search
Shown when there are resultsA CSS selector for something only on screen when a search finds something.results-count
Shown when there are no resultsA CSS selector for something only on screen when a search finds nothing.no-results

Fill in all four, or leave all four empty. Once they are set, Silktide reads each search from this page and no longer from the boxes you listed, so a search is only counted once.

The page's address has to say what was searched for, as /search?q=parking does. Silktide only records the box's value if the address carries the same value, so a box your site fills in itself, such as a signed-in visitor's name, records nothing. A results page whose address doesn't name the search can't be read this way, so keep listing its search boxes instead.

To find them, run a search that finds something and one that finds nothing, and use your browser's Inspect tool on the message each one shows. If the results message states one number, such as "261 results", Silktide records that too. A message with several numbers, such as "1-10 of 261", records no count.

If your site's search changes, these settings can stop matching it. Searches are still counted, but their outcome reads as unknown until you update them.

Some searches will always read as unknown, such as when someone leaves the moment the page changes, or the search itself fails. Silktide leaves the outcome out rather than guess. Clicking a suggestion that goes straight to a page does not count as a search.

What is recorded

When someone types into one of your search boxes, then moves on or presses Enter, Silktide records what they typed: one line of text, cut to 128 bytes. That is all.

If you read searches from your results page, Silktide instead records what is in the search box on that page when the search runs, whether it was typed there or arrived in a link, along with whether the search found anything and how many results the page states.

  • Nothing typed into any other field is recorded, including other boxes in the same form.
  • Only text and search boxes are recorded. A selector that matches a password, email or number field records nothing.
  • With nothing set up, nothing typed is recorded at all.

People sometimes type personal details into a search box, such as their own name or a reference number. Only name boxes whose purpose is searching your site.

Read the screen

Searches is how many searches were made in the period, with the period before when Compare is on.

Top searches ranks the terms searched most. Select a term to see it on its own over the period; select it again, or Show every search, to go back to all of them. The address keeps the term you chose, so you can share it.

The Search terms table underneath lists every term, with its searches and how many visitors searched for it. Search, sort and export it like any other analytics table.

Terms are counted whatever their capital letters, so Parking and parking are one term. Each is shown the way people typed it most.

See what people could not find

Once you read searches from your results page, the screen also shows what those searches found:

  • Searches with no results is how many searches found nothing, with their share of the searches whose outcome is known.
  • Searches that found nothing ranks the terms behind them. Each may be a page to create, or an existing page to change so that people can find it.
  • Without results and Average results in the table show this for every term. Average results counts a search that found nothing as 0.

A search whose outcome is unknown is left out of these figures. So are searches from before you set this up, so a term's cells stay empty until there is something to say.

Going back to an earlier search does not count as a new one. If your search box searches as people type, Silktide only records what they finished typing.

Get site search through the API

The Silktide REST API gives you the same figures, with the date range and filters every analytics endpoint takes:

  • analytics/site-search-terms lists every term with its searches and visitors. term is the term in lowercase; label is how people typed it most. withoutResults and averageResults are empty where the outcome is not known. Add results=none to count only searches that found nothing.
  • analytics/site-searches-over-time counts searches per day. Add term for one term, or results as none or some for one outcome.

Create a key on the API screen; full request shapes are in the developer documentation.

Last updated

Was this page helpful?