Disclosure: This first-party sample came from AgentSEO's search API. I am affiliated with AgentSEO. AI was used to collect and analyze the sample, create the chart, and draft this article. The method and counts were checked against the saved responses. This is a technical case study, not a provider comparison.
If a rank tracker groups results by new URL(result.url).hostname, a Google redirect link can quietly turn every competitor into google.com.
That sounds like a bad example invented for a test. It happened in a live integration check. On 9 November 2026, an AgentSEO check pulled two US/English queries through its search API: serp api and rank tracking api. The first returned five organic items; the second returned nine. Thirteen of those 14 url fields started with https://google.com/goto?.... The remaining one pointed directly to workspace.google.com.
The search positions and titles were present. The destination domain was hidden behind a click redirect. A domain chart built from the raw URL fields would say google.com dominated both SERPs. That is a parsing error, not a search finding.
The useful question is what an integration should do when the URL it receives is a navigation link rather than the ranked page URL.
The method: two queries, fourteen URLs, one narrow finding
Both requests used the United States location code 2840, language en, and the API's default device setting. The check requested the visible organic result set once per query. The audit recorded each item’s rank, raw URL host, redirect response codes, and the host in the final Location header. It did not download destination page bodies.
For the 13 google.com/goto links, a small script made an HTTPS request with redirects disabled. It accepted a redirect hop only while the current host was exactly google.com or www.google.com; it stopped once the Location header pointed elsewhere. Every one of the 13 links resolved in two hops: a 301 to www.google.com, then a 302 to a destination site. All 13 exposed a destination host. Across the 14 results, those hosts comprised 13 distinct hostnames. Distinct hostnames are not the same thing as distinct companies or root domains.
| Query | Organic items | Google redirect URLs | Direct URLs | Redirects whose destination host was found |
|---|---|---|---|---|
|
| 5 | 4 | 1 | 4 |
|
| 9 | 9 | 0 | 9 |
| Combined | 14 | 13 | 1 | 13 |
Figure 1. Original first-party URL audit, 9 November 2026. The chart counts URL shape in two response sets. It does not measure redirect prevalence across providers, keywords, locations, or dates.
One row is enough to show the problem:
query: "serp api" rank: 1 raw URL host: google.com redirect chain: 301 -> 302 destination host: serpstack.com The opaque query token is omitted here because its bytes are not needed to reproduce the failure mode. The actual ranked host is not google.com in that row. A naive hostname call on the raw URL would attribute rank 1 to the wrong domain.
Why the browser can be right while the report is wrong
A user clicks the link and lands on the vendor page. A reporting job often never clicks anything. It just parses the URL string, stores the host, and groups results by domain.
That makes the error especially easy to miss. The result looks structurally valid: https URL, title, description, and rank. A dashboard can render it perfectly. Only the domain grouping, share-of-voice report, competitor extraction, and sometimes an allowlist filter are wrong.
The right mental model is to keep two fields separate:
type OrganicResult = { rank: number; navigationUrl: string; // The URL supplied for clicking rawHost: string; // Host found in navigationUrl rankingHost?: string; // Null for a known redirect wrapper hostSource: "raw-url-unverified" | "resolved" | "wrapper-unresolved"; }; Do not overwrite navigationUrl with a guessed destination. That loses the original evidence and makes a later audit harder. Do not call a redirect wrapper's host the ranking domain either.
Here is a minimal classification gate. It does not attempt to resolve a URL on the server:
function classifyResult(url: string) { const parsed = new URL(url); const isGoogleGoto = parsed.protocol === "https:" && ["google.com", "www.google.com"].includes(parsed.hostname) && parsed.pathname === "/goto"; return { navigationUrl: url, rawHost: parsed.hostname, rankingHost: isGoogleGoto ? null : parsed.hostname, hostSource: isGoogleGoto ? "wrapper-unresolved" : "raw-url-unverified", } as const; } For the sample above, this changes a false google.com attribution into an honest wrapper-unresolved. A non-wrapper URL still carries only raw-URL evidence; it may redirect too. A rank report can exclude unresolved rows from domain aggregation, display a warning, or use a separately verified destination field. None of those choices invents a winning domain.
Do not “fix” this with unrestricted redirect following
The first instinct is to call fetch(result.url) and use the final URL. That can work on a trusted one-off sample. It is a poor general rule for a server that receives arbitrary URLs.
Redirects can move a request to a host that was never validated. OWASP's SSRF prevention guidance specifically warns about redirects bypassing input validation and recommends disabling automatic redirect following for vulnerable clients. MDN's Fetch documentation documents the manual redirect mode used in the audit.
If you do need a resolver, keep it as a controlled component: permit only known wrapper hosts, inspect each Location before another request, cap hops and time, reject non-HTTPS schemes, and never fetch the final destination merely to learn its host. Production code also needs DNS and IP controls, not just a string allowlist. A provider's documented destination-domain field may be a better input, but its provenance and consistency still need testing.
The audit script followed only the two known Google hosts and read response headers. It was a diagnostic, not a production-ready arbitrary URL resolver.
Add the check before domain filters and AI summaries
In a pipeline, this gate belongs before three common consumers:
- Domain filters. An
include_domainsfilter for a vendor cannot work reliably if the only stored host is the redirect wrapper. - Competitive reports. Share of voice and “top domains” should mark unresolved rows instead of awarding them to the wrapper host.
- Agent summaries. A language model can write a confident explanation of a wrong domain list. Validate the structured input first.
An acceptance test can be tiny. Give the pipeline one direct URL and one google.com/goto fixture. Assert that the direct host is attributed, the redirect row is unresolved until verified, and no domain summary calls the wrapper a competitor. Then test a malformed URL, a non-HTTPS redirect, a hop limit, and an absent Location header.
The sample here is intentionally small. It says nothing about how often a given provider returns redirect URLs overall. It also cannot establish whether the search engine, an upstream data source, or our own transformation introduced the wrapped links. It does establish that an API consumer can receive them and draw the wrong competitive conclusion from a perfectly ordinary hostname call.
Before shipping a SERP API integration, inspect the first ten url fields and compare their raw hosts with the actual destination hosts. If they differ, make attribution an explicit state in the data model. A blank domain you can investigate is more useful than a polished chart of the wrong sites.

