Common reasons search-usage tracking doesn’t fire
- GTM container not published - You imported the container but didn’t click Submit → Publish.
- GTM snippet not installed on your site - The GTM code needs to be in your site’s <head> and <body>.
- Search submits to a different URL - Many sites navigate to
/search?q=...on submit. A Form Submission trigger won’t catch this - it’s effectively a Page View. Use a Page View trigger filtered by Page Path =/searchinstead, with the search term pulled from theqURL parameter. - AJAX search with no navigation - Modern site search (Algolia, Typesense, instant search) updates results in place without changing the URL. A Page View trigger won’t fire. You need a Custom Event triggered by a DOM listener on the search input’s
inputorsubmitevents (debounced). - Search input is in a popover / modal - Click the search icon, the input element is created on the fly. A listener attached on DOM Ready won’t find it. Use event delegation: attach to
documentwith a CSS-selector filter. - Autocomplete suggestion clicked instead of full submit - Users often pick an autocomplete result rather than pressing Enter. That counts as a navigation, not a search. Decide whether to count autocomplete picks as searches; if yes, hook the autocomplete-pick event from your search vendor.
Step-by-step debugging checklist
- Verify GTM is installed - Visit your site, right-click → View Page Source, search for “GTM-”. If you don’t see it, GTM isn’t installed.
- Check GTM Preview mode - In GTM, click Preview. Navigate your site and trigger the event. Look for your tag in the Tags Fired section.
- Check the trigger - If the tag shows as “Not Fired”, click on it to see which trigger conditions aren’t met.
- Submit a search and watch the URL bar - Does the URL change to include
?q=...or similar? If yes: use a Page View trigger filtered by Page Path. If no: it’s AJAX - you need a Custom Event trigger. - For AJAX: open the Network tab - Type a query. Look for an XHR / Fetch request to the search endpoint (e.g.,
algolia.net,/api/search). The request fires on every keystroke (debounced) - that’s your hook. - For URL-param search: confirm the term is captured - Open GTM Preview, search for something. The Page URL variable should include
?q=yourquery. Use a URL variable in GTM to extract just theqparam into asearch_termdataLayer variable.
How to verify it’s working
- Open GTM Preview/Debug mode
- Navigate to your site
- Trigger the event (submit a search query)
- Check the GTM debug panel - your tag should appear under “Tags Fired”
- Check GA4 DebugView (GA4 → Admin → DebugView) to confirm the event arrived
Still didn’t work?
Our team can help. Describe what’s happening and we’ll get back to you within 24 hours.