# Measure GA4 site search without exposing private queries Measure site search with the search event while keeping query text out of URLs and parameters; validate the redaction and the results behavior. - Canonical: https://satracking.net/guides/ga4-search-privacy/ - Language: en - Category: events - Level: beginner - Published: 2026-11-10 - Updated: 2026-11-10 --- ## Audience and prerequisites Measure site search with the search event while keeping query text out of URLs and parameters; validate the redaction and the results behavior. You need to know how search results are produced and whether query text can contain personal or sensitive information. Skill: beginner. Reading time: six minutes. ## 1. Choose when a search counts Google recommends `search` when a user performs a search; its reference lists `search_term` as a required parameter. Fire at the defined search-results action, not on every keystroke. Search measurement may also be available through GA4 enhanced measurement depending on the configured query parameter. Check the property's setup before adding a manual event to avoid duplicates. ## 2. Decide whether the query is safe to collect Review the search field, URL, and query parameter. Names, emails, account numbers, medical or financial terms, and free text may reveal personal information. If the query can contain such data, do not send raw `search_term`. Use an approved safer design, such as categorizing the query into a non-identifying topic only when the category is useful and genuinely controlled. Do not assume hashing makes arbitrary query text safe. ### Direct Google tag (`gtag.js`) Only if the raw query is approved for collection, a direct event can look like: ```js gtag('event', 'search', { search_term: 'blue shoes' }); ``` This is a Google tag call. Replace the value with a real, permitted query; never use personal test data. ### GTM and generic data layer With GTM, configure a GA4 Event tag for `search` and map an approved value. Application code may push a generic search-success message into `dataLayer`, but that message alone is not a GA4 event. Do not send both a direct call and GTM tag for one search. ## 3. Validate collection boundaries Test a permitted query and a query that should be excluded. Preview the event, inspect the final parameter, and confirm the intended property in DebugView. Check the page URL as well: raw search terms in URLs may be collected through page location even when `search_term` is omitted. ## Privacy and limits Apply consent settings and data minimization. If no safe value can represent the search, measure the search action without its raw contents or omit the event. Tag Assistant and DebugView show implementation behavior and receipt, not a privacy approval. ## Related work For event naming and validation, see [Choose a GA4 recommended or custom event](/guides/ga4-recommended-vs-custom/). ## Official references - Recommended events: search — https://developers.google.com/analytics/devguides/collection/ga4/reference/events#search (verified 2026-11-10) - Set up events — https://developers.google.com/analytics/devguides/collection/ga4/events (verified 2026-11-10)