Clycyo
How-to4 min read

How to Track Internal Site Search Queries

What visitors type into your search box is a free content roadmap. Track queries as events and mine the zero-results report.

Visitors who use your site search are dictating your content roadmap to you, verbatim, for free — and most sites throw the transcript away. Search queries are declared intent from people already on your site: what they expected to find, in their own words, including everything you have not built or written yet. Two events capture the whole signal.

Event 1: the search itself

// On search submit (or debounced for live search)
window.webanalytics?.track('site_search', {
  query: q.toLowerCase().trim(),
  results: resultCount,
  page: location.pathname,
});

Normalize the query (lowercase, trim) so 'Pricing' and 'pricing ' aggregate. For search-as-you-type, fire on a 1.5-second pause or on result-click — not per keystroke, which floods the data with prefixes.

Event 2: what they did with the results

window.webanalytics?.track('search_result_clicked', {
  query: q, position: idx, target: href,
});

Search without a result click is a dead end — the visitor asked, you answered, they walked away. That gap is the refinement signal.

The three reports, in priority order

  1. Zero-results queries. The purest gold: demand with no supply. Recurring zero-result queries are either content you should write, products you should stock, or synonyms your search should learn ('sign in' finding nothing because the page says 'login' is a five-minute fix worth real conversions).
  2. High-volume queries with low click-through. You have content, but the results presentation fails it — bad titles, wrong ordering, or the right page buried at position six.
  3. Queries for things prominently in your navigation. People search for what they cannot find by looking. 'Pricing' as a top query means your pricing link is invisible — an information-architecture bug report, written by users.

Privacy guardrail

Site-search queries occasionally contain emails or personal data typed by confused visitors. Filter obvious PII patterns before sending (an @ test catches most of it), and keep the property limited to the cleaned query string.

Docs sites get particular leverage here — search-to-page paths reveal which questions your documentation answers badly. For content sites, the zero-results report alone typically pays for the entire analytics setup in editorial clarity.