Site search: measure internal searches

Your site's search box is a direct line to what visitors want. Two small events show what they look for, and what they cannot find.

Three events, one pattern

Search measurement is built on three events. The first two are the foundation, the third is optional and unlocks search CTR.

EventWhen to send it
site_searchOn every completed search, regardless of the number of results.
site_search_zeroWhen a search returns 0 results. Sent in addition to site_search.
site_search_clickWhen the visitor clicks a search result. Optional, enables search CTR.

Step 1: register properties

Properties must be registered before they are stored. Register query under Settings, Properties in the dashboard, and preferably results_count and source.

queryThe search phrase, normalized: lowercase and trimmed.
results_countNumber of results the search returned.
sourceWhere the search happened: autocomplete or results page.

Unregistered properties are silently dropped on ingest. The events are still counted, but the phrases will be missing in the view.

Step 2: send the events

Send site_search on every completed search. If the search returns 0 results, also send site_search_zero.

// On every search
va('event', 'site_search', {
  query: 'soffbord ek',
  results_count: 12,
  source: 'resultatsida'
});

// On 0 results, send both events
va('event', 'site_search_zero', {
  query: 'soffbord ekk',
  source: 'resultatsida'
});

Step 3 (optional): measure search CTR

Send site_search_click when the visitor clicks a search result. The view can then compute search CTR, the share of searches that lead somewhere.

// On a search result click
va('event', 'site_search_click', {
  query: 'soffbord ek',
  source: 'resultatsida'
});

Note: autocomplete and keystrokes

An autocomplete that searches while the visitor types easily sends one event per keystroke. Prefer sending the event when the visitor pauses (debounce, about 500 ms) or when the search is committed. The view can collapse prefix variants, but the data is cleaner if the noise is never sent.

How to read the view

The Site search view lives per site in the dashboard and shows the last 90 days.

  • The zero-results list is your action list: phrases visitors look for but do not find. Fill the gaps with products, synonyms or content.
  • Zero rate is the share of searches with no results. Below 20% is good, above 40% suggests gaps in your catalog or a too strict search engine.
  • The top searches show what visitors look for most often. Compare with what your site highlights on the start page and in menus.
  • Search CTR appears once site_search_click is sent: the share of searches that lead to a click on a result.

Tips

Normalize the phrase before sending it: lowercase and trimmed whitespace. That way different spellings of the same phrase group together in the lists.

Let AI do the work

Copy the prompt and give it to your AI assistant together with the code for your search feature.

Prompt to copy

Instrument the search feature on savri.io with Savri events. The site already has the Savri script installed (window.va). 1. Register properties in the Savri dashboard under Settings, Properties: query, results_count and source. 2. On every completed search: send the site_search event via va('event', 'site_search', ...) with query (the search phrase, lowercase and trimmed), results_count (number of results) and source ('autocomplete' or 'results'). 3. If the search returns 0 results: also send the site_search_zero event with the same query and source. 4. If autocomplete searches while the user types: debounce about 500 ms so one event is sent per finished phrase, not per keystroke. 5. Optional for search CTR: on a search result click, send the site_search_click event with query and source. Use window.va?.() so the code does not crash if the script is blocked.