> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sequenzy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Goals & Attribution

> Track which emails drive conversions with last-touch attribution

# Goals & Attribution

Goals let you track which emails in your sequences drive specific outcomes like revenue, signups, or any custom conversion you care about. Using last-touch attribution, Sequenzy credits conversions to the most recent email interaction before the event occurred.

## Why Track Goals?

When running email automations, you need to know:

* Which email in a sequence convinced the subscriber to convert?
* How much revenue is each email generating?
* Are certain emails underperforming and need optimization?

Without goals, you can see email metrics like opens and clicks. With goals, you can see which emails actually drive results.

## How Attribution Works

Sequenzy uses **last-touch attribution** to connect conversions to emails:

1. A subscriber receives and interacts with your emails (opens or clicks)
2. The subscriber triggers a conversion event (e.g., `saas.purchase`)
3. Sequenzy looks back within the attribution window (default: 24 hours)
4. The most recent email interaction gets credit for the conversion

```
Email clicked → (within 24h) → Purchase event → Email gets credit
```

### Attribution Priority

When multiple interactions exist within the attribution window:

1. **Clicks beat opens**: A click is a stronger signal of intent
2. **Most recent wins**: Among the same interaction type, the newest wins

For example, if a subscriber:

* Opened Email A (8 hours ago)
* Clicked Email B (2 hours ago)
* Made a purchase (now)

→ Email B gets credit because it was clicked (stronger signal) and most recent.

## Setting Up Goals

### Company-Wide Goals

Track overall revenue or conversions across all your emails:

1. Go to **Goals** in your dashboard
2. Click **Create Goal**
3. Choose **Company-wide** scope
4. Set the trigger event (e.g., `saas.purchase`)
5. Optionally specify a revenue property (e.g., `amount`)

<Note>
  Company-wide goals track conversions from all emails—campaigns, transactional, and sequences.
</Note>

### Default Revenue Tracking

Revenue is tracked automatically without any goal setup. Sequenzy maintains a built-in revenue goal that attributes purchase events to the most recent email interaction (24-hour window):

* `saas.purchase` events with an `amount` property (Stripe and other payment integrations)
* `ecommerce.order_placed` events with the order total (Shopify, WooCommerce, and Commerce API orders)

For e-commerce orders, every placed order is attributed - including repeat purchases. Attributed conversions and revenue appear in campaign and sequence stats in the dashboard, the [campaign metrics API](/api-reference/analytics/campaign-metrics), the CLI (`sequenzy stats --campaign`), and the `get_campaign_stats` / `get_sequence_stats` MCP tools.

### Automation-Specific Goals

Track conversions from a specific sequence:

1. Go to **Goals** in your dashboard
2. Click **Create Goal**
3. Choose **Automation-specific** scope
4. Select the automation to track
5. Set the trigger event and attribution window

This is useful when you want to measure the effectiveness of a specific onboarding sequence or win-back campaign.

## Goal Configuration

| Setting                  | Description                                       | Default      |
| ------------------------ | ------------------------------------------------- | ------------ |
| **Trigger Event**        | The event that counts as a conversion             | Required     |
| **Event Property Name**  | Event property to track (e.g., "amount", "score") | Optional     |
| **Event Property Label** | Display label (e.g., "Revenue", "Points")         | Optional     |
| **Attribution Window**   | How far back to look for email interactions       | 24 hours     |
| **Scope**                | Company-wide or automation-specific               | Company-wide |

### Tracking Values

When you specify an event property, Sequenzy extracts the value from your event data:

```typescript theme={null}
// Revenue tracking
await triggerEvent(companyId, { email: "user@example.com" }, "saas.purchase", {
  amount: 99, // Event property name: "amount", Label: "Revenue"
  plan: "pro"
});

// Score tracking
await triggerEvent(companyId, { email: "user@example.com" }, "quiz.completed", {
  score: 85, // Event property name: "score", Label: "Score"
  level: "advanced"
});
```

Values are stored internally multiplied by 100 for precision (e.g., \$99 is stored as 9900).

