Your whole GTM stack, set up by your agent: analytics, tags with server-side conversion tracking,
email inboxes, session replay, page speed and AI search. No signup form, no verification email,
no dashboard to click through. Free to use, and open source.
agentfirststack.com · Live demo · Features · Guides and comparisons · Manual · Self-host · Architecture
--- Every new website needs the same infrastructure: analytics, a tag manager with conversion tracking, and an email address to sign up for everything else. The usual tools all start with a signup form, a verification email and a dashboard. Coding agents can't get past those steps alone. AgentFirstStack is that infrastructure, rebuilt so an agent can do the whole job: - **One request gets an account.** `POST /v1/signup` returns a key that works on every service. - **Everything is an API call and an MCP tool.** Nothing is hidden behind a settings page. - **The manual is a text file.** Each service serves `/llms.txt` with every endpoint, tool and field. - **Every step can be verified.** The agent checks its own work instead of guessing. - **Served from your own domain.** Analytics, tags and replay load from a first-party domain (one CNAME, no server code) or a path proxy, so ad blockers don't drop your visitors. - **Humans optional.** When it's done, the agent hands its person a claim link. They sign in with Google to see the project's analytics, tags, replay and mail in a dashboard, manage keys and teammates, connect Claude or ChatGPT over OAuth, and delete the project. We email them about their projects, and alert them when a site stops sending data, gets suspicious traffic (one network over its share or a sudden flood is set aside, out of reports and budgets, for review), or a project gets close to a fair-use limit ([docs/accounts.md](docs/accounts.md)). ## Services | | What it does | Instead of | |---|---|---| | **[Analytics](analytics/README.md)** | Cookieless web analytics. Country, region and city from Cloudflare's edge; channels including AI assistants; UTM and ad click ids; goals, funnels, paths, attribution, realtime (a live stream within a second); revenue, subscriptions and MRR from Stripe, Polar, Paddle or LemonSqueezy; ad spend and ROAS; ecommerce items; AI crawler visits and an AI search report (which AI bots read which pages, which assistants send visitors, what to change); Core Web Vitals from real visitors; alerts and weekly reports; history imported from GA4, Plausible or any other tool, with a check that the numbers match; server-side events; read-only SQL | Google Analytics, Plausible | | **[Tags](tags/README.md)** | A tag manager and server-side conversion router. Define a conversion once; the browser pixel and the server both send it to GA4, Google Ads, Meta, TikTok, LinkedIn, Pinterest, Reddit, Snap or X with one event id, so each platform counts it once. A consent banner asks visitors from the EU, UK and Switzerland before ad pixels fire. Scan (it also finds the tools a site uses now), import a GTM container, validate, preview, test and publish | Google Tag Manager, server-side GTM | | **[Mail](mail/README.md)** | Inboxes in one request, on agentfirstinbox.com or your own domain. `wait_for_email` returns the moment a message arrives, with verification codes and links already extracted. Read, reply, send, custom domains, webhooks, and forwarding to the project's people (each email or a daily digest) | A Gmail account per project, AgentMail | | **[Replay](replay/README.md)** | Session recordings masked in the browser by default. Sessions come back as readable transcripts; rage, dead and error clicks, heatmaps and JS errors as data; a share link opens a player for people | Hotjar, Microsoft Clarity | ## Quick start ### Hosted (free) Copy the prompt from [agentfirststack.com](https://agentfirststack.com) into Claude Code, Cursor, Codex or any agent that can make HTTP requests. The agent follows the [full setup](https://agentfirststack.com/llms.txt) in one run: it maps your site's pages, main actions and the tools it uses now, then asks you once where the inbox's email should go and whether to bring your old tools' setup and history over. It creates an inbox, sets up analytics (goals, AI crawler visits reported from your server, a weekly report for you, and the history of GA4, Plausible or whatever you used before), a tag container with an event for each main action (starting from your GTM container, if you have one), and replay; then it deploys, verifies each part as a visitor with test traffic (`POST /v1/setup/test`: a test email, test events through analytics, tags and each ad platform's test mode, then a browser test visit), runs the setup check (`GET /v1/setup`) until nothing is missing, writes what it did to `AGENTFIRSTSTACK.md` (and a short block to `AGENTS.md`, so later sessions with any agent pick up new features), and shows you a table of what's set up and what passed, with a claim link. Your old tools stay until the setup check says the numbers match and you agree to remove them. Pasting the same prompt again later starts from the setup check and fills the gaps. Or install it as an agent skill ([skills.sh](https://www.skills.sh)), so your agent has the setup steps on hand in every session: ```sh npx skills add StartGlobal-AI/agentfirststack ``` Then ask it to set up AgentFirstStack. The skill is [`skills/agentfirststack-setup/SKILL.md`](skills/agentfirststack-setup/SKILL.md). Or do it by hand: ```sh curl -X POST https://agentfirststack.com/v1/signup # { "api_key": "afs_...", "mcp": { ... }, "next_steps": [ ... ] } curl -X POST https://analytics.agentfirststack.com/v1/sites \ -H "Authorization: Bearer $AGENTFIRSTSTACK_API_KEY" -H 'content-type: application/json' \ -d '{"domain":"example.com"}' ``` Add one MCP server for every service (tools prefixed `analytics_`, `tags_`, `mail_`, `replay_`): ```sh claude mcp add --transport http afs https://agentfirststack.com/mcp --header "Authorization: Bearer $AGENTFIRSTSTACK_API_KEY" ``` Or one per service: ```sh claude mcp add --transport http afs-analytics https://analytics.agentfirststack.com/mcp --header "Authorization: Bearer $AGENTFIRSTSTACK_API_KEY" claude mcp add --transport http afs-tags https://tags.agentfirststack.com/mcp --header "Authorization: Bearer $AGENTFIRSTSTACK_API_KEY" claude mcp add --transport http afs-mail https://mail.agentfirststack.com/mcp --header "Authorization: Bearer $AGENTFIRSTSTACK_API_KEY" claude mcp add --transport http afs-replay https://replay.agentfirststack.com/mcp --header "Authorization: Bearer $AGENTFIRSTSTACK_API_KEY" ``` The hosted version has fair-use limits, listed in the [manual](https://agentfirststack.com/llms.txt). ### Self-hosted Everything runs on Cloudflare Workers in your own account: ```sh git clone https://github.com/StartGlobal-AI/agentfirststack && cd agentfirststack pnpm install pnpm afs init mystack --domain example.com --account