> ## 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 Agency Fees: Retention Agency Costs

> Track agency fees for returning customer orders. Understand marketing agency costs for customer retention.

<Tip>
  Returning Customer Agency Fees tracks user-defined agency costs allocated to repeat buyer orders.
</Tip>

## Formula

<Info>
  **RC Agency Fees** = **SUM** ( Order Cost Entries ) **WHERE** category = Agency Fees **AND** customer\_type = returning\_customer
</Info>

### Formula Components

| Metric                                                                                                  | Definition                                             |
| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
| **Order Cost Entries**                                                                                  | User-defined costs configured in Upstack Cost Settings |
| **category = Agency Fees**                                                                              | Filters to costs categorized as agency fees            |
| [**customer\_type = returning\_customer**](/data-dictionary/measures-and-dimensions#visitor-dimensions) | Filters to repeat buyer orders                         |

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

***

## Example

Your Shopify store has **\$5,000** in agency fees for **300 returning customer orders**.

| Metric                    | Value   | Calculation                |
| ------------------------- | ------- | -------------------------- |
| Returning Customer Orders | 300     | Repeat buyers              |
| RC Agency Fees            | \$5,000 | Sum of agency cost entries |
| RC Agency Fees Per Order  | \$16.67 | \$5,000 ÷ 300              |

This represents the portion of agency costs attributable to customer retention efforts.

***

## How It Works

Agency fees are allocated to returning customer orders based on your cost configuration. This helps you understand the cost of retention marketing managed by external agencies.

***

## When to Use

| Scenario                      | Action                                             |
| ----------------------------- | -------------------------------------------------- |
| Retention cost analysis       | Include agency fees in retention costs             |
| Agency performance evaluation | Compare RC agency costs to retention results       |
| Budget allocation             | Understand agency impact on RC margins             |
| NC vs RC agency comparison    | Compare acquisition vs retention agency efficiency |

***

## Related Metrics

| Metric                                                                                               | Relationship                                  |
| ---------------------------------------------------------------------------------------------------- | --------------------------------------------- |
| [Agency Fees](/reference/metrics/orders/contribution-margin/agency-fees)                             | Total agency fees for all orders              |
| [NC Agency Fees](/reference/metrics/orders/contribution-margin/new-customer-agency-fees)             | Agency fees for new customer orders           |
| [RC Marketing Cost](/reference/metrics/orders/contribution-margin/returning-customer-marketing-cost) | Other marketing costs for returning customers |
| [RC MER](/reference/metrics/orders/performance/returning-customer-total-mer)                         | Retention marketing efficiency                |

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