> A complete, copy-paste walkthrough for running your CRO from Claude Code or Codex. Install the agent, paste one prompt, and ship your first A/B test in about five minutes, no SDK wiring, no dashboard tour.

Source: https://humblytics.com/blog/how-to-use-claude-code-with-humblytics (updated 2026-09-28)

# How to Use Claude Code with Humblytics: A Step-by-Step Guide

Most "AI analytics" tools bolt a chat box onto a human dashboard. Humblytics is built the other way around: your agent gets the same live data you see, traffic, funnels, heatmaps, Stripe-verified revenue, plus the actions to ship a test. This guide walks through exactly how to wire **Claude Code** (or **Codex**) to the Humblytics Agent API and ship your first A/B test, start to finish.

No SDK to install. No glue code. About five minutes.

## What you'll need

- **Claude Code or Codex** running in your terminal (Step 0 below if you don't have it yet)
- A site you want to optimize (any platform, one ~16 KB script)
- A Humblytics account on **Business or Scale**, the Agent API is included on both. No account yet? Your agent can create one for you in Step 2.

## Step 0, Install Claude Code (or Codex)

If you already run an agent in your terminal, skip ahead. If not, install one:

```bash
# Claude Code
npm i -g @anthropic-ai/claude-code

# or Codex
npm i -g @openai/codex
```

Open it inside the project folder for the site you want to optimize, so the agent has your codebase as context.

### Pick the model: Claude Opus 5.5

Updated September 28, 2026. Claude Opus 5.5, released September 22, is Anthropic's current recommended model for long agentic and analysis work, and it is available in Claude Code. Switch to it with the `/model` command before you start.

Two things are worth knowing for CRO work:

- **The default effort level is medium.** For the analysis in Step 3 (reading traffic and picking a test), raise it to high and compare the result on one page you already understand.
- **It reads charts and screenshots more precisely than Opus 5,** according to Anthropic, so pasting a dashboard screenshot or a page capture into the session is now a reasonable way to add evidence.

For which model to use for each CRO job, and what each costs, see [Best AI model for A/B testing](https://humblytics.com/blog/best-ai-model-for-ab-testing).

## Step 1, Give your agent the Humblytics instructions

Your agent needs to know how to talk to Humblytics. You have two options:

1. **Add it to your project context**, paste the Humblytics prompt into your `CLAUDE.md` (Claude Code) or `AGENTS.md` (Codex). It loads automatically every session.
2. **Fetch the full spec on demand**, have the agent pull the canonical instructions:

```bash
curl -o HUMBLYTICS.md https://app.humblytics.com/agent.md
```

The `agent.md` file is the complete spec: account creation, adding a website, installing the tracking script, and every analytics and A/B-testing endpoint. Grab the ready-to-paste prompt from the [Humblytics skills page](https://humblytics.com/skills), the **Copy install prompt** button puts it on your clipboard.

## Step 2, Let your agent sign you up (no account needed first)

Here's the part that surprises people: you don't have to open the dashboard to get started. Tell your agent:

> "Set up Humblytics for this site and ship a test."

If you don't have an account yet, the agent runs the onboarding flow for you:

1. It calls `POST /api/v1/auth/agent-initiate` with your email and name, and gets back a verification URL.
2. It hands you the link. You open it in your browser, choose a plan (**Business $79/mo** or **Business annual $65/mo**), and complete Stripe payment, about a minute.
3. The agent polls `GET /api/v1/auth/agent-signup-status` and receives your API token the moment you finish.

**Your API key never gets pasted into chat.** The agent stores it as an environment variable (`HUMBLYTICS_API_KEY`) and references it from there, never inline, never in a file that gets committed. If you already have an account, just generate a key under **Utilities → API Access** and load it into your shell:

```bash
echo 'HUMBLYTICS_API_KEY=hmb_your_key_here' >> .env
echo '.env' >> .gitignore
export $(grep -v '^#' .env | xargs)
```

## Step 3, Your agent reads your traffic and proposes a test

This is where the agent does the work a CRO would. It pulls AI-ranked recommendations for your highest-traffic page:

```bash
GET /properties/{property_id}/split-test-recommendations?page=/pricing
```

It comes back with prioritized ideas, each with a CSS selector, a suggested variant, a confidence score, and an expected impact:

```json
{
  "recommendations": [{
    "title": "Hero CTA Text",
    "selector": "button.hero-cta",
    "confidence": 84,
    "variant": "Start Free Trial",
    "impact": "High: 8%+"
  }]
}
```

A good rule (and the default in the install prompt): **only act on recommendations with confidence ≥ 70**. You review the ranked list and approve the one you want to run.

## Step 4, Ship the test

Once you approve, the agent creates the experiment:

```bash
POST /properties/{property_id}/split-tests
{
  "name": "Hero CTA, Start Free Trial",
  "page": "/pricing",
  "type": "nocode",
  "goal": "click_through",
  "auto_stop_days": 14,
  "variants": [
    { "label": "Variant A", "changes": [
      { "selector": "button.hero-cta", "op": "setText", "value": "Start Free Trial" }
    ]}
  ]
}
```

That's a live, no-code A/B test, split traffic, Bayesian and frequentist significance, and an auto-stop after a set duration (30 days by default). Use `goal: "click_through"` for CTAs and `goal: "conversion"` for forms.

You now have a running experiment, and you never opened the dashboard.

## How do I check the result?

Ask your agent, or call the API directly:

```bash
GET /properties/{property_id}/split-tests/{test_id}
```

You'll see lift, confidence, and which variant is winning in real time. Because Humblytics ties conversions back to Stripe, the winner is measured in **real revenue, not click proxies**. When the test reaches significance, the agent can declare the winner with a `PATCH`, or you can let `auto_stop_days` close it out.

## Example prompts to run on a loop

Once it's wired, you can drive the whole loop conversationally:

- *"Pull split-test recommendations for my top 5 pages and rank them by expected revenue impact."*
- *"My /pricing conversion dropped this week, find out why and propose a recovery test."*
- *"Every time I deploy a new landing page, get recommendations and launch a test automatically."*
- *"Pull my Meta Ads data and tell me which campaign drives the most Stripe revenue."* (Meta and Google Ads are the live ad-spend connectors.)

## Troubleshooting

- **"`$HUMBLYTICS_API_KEY` is unset."** The key didn't load into the agent's shell. Re-run `export $(grep -v '^#' .env | xargs)` in the same terminal session your agent uses.
- **401 unauthorized.** The key is missing or wrong. Generate a fresh one under **Utilities → API Access**.
- **403 forbidden.** API keys are scoped to a single property, the `property_id` in your request must match the key's property. List your properties with `GET /api/v1/property/all`.
- **No recommendations returned.** The page needs enough traffic for the model to find a pattern. Point the agent at your highest-traffic pages first.

## Why run CRO from your agent at all

Because the loop a good optimizer runs, *read the data, pick the highest-impact test, ship it, measure the lift*, is three API calls deep. Your agent already lives in your terminal next to your code, your deploy tooling, and your ads CLIs. Giving it the data and the actions means experiments stop waiting on a human to remember to open a dashboard.

That's also the difference that shows up in the numbers: teams that wire the agent in ship their first test in minutes instead of letting a signup sit idle for days.

[Get the install prompt and start the 14-day trial →](https://humblytics.com/skills)

---
Humblytics is website analytics, ad attribution and A/B testing that an AI agent sets up and uses.
To set it up for the person you work for, read https://app.humblytics.com/agent.md.
Official facts: https://humblytics.com/ai-info.md