<Warning>
  If no event property is specified, conversions are counted but the tracked value will show as 0.
</Warning>

## Viewing Goal Metrics

### Goal Dashboard

The Goals page shows all your goals with key metrics:

* **Total Conversions**: Number of times the goal was triggered
* **Total Revenue**: Sum of all revenue from conversions
* **Attributed Conversions**: Conversions credited to an email
* **Attribution Rate**: % of conversions attributed to emails

### Per-Email Breakdown

Click into a goal to see which emails are driving conversions:

| Metric               | Description                                    |
| -------------------- | ---------------------------------------------- |
| **Conversions**      | Number of conversions attributed to this email |
| **Revenue**          | Total revenue from attributed conversions      |
| **Attribution Type** | Whether conversion came from opens or clicks   |

This helps you identify your highest-performing emails and optimize underperformers.

## Attribution Windows

The attribution window determines how far back Sequenzy looks for email interactions:

| Window         | Best For                                |
| -------------- | --------------------------------------- |
| **24 hours**   | Short sales cycles, impulse purchases   |
| **7 days**     | Considered purchases, B2B SaaS          |
| **14-30 days** | High-ticket items, long decision cycles |

Choose based on your typical customer journey. If most conversions happen within a day of an email, use 24 hours. For longer sales cycles, extend the window.

## Common Goal Types

### Revenue Goals

Track purchases and subscription conversions:

```
Event: saas.purchase
Event Property: amount
Property Label: Revenue
Window: 24 hours
```

### Signup Goals

Track trial starts or account activations:

```
Event: saas.trial_started
Revenue Property: (none)
Window: 7 days
```

### Custom Goals

Track any conversion meaningful to your business:

```
Event: onboarding.completed
Event: feature.adopted
Event: referral.sent
```

## Best Practices

### 1. Start with Revenue

If you're tracking payments, start with a revenue goal. It directly ties email performance to business outcomes.

### 2. Use Consistent Event Names

Standardize your event naming across your application. This makes it easier to create and maintain goals.

### 3. Set Realistic Windows

Don't make attribution windows too long—you'll attribute conversions that weren't influenced by email. Start with 24 hours and extend only if your data shows longer consideration periods.

### 4. Track Both Types

Create both company-wide goals (overall revenue) and automation-specific goals (sequence performance) for complete visibility.

### 5. Monitor Attribution Rate

A low attribution rate (many unattributed conversions) might mean:

* Your attribution window is too short
* Conversions happen through other channels
* Subscribers aren't engaging with emails before converting

## Events That Trigger Goals

Goals are triggered when you call the Events API or when integrated payment providers (Stripe, Polar, Paddle, Dodo) send webhook events:

| Source         | Events                                           |
| -------------- | ------------------------------------------------ |
| **Stripe**     | `saas.purchase`, `saas.cancelled`, `saas.churn`  |
| **Polar**      | `saas.purchase`, `saas.cancelled`, `saas.refund` |
| **Custom API** | Any event you trigger via the Events API         |

<Card title="Events" icon="bolt" href="/concepts/events">
  Learn how to trigger custom events
</Card>

## Limitations

* **Last-touch only**: Multi-touch attribution is not currently supported
* **Email interactions only**: Goals only attribute to email opens/clicks, not other touchpoints
* **Minimum window**: 1 hour (shorter windows may miss conversions)
* **Maximum window**: 30 days (longer windows reduce attribution accuracy)

## Related

<CardGroup cols={2}>
  <Card title="Events" icon="bolt" href="/concepts/events">
    Trigger conversion events from your app
  </Card>

  <Card title="Metrics" icon="chart-line" href="/concepts/metrics">
    View your email analytics
  </Card>

  <Card title="Sequences" icon="diagram-project" href="/concepts/sequences">
    Create automated email workflows
  </Card>

  <Card title="Stripe Integration" icon="stripe" href="/integrations/stripe">
    Automatically track payment events
  </Card>
</CardGroup>
