Given {query} or multiple caller-supplied queries and optional {language}, {country-code}, {location-token}, and {max-results}, inspect Google's currently rendered organic SERP for competitive research. Return visible organic result positions, competitor titles, URLs, snippets, and bounded evidence. This is read-only: do not open result pages, submit forms, sign in, alter settings, or bypass Google challenges.
Use Cases
- Researching competitors ranking for a commercial or local keyword.
- Comparing visible organic results across several caller-supplied keywords.
- Capturing localized SERPs for a caller-supplied country or location.
- Collecting a bounded first-page SERP snapshot without visiting competitor websites.
- Separating organic competitors from ads, navigation, related searches, and People also ask modules.
Automation Flow
- For each query, build the direct Google URL locally; do not visit the homepage or type into the search box:
https://www.google.com/search?q={url-encoded-query}&hl={language}&gl={country-code}&pws=0&uule={location-token}Omit hl, gl, and uule unless requested. Use pws=0 for a less-personalized result set. Google ignores num and returns about 10 organic results per page; use pagination to collect more results up to {max-results}. {location-token} is an optional caller- or platform-supplied Google geographic targeting token; never fabricate one or retain a redacted/session-specific token. Remove sei, ved, ei, oq, session, continuation, redirect, consent, and challenge parameters from reusable URLs.
- Navigate directly to each clean URL. In the same browser-agent call, wait for the SERP to render and run this evaluator on the loaded page:
(()=>{const clean=s=>(s||'').replace(/\s+/g,' ').trim();const visible=e=>!!e&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)>0;const u=new URL(location.href),body=clean(document.body?.innerText);const blocked=/^\/sorry(?:\/|$)/i.test(u.pathname)||!!document.querySelector('#captcha-form,iframe[src*="recaptcha"]')||(/captcha|unusual traffic|verify you are human|automated queries|consent/i.test(body)&&!document.querySelector('#search'));const canonical=h=>{try{let x=new URL(h,location.href);if(/(^|\.)google\.com$/i.test(x.hostname)&&x.pathname==='/url'){const q=x.searchParams.get('q')||x.searchParams.get('url');if(q)x=new URL(q)}if(!/^https?:$/i.test(x.protocol))return null;x.hash='';return x.href}catch{return null}};const rows=[...document.querySelectorAll('#search a[href]')].map(a=>{const h=a.querySelector('h3');if(!h||!visible(a))return null;const url=canonical(a.href);if(!url)return null;let card=a;while(card.parentElement&&card.parentElement.id!=='rso'&&card.parentElement.querySelectorAll('h3').length===1)card=card.parentElement;return{title:clean(h.textContent),url,snippet:clean(card?.innerText||a.innerText).slice(0,1200)}}).filter(Boolean);const results=[...new Map(rows.map(x=>[x.url+'|'+x.title,x])).values()].map((x,i)=>({...x,organicPosition:i+1}));return{success:!blocked,isGoogleSearch:/(^|\.)google\.com$/i.test(u.hostname)&&u.pathname==='/search',url:location.href,query:u.searchParams.get('q')||'',language:u.searchParams.get('hl')||null,countryCode:u.searchParams.get('gl')||null,locationTokenPresent:u.searchParams.has('uule'),personalization:u.searchParams.get('pws')||null,blocked,results:results.slice(0,Number(u.searchParams.get('num'))||100),visibleOrganicCount:results.length,bodyExcerpt:body.slice(0,2200)}})()Interpret only returned rendered organic rows. Preserve each visible title, observed URL, snippet, and organic position. Do not infer competitor relevance, service quality, location coverage, or business ownership from a title or snippet alone. Ads, map packs, directories, related searches, and People also ask entries are not organic competitors unless separately requested.
For multiple keywords, perform one clean direct navigation and evaluator call per query, then stitch outputs locally while preserving query, locale, optional geographic-targeting provenance, timestamp, URL, and rank. Deduplicate only within each query by normalized URL plus title; the same domain may legitimately rank for multiple keywords.
If more results are explicitly requested than are rendered, paginate with
start=10,start=20, and so on, increasing by 10 rather than by{max-results}, only until the caller's limit, no new URLs appear, or Google becomes blocked. Do not retain opaque pagination or challenge parameters.If Google reaches
/sorry/, shows CAPTCHA, unusual-traffic, consent, verification, login, or incomplete dynamic content, return the query as blocked or unresolved. Do not retry challenge URLs, solve challenges, retain cookies or tokens, or interpret a blocked page as having no competitors.
Possible Friction Points
- The durable Google search surface is
/search?q=...;hlandgllocalize the SERP, whilepws=0requests non-personalized results. - An optional
uulequery parameter can apply a geographic location, but its value is an opaque location token. Use it only when supplied by the caller or an approved platform mechanism; never guess or save a token from a challenge/session URL. - Organic results are most reliably identified by visible
#search a[href]elements containing anh3. Ads and SERP modules may use other anchors and must not be counted. - Google may expose direct result URLs or
/url?q=...wrappers. Decode the destination for evidence but do not reuse wrapper URLs as durable inputs. - Google ignores
num; pagination in increments of 10 is the way to collect more organic results. - Rankings, snippets, URLs, localization, geographic targeting, personalization, device context, and result availability change over time. This is a bounded SERP snapshot, not an exhaustive market census.
- A domain appearing in a snippet, advertisement, map result, directory listing, or related-search link is not by itself an organic competitor result.
- A missing domain or competitor means only that it was not visible in the bounded rendered SERP; it does not prove absence, deindexing, or lack of market activity.
/sorry/, CAPTCHA, consent, unusual-traffic, and verification pages are blocked states. Do not bypass them or retain challenge state.- Do not open result pages or infer page quality, conversion performance, or SEO causes from rank alone.
Example Result
{
"success": true,
"isGoogleSearch": true,
"url": "https://www.google.com/search?q=example",
"query": "example",
"language": null,
"countryCode": null,
"locationTokenPresent": false,
"personalization": null,
"blocked": false,
"results": [
{
"title": "Example Title",
"url": "https://example.com/page",
"snippet": "Example result snippet",
"organicPosition": 1
}
],
"visibleOrganicCount": 1,
"bodyExcerpt": "Example search results"
}