> For the complete documentation index, see [llms.txt](https://docs.adpage.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.adpage.io/optimize-your-setup/profit-on-ad-spend/the-variables.md).

# The variables

What each Profit on Ad Spend parameter means, which VAT basis it uses, and which setup fills it.

Profit on Ad Spend produces two sets of parameters. Which one you get depends on how you set up your server container — see Set up the server container.

## The recommended set

These come from the **AdPage Profit on Ad Spend** variable. All of them are order-level, in the event currency, and calculated **excluding VAT**.

| Parameter       | What it is                                                                       |
| --------------- | -------------------------------------------------------------------------------- |
| `cost_of_goods` | What the products on this order cost you                                         |
| `shipping_cost` | Shipping cost for this order, from your Cost Items settings                      |
| `payment_cost`  | Payment cost for this order, from your Cost Items settings                       |
| `other_cost`    | Your other per-order cost lines — packaging, returns handling, a marketplace fee |
| `gross_profit`  | Revenue excluding VAT, minus `cost_of_goods`                                     |
| `profit_value`  | `gross_profit`, minus shipping, payment and other cost                           |

Alongside them you get two fields that tell you how much to trust the numbers:

| Field      | What it tells you                                                                                                                             |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `coverage` | How many order lines had a real cost price (`matched`), how many fell back to your margin (`fallback`), and how many had neither (`unpriced`) |
| `source`   | Whether the figures come from the matched order webhook (`stash`) or were calculated from the event itself (`computed`)                       |

{% hint style="info" %}
**Why revenue is taken excluding VAT.** Your purchase prices are excluding VAT, so the revenue they are subtracted from has to be as well. We use `value` minus `tax`. An order of € 21.66 including 21% VAT is calculated against € 17.91.
{% endhint %}

**`profit_value` equal to `gross_profit`?** That is not a bug. It means Cost Items is switched off, so shipping, payment and other cost are all zero and there is nothing to subtract. See [Cost Items](/optimize-your-setup/profit-on-ad-spend/cost-items.md).

## The existing set

These come from the older manual setup and still work. They need an XML feed; a container whose costs come from the Shopify or Magento catalogue never gets them.

| Parameter        | What it is                                              |
| ---------------- | ------------------------------------------------------- |
| `purchase_price` | Total purchase price of the order, summed from the feed |
| `profit_margin`  | A value you build yourself in Google Tag Manager        |

{% hint style="warning" %}
Without a feed, `purchase_price` is **0.00** on every purchase. Not an error, and nothing in the interface points it out — the parameter is simply there with nothing in it. If you see zeroes everywhere, check whether a feed is configured at all.
{% endhint %}

## Which setup fills what

|                                   | Shopify cost per item | Magento catalogue | XML feed |
| --------------------------------- | --------------------- | ----------------- | -------- |
| `cost_of_goods` … `profit_value`  | yes                   | yes               | yes      |
| `purchase_price`, `profit_margin` | no                    | no                | yes      |

Running both sets at once is fine, as long as you do not send two of them to the same metric. See Troubleshooting.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.adpage.io/optimize-your-setup/profit-on-ad-spend/the-variables.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
