# How Did My Client's Site Do Last Month? A Reporting App Drafts Each Agency's Client Reports From Vercel Web Analytics

A client-reporting app makes one agent per web agency, signed into its Vercel team, that drafts each client site's monthly traffic report from Web Analytics.

[Run this on Rush](https://cloud.getrush.ai/run/draft-each-clients-monthly-traffic-report/vercel/). Opens the console with this prompt ready to send. Connect Vercel there first.

## What the agent does

This is for a company that sells client-reporting software to web design agencies: the monthly PDF or page each agency sends its clients, with their site's visits, top pages and where people came from. Many of those agencies host client sites on Vercel with Web Analytics turned on, and today someone at each agency opens every project's analytics on the first of the month and copies numbers into a template. The reporting company saves one agent as a template that names the Vercel MCP server, with instructions to read and never change anything, and makes one agent from it per agency.

The reporting company connects Vercel to its own account first with `POST /me/connections {"type": "mcp", "name": "vercel", "url": "https://mcp.vercel.com", "auth": {"mode": "oauth"}}`, names it in the template's `connections`, and calls `POST /o/{org}/agents {"template": "<template id>", "name": "reports-<agency id>"}` when an agency signs up. The agency's owner connects Vercel from the app's settings: the backend calls `POST /o/{org}/agents/{agent}/connections {"type": "mcp", "name": "vercel"}` and opens the `authorize_url` in a popup. Vercel's docs say the person signs in with the Vercel account they want to use and grants the connection access to the teams it should work with; a team left out is a team the agent cannot read. The agency then maps each client to a Vercel project in the app.

On a run for one client the agent calls `get_web_analytics` on that project for last month and the month before, in `count` mode for the total page views, then in `aggregate` mode with `by` set to `requestPath`, then `referrerHostname`, then `deviceType`, and `country`, each with `limit` 10. Vercel's docs say these queries cover the production environment by default. When the agency tracks custom events, such as a contact form submission sent with `track()`, it reads `dataset` `events` with a `filter` on that `eventName`. It also calls `list_deployments` for the project and counts last month's production deployments, so the report can say how often the site changed.

It writes the draft in plain language for a business owner: visits this month and last, the pages people read most, the sites that sent them, the share on phones, form submissions when tracked, and one or two sentences on what changed, each tied to a number it read. It invents no target and gives no marketing advice beyond what the numbers show. The agent changes nothing on Vercel: the template's instructions forbid every tool that deploys, edits a project, sets a variable or changes a domain.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "<agent id>",
  "input": "Draft the October 2026 traffic report for the client Harbor Dental Studio, Vercel team harbor-web-agency, project harbor-dental-site. Call get_web_analytics on the project for 2026-10-01 to 2026-10-31 and for 2026-09-01 to 2026-09-30: mode count for total page views, then mode aggregate with by requestPath, by referrerHostname, by deviceType and by country, limit 10 each. Then dataset events, mode count, with filter eventName eq 'contact_submit' for both months. Call list_deployments for the project and count production deployments created in October. Return only JSON: {month, pageviews {this_month, last_month}, top_pages [{path, views}], top_referrers [{host, views}], device_share [{device, views}], top_countries [{country, views}], contact_submits {this_month, last_month}, production_deploys, summary (three sentences for a business owner, every claim tied to a number above)}. If Web Analytics is not enabled on the project, return {error: 'web_analytics_off'}. Do not deploy, redeploy, or change any project, domain, variable or setting."
}
```

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 answer is JSON in the session's `result` and in the `run.completed` webhook. The reporting app lays it into the agency's branded template as a draft, and the agency's account manager reads it, adds a line of their own about the work they did that month, and sends it. Nothing reaches the client until the agency sends it.

What the account manager checks: that the project is the client's live site and not a staging copy, that a jump or drop has an explanation they can give (a campaign, a site outage, a new page), and the summary's wording. Vercel's docs say query results group past the `limit` into Others, so a long tail of pages or referrers shows as one row, which is what a client report wants.

## Run it on every first day of the month

On the first of each month the app's scheduler sends one `POST /o/{org}/sessions` per client of each agency, with that agency's agent id as `agent`, the client's project in `input`, and a `request_id` that is a UUID v5 of the client id and the month, so a retried job starts no second run. An agency with forty clients gets forty runs at once; runs past the key's concurrent limit wait `queued`.

An account manager preparing for a client call midmonth can press Refresh report, which starts the same request with the month so far.

## Why run it on Rush?

Each agency signs in to Vercel on Vercel's page, and that sign-in belongs to its own agent: one agency's runs cannot reach another agency's teams, and the reporting company registers no OAuth app and stores no Vercel token. The agency chooses at consent which teams the agent can read, and Vercel's own permissions still apply, as its docs say.

One template serves every agency, so adding a section, such as the share of visits from a campaign by `utmSource`, is one `PATCH` to the template. Every run has its own computer and a record of each Vercel call and what its model calls cost; `GET /o/{org}/sessions?agent=<agent id>` lists an agency's runs with their `total_cost_usd`, which is what the reporting company needs to price reports per client.

## Frequently asked questions

### Does the project need anything turned on in Vercel?

Yes. Vercel's docs say to enable Web Analytics for a project before querying its data, and custom events exist only when the site sends them. The prompt returns `web_analytics_off` for a project without it, so the app can tell the agency what to turn on.

### What if the agency's connection shows different tools?

Vercel's docs say some connections expose a smaller tool list and that a tool's parameters can differ between connections, and to follow the schema the connection returns. The same docs list `aggregate_pageviews`, `count_pageviews` and `aggregate_events` beside `get_web_analytics`, so the template's instructions name both ways to read the same numbers.

### Could the agent deploy or change a client's site?

Vercel's server can deploy and manage projects, and its docs advise human confirmation for changes. The template's instructions and each prompt forbid every write, and the transcript records every call, so an agency can see the agent only read.

### Does the agency's client need a Rush or Vercel account?

No. The agency signs in to Vercel once from the reporting app, and the client only receives the report. The agents, their runs and their cost belong to the person who created the reporting company's API key.

## More Vercel jobs

- [Find Slow Vercel Builds](https://getrush.ai/run/build-time-report/vercel/)
- [Report Failed Vercel Deployments Across Projects](https://getrush.ai/run/deployment-health-report/vercel/)

## More jobs like this: Run an agent per customer task

- [What Were Our Numbers Last Month? An Investor-Update App's Read-Only Metrics From Each Startup's Neon Database](https://getrush.ai/run/draft-monthly-metrics-for-investor-update/neon/)
- [Draft Replies to Customer Order Questions in an Online Store's Gmail](https://getrush.ai/run/draft-replies-to-order-questions/gmail/)
- [How Does Real Estate Marketing Software Draft Posts in Each Realtor's Buffer When a Listing Goes Live?](https://getrush.ai/run/draft-social-posts-for-each-new-listing/buffer/)
- [What Happened on My Renovation This Week? A Contractor App Drafts Each Homeowner's Update From the Contractor's monday.com Board](https://getrush.ai/run/draft-weekly-homeowner-job-updates/monday/)

## Keep reading

- [Connect Vercel to Rush once, then name it on any run](https://getrush.ai/integrations/vercel/)
- [Start your first run from the developer API quickstart](https://getrush.ai/docs/quickstart/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
