All jobs

Which Campaign Links Are Sending Visitors to a 404? A Marketing Agency's Weekly Check of Client Sites on Netlify

A marketing agency's agent reads a week of Netlify request data for each client site and lists the URLs answering 404, with the referrer and campaign behind them.

Run this on RushOpens the console with this prompt ready to send. Connect Netlify there first.

What the agent does

This is for a marketing agency that builds and hosts its clients' landing pages on Netlify and drives traffic to them with ads, email campaigns and partner posts. A landing page gets renamed, an email goes out with a typo in its link, a partner copies an old URL, and paid clicks land on a 404 for a week before anyone notices. The agent finds those every Monday. Someone at the agency connects Netlify once with POST /me/connections {"type": "mcp", "name": "netlify", "url": "https://netlify-mcp.netlify.app/mcp", "auth": {"mode": "oauth"}} and signs in on Netlify's page.

Netlify's server groups its operations by area, each with a tool that reads and a tool that writes, taking the operation's name. The agent uses the project reader's get-projects with projectNameSearchValue to find each client's site id, then the observability reader, netlify-observability-services-reader, on each site for the last seven days. get-counts with status_codes gives the share of requests that were 404. get-topk with urls and a filter of StatusCode = 404, sorted by Count, lists the missing paths; the same call with urls_with_query shows the utm_source and utm_campaign that brought visitors there, and with referrers the sites and apps they came from.

It separates people from crawlers with user_agent_categories, because a scanner probing for /wp-admin on a site that has never run WordPress is noise, while a 404 on /spring-sale with an email campaign tag is lost money. For each missing path with real visitors it calls get-timeseries with edge_requests_count filtered to that path and to 404, which shows the day it started and whether it is still happening. It then looks at the site's live pages for the nearest match, such as /spring-sale-2026 for /spring-sale.

It writes broken-links.md, one section per client, most visits first: the missing path, the visits from people, the campaign and referrer, the first day seen, and a suggested line for the site's _redirects file (/spring-sale /spring-sale-2026 301) when a match is clear. It deploys nothing and changes no setting. The writing tools on Netlify's server can deploy sites and change environment variables; the prompt forbids them all, and a developer adds the redirect through the client's normal release.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Use the Netlify connection. Find the site ids with the project reader's get-projects (projectNameSearchValue) for these clients: northwind-coffee, alder-dental-group, brightline-fitness. For each site, over the last 7 days (from_ts and to_ts in milliseconds), use netlify-observability-services-reader: get-counts with status_codes; get-topk with urls, filter StatusCode = 404, sorted by Count DESC, per_page 25; the same with urls_with_query and with referrers; get-counts with user_agent_categories filtered to StatusCode = 404 to tell people from bots. Ignore paths only crawlers hit. For each missing path people visited, use get-timeseries with edge_requests_count filtered to that URL and StatusCode = 404 to find the first day and whether it continues, and look for the closest live page on the site. Write broken-links.md, one section per client, most visits first: path, visits, campaign (utm_source, utm_campaign), referrers, first seen, still happening, and a suggested _redirects line when the match is clear. Do not deploy, change settings or use any write tool.",
  "connections": [
    "netlify"
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

The session returns broken-links.md as an artifact and a per-client count in result. The account lead reads it on Monday morning, pauses or fixes any ad or email still pointing at a missing page, and hands the suggested redirects to the developer who looks after that client's site.

What the account lead checks: every suggested redirect, because the closest page by name is not always the right one (an expired offer should usually go to the current offer, not a similar URL); paths the agent judged to be crawler noise; and how far back the data goes. Netlify's tool descriptions say the window depends on the team's plan, typically 24 hours on Free and 7 days on Pro and Business, so a site on a smaller plan shows only the last day. The transcript holds each query, so the numbers can be checked against Netlify's own dashboard.

Run it on every Monday morning

In the console, a Project automation with a schedule trigger, cron 0 8 * * 1 in the agency's timezone, runs a saved agent that names the Netlify connection and holds the client list in its instructions. Adding a client is one more site name.

A campaign launch is worth its own check. The agency can start the same request from its own server the morning after a big email send, with a one-day window and only that client's site, and read the result from the key's webhook.

The use case this job follows, with its automation and trigger: Produce a report or file, no repo.

Why run it on Rush?

Netlify's request data is kept per site, and the agency has many sites. The question that matters, which campaign is pointing people at a page that is gone, joins status codes, query strings, referrers and user agents for every client, and the agent asks Netlify each of those and writes the answer in one list. Netlify's sign-in stays in Rush's connection, not in a token on someone's laptop.

Each run has its own computer and a record of every query and its cost. When a client asks how long their spring sale link was broken, the account lead can open the run that found it and show the day it started.

Frequently asked questions

Will the agent add the redirects itself?

No. It suggests _redirects lines and stops. A redirect is a change to a client's live site, so a developer adds it and deploys it the usual way.

Does it see what visitors did on the page?

It reads Netlify's edge request data: paths, status codes, query strings, referrers, user agents and timing. It does not read analytics events inside the page, so conversions are not part of the report.

Can it filter by part of a URL, like every path under /promo?

Netlify's tool accepts only an exact match for URL filters. The agent ranks the 404 paths first and then filters to each exact one, which covers the paths that matter.

What about client sites hosted somewhere else?

This request reads Netlify only, through the agency's Netlify sign-in. A client site on another host is not in the report, and the report says nothing about it rather than guessing.

More Netlify jobs

More jobs like this: Produce a report or file, no repo

Keep reading