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

# Configure contribution margin

> Set up COGS, transaction fees, and marketing spend in Upstack to track CM1–CM4 contribution margins and real profitability.

Upstack calculates four tiers of contribution margin so you can optimize on profit, not vanity metrics like revenue or ROAS. Each tier subtracts an additional layer of costs:

| Level   | What's subtracted                                   | What it tells you                        |
| ------- | --------------------------------------------------- | ---------------------------------------- |
| **CM1** | COGS (cost of goods sold)                           | Gross margin                             |
| **CM2** | + Fulfillment, transaction & gateway fees, shipping | Post-logistics margin                    |
| **CM3** | + Marketing and ad spend                            | Contribution margin (most commonly used) |
| **CM4** | + Operating expenses, agency fees, and other        | Operating profit                         |

## Setup

<Steps>
  <Step title="Enter COGS in Shopify">
    Go to **Shopify Admin → Products** and select a product. For each variant, enter the **Cost per item** field. If you sell a product for $30 and it costs $5 to produce, enter \$5. Upstack pulls this in automatically — no manual sync required.

    <Info>
      After configuring COGS, allow approximately **4 hours** for historical data to backfill. CM1 values for past orders populate automatically once the backfill completes.
    </Info>
  </Step>

  <Step title="Configure your other costs in Upstack">
    Open **Settings → Cost Overview** to add shipping, gateway fees, order costs, a fallback product margin, and fixed and variable costs. Each cost is assigned a category that maps to a contribution-margin tier:

    | Cost category                               | CM tier |
    | ------------------------------------------- | ------- |
    | COGS (product cost)                         | CM1     |
    | Fulfillment, transaction, gateway, shipping | CM2     |
    | Marketing and ad spend                      | CM3     |
    | Operating expenses, agency fees, other      | CM4     |

    Fixed and variable costs land in the tier matching their category. See [Cost settings](/get-started/cost-settings) for a full walkthrough of every category.
  </Step>

  <Step title="Connect marketing spend">
    Spend from **connected ad platforms** (Meta, Google, TikTok) flows in automatically. For **non-connected channels** (influencer, podcast, and similar), add it under **Settings → Cost Overview** as a fixed or variable cost so it counts toward CM3.
  </Step>
</Steps>

## P\&L dashboard

Two views are available:

* **Summary** — aggregate P\&L across a date range
* **Daily breakdown** — granular day-by-day performance

Key metrics include Net Revenue, COGS, CM1, CM2, CM3, CM4, MER, and NCCM3. Over 250 measures are available and fully customizable.

<Tip>
  **NCCM3** is contribution margin (CM3) for **new customers only** — net revenue minus product, fulfillment, transaction, shipping, marketing, and ad-spend costs. It's the single most useful metric for evaluating whether your prospecting spend is profitable after all variable costs.
</Tip>

<Accordion title="LTV cohort dashboard">
  The LTV Cohort Dashboard shows customer lifetime value by acquisition cohort. Use it to measure how quickly cohorts pay back acquisition cost and identify your highest-value customer segments.

  This replaces standalone LTV tools like Lifetimely — the data is built directly from your Upstack event pipeline, so cohort metrics stay consistent with your P\&L and attribution data.
</Accordion>

## Next step

<CardGroup cols={1}>
  <Card title="Verify end-to-end delivery" icon="arrow-right" href="/get-started/verify-end-to-end">
    Confirm the complete pipeline works — from storefront event through attribution to destination delivery.
  </Card>
</CardGroup>

## Related

<CardGroup cols={2}>
  <Card title="Cost settings" icon="coins" href="/get-started/cost-settings">
    Set up product, order, shipping, gateway, fixed, and variable costs in detail.
  </Card>

  <Card title="Attribution and reporting" icon="chart-line" href="/concepts/attribution-and-reporting">
    Learn how Upstack attributes conversions and calculates reporting metrics across channels.
  </Card>

  <Card title="Attribution reporting dashboard" icon="table-columns" href="/analytics/attribution-reporting">
    Explore the attribution reporting dashboard and available metrics.
  </Card>

  <Card title="Custom events" icon="bolt" href="/guides/custom-events/how-to-create-custom-event-triggers">
    Configure NC Purchase, subscription events, and order source exclusions for ad platform optimization.
  </Card>

  <Card title="Connect a destination" icon="plug" href="/get-started/connect-a-destination">
    Set up Meta CAPI as your first server-side destination for high-quality conversion events.
  </Card>
</CardGroup>
