> ## 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.

# Returning Customer Marketing Cost: Retention Marketing Spend

> Track marketing costs allocated to returning customer orders in Upstack. Filtered by customer_type to isolate retention marketing spend for contribution margin analysis.

<Tip>
  Marketing costs allocated to returning customer orders, filtered by customer\_type = returning\_customer.
</Tip>

## Formula

<Info>
  **Returning Customer Marketing Cost** = [**Marketing Cost**](/reference/metrics/orders/contribution-margin/marketing-cost) **WHERE** [customer\_type = returning\_customer](/data-dictionary/measures-and-dimensions#visitor-dimensions)
</Info>

### Formula Components

| Metric                                                                                                  | Definition                                                 |
| ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| [**Marketing Cost**](/reference/metrics/orders/contribution-margin/marketing-cost)                      | User-defined marketing costs from order cost entries       |
| [**customer\_type = returning\_customer**](/data-dictionary/measures-and-dimensions#visitor-dimensions) | Filters to orders from customers who have purchased before |

| Metadata        |                                         |
| --------------- | --------------------------------------- |
| **Type**        | Currency                                |
| **Data Source** | [Upstack Costs](/sources/upstack-costs) |
| **Aggregation** | Sum                                     |

***

## Example

Your store allocated **\$7,800 in marketing costs to returning customers** in Q1:

| Month    | RC Marketing Cost | RC Orders | Cost Per Order |
| -------- | ----------------- | --------- | -------------- |
| January  | \$2,400           | 892       | \$2.69         |
| February | \$2,600           | 978       | \$2.66         |
| March    | \$2,800           | 1,064     | \$2.63         |

***

## How It Works

Returning Customer Marketing Cost filters [Marketing Cost](/reference/metrics/orders/contribution-margin/marketing-cost) to include only orders where [customer\_type = returning\_customer](/data-dictionary/measures-and-dimensions#visitor-dimensions). This isolates retention marketing spend from acquisition spend, enabling accurate calculation of returning customer contribution margin.

***

## When to Use

| Scenario                         | Action                                                                    |
| -------------------------------- | ------------------------------------------------------------------------- |
| Track retention marketing spend  | Capture loyalty program costs, email marketing, or referral rewards       |
| Calculate RC contribution margin | Include all returning customer marketing costs for accurate profitability |
| Compare NC vs RC marketing       | Separate acquisition vs retention marketing investment                    |
| Budget retention spend           | Track and optimize marketing costs for repeat customers                   |

***

## Related Metrics

| Metric                                                                                                                         | Relationship                                      |
| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------- |
| [Marketing Cost](/reference/metrics/orders/contribution-margin/marketing-cost)                                                 | Unfiltered version across all customers           |
| [New Customer Marketing Cost](/reference/metrics/orders/contribution-margin/new-customer-marketing-cost)                       | Acquisition counterpart filtered by new customers |
| [Returning Customer Contribution Margin](/reference/metrics/orders/contribution-margin/returning-customer-contribution-margin) | Deducts this cost to calculate RC CM3             |
| [Total Cost](/reference/metrics/orders/contribution-margin/total-cost)                                                         | All costs combined                                |

[See all Contribution Margin metrics →](/reference/metrics/orders/contribution-margin)
