> ## 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 fees, shipping | Post-logistics margin                    |
| **CM3** | + Marketing spend                         | Contribution margin (most commonly used) |
| **CM4** | + Fixed costs / OpEx                      | 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 data automatically — no manual sync required.

    <Info>
      If you don't maintain per-product costs, set a **flat margin default** in Upstack (e.g., "60% margin across all products") under **Settings → Custom Costs → Default Margin**. This applies to any product without an explicit cost-per-item in Shopify.
    </Info>

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

  <Step title="Configure custom costs in Upstack">
    Navigate to **Settings → Custom Costs** and configure each cost type:

    **Gateway / transaction costs** — set as a percentage of order value. Example: Shopify Payments at 2.9% per transaction.

    **Per-order costs** — set as a flat dollar amount per order. Example: pick-and-pack fee of \$2 per order.

    **Shipping profiles** — configure based on weight ranges and destination countries, or enter a flat average shipping cost.

    Each cost is assigned to a CM level:

    | Cost type                      | CM level |
    | ------------------------------ | -------- |
    | COGS                           | CM1      |
    | Fulfillment / transaction fees | CM2      |
    | Marketing spend                | CM3      |
    | Fixed costs / OpEx             | CM4      |
  </Step>

  <Step title="Connect marketing spend">
    **Connected ad platforms** (Meta, Google, TikTok) — spend data flows automatically from your connected sources. No manual entry needed.

    **Non-connected channels** (AppLovin, influencer spend, podcast ads):

    1. Go to **Settings → Fixed Costs → Marketing Spend**
    2. Enter as a recurring monthly amount with start and end dates, or enter manually each month
    3. Daily cost is averaged across the month
  </Step>

  <Step title="Enter fixed costs (optional, for CM4)">
    For operating expenses like rent, salaries, and SaaS subscriptions:

    1. Go to **Settings → Fixed Costs → Operating Expenses**
    2. Enter as monthly recurring amounts

    This enables CM4 calculations — full operating profit visibility.
  </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 net revenue minus COGS, marketing spend, and transaction/shipping costs — calculated for **new customers only**. This is 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="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="/get-started/custom-events">
    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>
