# Test Integration

> Verify Affitor tracking pipeline end-to-end with CLI test commands. Triggers on "test tracking", "verify integration", "test affitor".

- Skill: `affitor/test-integration` (Agent Skill)
- Install (CLI): `npx skillmds@latest add affitor/test-integration`
- Raw SKILL.md: https://api.skillmd.com/api/skills/affitor/test-integration/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- License: MIT
- Author: affitor (https://skillmd.com/u/affitor)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/affitor/test-integration

---


# Test Integration

Verify your Affitor tracking pipeline works end-to-end using the CLI.

## Test Individual Steps

```bash
# Test click tracking
npx affitor test click

# Test signup/lead tracking
npx affitor test lead

# Test sale/payment tracking
npx affitor test sale
```

Each command sends a test event to the Affitor API and confirms it was received and processed correctly.

## What Each Test Verifies

### `test click`
- Sends a simulated affiliate click event
- Confirms the tracking API accepts and stores the click
- Verifies your program ID and API key are valid

### `test lead`
- Sends a test signup/lead event with a mock customer
- Confirms attribution linking works (click → signup)
- Verifies the lead API endpoint is reachable

### `test sale`
- Sends a test sale event with a mock transaction
- Confirms revenue attribution works (customer → affiliate)
- Verifies amount and currency handling

## Check Overall Status

```bash
npx affitor status
```

Shows:
- Program configuration
- Stripe connection status (if using Stripe auto-setup)
- Recent event counts (last 24 hours)

## Troubleshooting

| Issue | Fix |
|---|---|
| "No config found" | Run `npx affitor init` first |
| "Invalid API key" | Re-run `npx affitor init` to get a new key |
| "Click test passed but lead failed" | Check that `customer_key` matches between signup and sale calls |
| "Sale test shows $0 commission" | Verify commission rate is set in your program settings |

## Debug Mode

For browser-side tracking issues, enable debug mode to see events in the browser console:

```html
<script src="https://api.affitor.com/js/affitor-tracker.js"
  data-affitor-program-id="YOUR_PROGRAM_ID"
  data-affitor-debug="true">
</script>
```

Or with the SDK:

```ts
const affitor = await loadAffitor('YOUR_PROGRAM_ID', { debug: true });
```

