Zero-result searches in your store: how to track them in GA4
From the work/ 13 min read
How to track zero-result searches from a Shopify store in GA4, build a weekly report of the ten most common terms and decide what to fix first.
- Analytics
- Shopify
- CRO
In this article (8)
Zero-result searches are the list of things your customers want and your store does not show them. GA4 gets the search term but not how many results came back, so you need your own event: on Shopify, a custom pixel that listens to search_submitted and sends search_no_results with the term when no products match.
Below is the pixel code, how to register the term in GA4 and pull the ten most common terms every week, and how to tell whether each term is a synonym, a typo or a product you do not sell. We ran the code in Node against a fake analytics object; the terms and numbers in the examples are illustrative.
Why zero-result searches matter
Someone typing into your search box already knows what they want. If the page answers with zero products, they have no next step: no product, no filter, no suggestion. Every term on that list is a specific question your catalog did not answer, in your customer's own words. It is one of the few analytics datasets that tells you what to do without much interpretation.
Shopify already has a report. The Search & Discovery app shows Searches with no results for the last 30 days and sends you to Analytics > Reports for other date ranges, according to its reports page. It counts your store's search results page and leaves predictive search out. If that is enough for you, use it. Sending the data to GA4 makes sense when you already review GA4 every week, want the term next to your traffic sources and campaigns, or want to clean and group terms your own way.
Doesn't GA4 track this on its own? Partly. The Site search enhanced measurement sends view_search_results every time someone sees a results page, and it detects one by a URL query parameter: q, s, search, query and keyword by default, per the enhanced measurement events list. Shopify uses /search?q=, so it matches when your Google tag runs on the page. The event carries search_term, which fills the Search term dimension. What it does not carry is how many results there were: a search with a hundred products and one with zero look the same.
Scroll the figure sideways to see all of it
The GA4 event with the search term
Shopify publishes a standard event, search_submitted, when someone searches the online store. It carries the query in searchResult.query and the returned products in searchResult.productVariants, with the first variant of each product. If that array is empty, the search found no products. A custom pixel can listen for it and send GA4 an event of its own only in that case.
Why a custom event name and a custom parameter? Per GA4's dimensions list, Search term is filled by search_term on the search or view_search_results events; a custom event comes with no such promise. And the custom dimensions guide asks you not to create one that duplicates a predefined dimension. So the term travels in zero_result_term and you register it as a dimension. It also keeps clear of any search event another tag may already send.
The pixel, based on Shopify's example for loading the Google tag in a custom pixel:
// Shopify admin > Settings > Customer events > Add custom pixel
const GA_ID = "G-XXXXXXXXXX"; // your GA4 measurement ID
const script = document.createElement("script");
script.setAttribute("src", `https://www.googletagmanager.com/gtag/js?id=${GA_ID}`);
script.setAttribute("async", "");
document.head.appendChild(script);
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag("js", new Date());
gtag("config", GA_ID, { send_page_view: false });
analytics.subscribe("search_submitted", (event) => {
const result = event.data?.searchResult;
if (!result || result.productVariants.length > 0) return; // only searches with zero products
let term = (result.query || "").trim().toLowerCase().replace(/\s+/g, " ");
if (!term) return;
if (term.includes("@") || term.replace(/\D/g, "").length >= 7) term = "(redacted)"; // no emails or phone numbers
const { origin, pathname } = event.context.window.location;
gtag("event", "search_no_results", {
zero_result_term: term.slice(0, 100),
page_location: origin + pathname, // the store URL without ?q=, which holds the raw term
});
});
- You create the pixel in the Shopify admin under Settings > Customer events.
GA_IDis your GA4 property's measurement ID. - The next four lines load
gtag.jswith JavaScript, because Shopify pixels do not accept HTML: you cannot paste a<script src>tag. dataLayerandgtagare the same as in any Google tag install.send_page_view: falsestops this pixel from sending a secondpage_viewon top of the one your GA4 setup already sends.analytics.subscribelistens forsearch_submitted. If there is at least one product, the function returns: only empty searches matter here.- The term gets cleaned: trimmed, lowercased and with repeated spaces collapsed. That way
White Sneakersandwhite sneakerscount as one. - If the text looks like an email (it has
@) or holds seven or more digits, it is sent as(redacted). Google explicitly asks you not to send personal data in site search terms, and people do type emails and phone numbers into search boxes (Google's PII guidance). The cost: a searched barcode also ends up as(redacted). search_no_resultscarries the term cut to 100 characters, the maximum length of a GA4 parameter value (collection limits), and apage_locationwithout the?q=part, which holds the raw term.
Three details from the documentation. Shopify warns in its Google Tag Manager in a pixel tutorial that inside the sandbox, URLs carry sandbox information; that is why page_location is built from the location the event carries. Pixels only run when the visitor has given the permissions their configuration requires, Marketing and Analytics by default: check what yours asks for. And the Google tag reference marks gtag('config') as deprecated, while saying existing setups keep working; Shopify's example still uses it.
We ran the pixel in Node with a fake analytics object and fired eight searches at it: it produced six search_no_results events, none for the search with products or the blank one, with the email, phone number and barcode sent as (redacted). On your store, test it with Shopify's Pixel Helper and DebugView, as in the add_to_cart event article. Tag Assistant does not see tags that run inside a pixel.
If your GA4 tag lives in the theme rather than in a pixel, the Liquid search object gives you search.results_count on the search template, capped at 1,000. Note one difference: results_count also counts pages and blog articles, while productVariants only holds products. For a store, zero products is what counts.
The weekly report of the ten most common terms
First, register the parameter as a dimension. In GA4, go to Admin > Data display > Custom definitions, the Custom dimensions tab, then Create custom dimensions:
- Dimension name:
Zero result term. No hyphens: GA4 accepts spaces and underscores, not hyphens. - Scope: Event. It cannot be changed later.
- Event parameter:
zero_result_term, spelled exactly as in the code. This cannot be changed either.
A standard property allows 50 event-scoped custom dimensions, and the dimension takes 24 to 48 hours to show up in reports. Then build the exploration (explorations documentation):
- Explore, blank exploration: the default technique is the free-form table.
- Under Variables, import the Zero result term and Event name dimensions and the Event count metric.
- Put Zero result term in rows and Event count in values.
- Filter: Event name exactly matches
search_no_results. - Date range: last 7 days. Sort by Event count, highest first.
Save it and open it every Monday. Exporting to CSV, TSV or Google Sheets gives you every row, not just the visible ones. Processing can take 24 to 48 hours (data freshness), so on Monday review the previous full week, not the last two days.
Scroll the figure sideways to see all of it
GA4 already groups by term, but the same word written with and without an accent is still two rows. That is what top-terms.mjs is for: a dependency-free Node script, included in full in the guide. It reads the exported CSV, merges terms that only differ in case, accents or spacing and, if you pass it a list of words from your catalog, flags likely typos. This is its real output on an illustrative CSV:
$ node top-terms.mjs ga4-export.csv catalog.txt
# searches term hint
1 38 rain jacket
2 22 leather neklase typo? neklase -> necklace
3 18 cafe hoodie
4 14 cap, green
5 13 school backpack
6 11 (redacted)
7 11 socks
8 9 cargo pants
9 8 sunglasses
10 6 scarf
- The script skips the
#lines GA4 writes before the header, the header itself and a totals row if there is one. rain jacketadds up to 38 because it mergedRain Jacket(7) with the lowercase spelling (31). Same forcafé hoodieandcafe hoodie.neklaseis two letters away fromnecklace, a catalog word: a typo candidate. It only compares words of five letters or more, because on short words the hint misfires too often.(redacted)on the list tells you how many people type personal data into your search box. There is nothing to fix there.- It prints only the top ten. That is the week's report.
Synonyms, typos and missing products
Before you classify anything, know what Shopify search already does, per its search behavior page. For products it searches the title, description, product type, tags, vendor and the variants' title, SKU and barcode. It treats singular and plural as the same. It tolerates typos of one letter or two swapped letters in title, description, type, tags, variant title and vendor, but not in the SKU. And it joins words with AND by default: all of them have to match. On top of that, search includes semantic understanding with nothing to switch on: it uses title, description and product type, not images (Search & Discovery page).
So what reaches your list are the cases search could not solve. Nearly all of them fall into a few groups:
| Cause | How you spot it | Fix |
|---|---|---|
| Synonym | You sell it under another name: people search sneakers, your catalog says trainers | Add the word to tags, product type or description |
| Typo | More than one letter away from a catalog word, like neklase | Add that spelling as a tag |
| Data in a field search does not read | The detail exists, but in a metafield or an image | Move it to title, type, tags or description |
| Too many words | Each word exists, but no product has all of them | Complete the description of the product that does match |
| Missing product | You do not sell it, like socks | Decide whether to stock it and, if not, what to show instead |
A note on synonyms: Shopify's current page on modifying search describes product boosts (up to 10 terms per product) and semantic understanding, and no longer describes synonym groups. If your admin still shows them, use them; if not, the fix is to put your customer's word into the product data. Tags work because search reads them; check whether your theme displays them on the product page.
Scroll the figure sideways to see all of it
Predictive search is separate. It is another API, with its own typo tolerance and at most 10 suggestions per type (predictive search reference). The search_submitted docs do not say the dropdown fires the event, and Shopify's own report leaves predictive search out, so treat your list as the results page's list. If your store is headless and you own the search, synonyms are better handled with semantic product search with embeddings and pgvector than with hand-kept lists.
What to fix first
The rule: most searched and cheapest to fix goes first. A synonym or a typo is a few minutes of product data editing; a missing product is a buying decision. With the illustrative list above, the order would be:
- Drop the noise.
(redacted)and one- or two-letter terms are not fixable. - Classify the ten with the table. In the example,
rain jacketis a synonym if you sell waterproof coats, andleather neklaseis a typo. - Fix the cheap ones: synonyms, typos and data outside the searched fields. Check each one in the Search & Discovery results preview before calling it done.
- Log the missing products and wait for a few weeks of data before deciding. A term that shows up one week is not the same as one that shows up four weeks in a row.
- Check again next Monday that the fixed terms are gone from the list. If they are still there, the fix did not work.
The weekly template in the guide has a column for each step: term, searches, cause, fix, date, and whether it was gone the following week.
Common mistakes
- Relying on
view_search_results. It gives you the term, not the result count: it cannot tell an empty search from a full one. - Reusing
search_termon a custom event and expecting it to fill Search term. Google documents that dimension forsearchandview_search_results. - A hyphen in the dimension name. GA4 rejects it; use spaces or underscores.
- Sending the raw term. Emails and phone numbers end up in GA4, and in
page_locationtoo if you keep the full URL with?q=. - Leaving the pixel's
page_viewon. Withoutsend_page_view: false, each load may count twice. - Looking at the last two days. Processing takes up to 48 hours; review the closed week.
- Fixing without measuring again. If the term is still on the list next week, it is not fixed.
Frequently asked questions
Isn't Shopify's own report enough?
It may be. Search & Discovery already shows searches with no results for the last 30 days. GA4 pays off if you already work there every week, want to cross the term with traffic sources or campaigns, or want to group terms with your own rules.
Why not send the search event with a results parameter?
You can: the recommended search event only requires search_term. But if another tag already sends it, you would count twice. A separate event, search_no_results, only exists when there were no products, so the report comes from a filter, not a subtraction.
How long until it shows up in GA4?
Minutes in Realtime and DebugView. In reports and explorations, processing can take 24 to 48 hours, and the custom dimension another 24 to 48 from the moment you create it.
Does this count predictive search?
Do not assume so. Shopify documents search_submitted for searches on the online store, not for the dropdown, and its own report leaves predictive search out. Your list reflects the results page.
Checklist
- The custom pixel listens to
search_submittedand only sends whenproductVariantsis empty. - The term is lowercased, has no double spaces, is cut to 100 characters and carries no emails or phone numbers.
page_locationhas no?q=.send_page_view: falseis set in the pixel.- You checked which privacy permissions the pixel requires.
- The Zero result term dimension exists, event-scoped, on the
zero_result_termparameter. - The exploration filters on
search_no_resultsand covers the last 7 days. - Every Monday you export, run the script and fill in the template.
- Every fixed term gets checked the following week.
If you later want to see how many of those searches end in a purchase, start by tracking the cart properly with the GA4 add_to_cart event, and if your GA4 numbers do not match Shopify, read why GA4 and Shopify sales don't match.
Saw this on Instagram? Comment BUSQUEDA on the Reel and I'll send you the guide.
Written by

Published November 19, 2026