# Signup Tracking

> Track user signups for affiliate attribution via browser helper or server-side lead API. Triggers on "track signups", "lead tracking", "affiliate signup".

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

---


# Signup Tracking

After a user registers, notify Affitor so the signup is linked to the referring affiliate partner.

## Browser-Side (requires tracker script)

```javascript
// Call after signup succeeds
await window.affitor.signup(user.id, user.email);
```

With the npm SDK:

```ts
import { loadAffitor } from '@affitor/tracker';
const affitor = await loadAffitor('YOUR_PROGRAM_ID');
await affitor?.signup(user.id, user.email);
```

## Server-Side (Lead API)

```bash
POST https://api.affitor.com/api/v1/track/lead
Authorization: Bearer YOUR_PROGRAM_API_KEY
Content-Type: application/json

{
  "customer_key": "user_123",
  "email": "user@example.com",
  "click_id": "from_affitor_click_id_cookie"
}
```

### Node.js

```ts
await fetch('https://api.affitor.com/api/v1/track/lead', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.AFFITOR_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    customer_key: newUser.id,
    email: newUser.email,
    click_id: req.cookies.affitor_click_id,
  }),
});
```

### Python

```python
requests.post(
    'https://api.affitor.com/api/v1/track/lead',
    headers={
        'Authorization': f'Bearer {AFFITOR_API_KEY}',
        'Content-Type': 'application/json',
    },
    json={
        'customer_key': str(new_user.id),
        'email': new_user.email,
        'click_id': request.cookies.get('affitor_click_id'),
    },
)
```

## Rules

- Provide at least one of `click_id` or `customer_key`
- The `customer_key` must be your internal user ID, reused later in sale tracking
- Browser-side `signup()` is simplest when the tracker is already on the page

## Test

```bash
npx affitor test lead
```

