> 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/troubleshooting.md).

# Troubleshooting

What goes wrong with Profit on Ad Spend, and how to tell which one you have.

## Double counting

If you use webhook matching, the webhook route already puts `gross_profit` and `profit_value` on its own purchase event. Send the same parameter names from your browser purchase as well, both land in the same GA4 property, and your profit doubles.

Nothing warns you about this. The number is simply twice what it should be.

Decide per container which route delivers the profit — or give the browser variant different parameter names and keep them apart in your reporting.

## An amount that looks right but is not

A cost price is only found when the product id on the order matches an id we have a cost for. When no cost is found, the fallback margin fills the gap, and the result is an estimate wearing the same parameter name as a measurement.

Set *Return* to **all** in preview and read `coverage`:

```
coverage: {items: 3, matched: 3, fallback: 0, unpriced: 0}
```

`matched` is the number you want. If it is 0 while an amount still comes out, your ids do not line up — check the product id field of your feed, or whether the cost field is filled in Shopify or Magento.

## Shopify: zero cost prices, and nothing says why

Three different causes look identical from the outside, so check them in this order.

**The permission is missing.** Reading cost prices needs **read\_inventory**, which the app only started asking for once the feature existed. A store that installed AdPage before that does not grant it, and Shopify answers with an access error rather than with zero costs. Open the AdPage app once from your Shopify admin and approve the permissions it asks for.

**Cost per item is empty.** The permission is fine and Shopify simply has nothing to give. Open any product in Shopify, look at the variant's **Inventory** section, and check whether **Cost per item** is filled. This is the most common cause by far, and it is yours to fix in Shopify rather than in AdPage.

**The count is far below your catalogue size.** Some variants are priced and most are not. The line under the Profit on Ad Spend setting ("20565 products with a cost price from the Shopify catalogue") is the measurement; compare it with the number of variants you expect.

If all three look right and you still get nothing, contact <support@adpage.io> with the container and the myshopify domain — there is an admin check that walks these steps and reports which one failed.

## Shipping cost is the same on every order

You set up a table per shipping method, but every order is charged the fallback rate. That means no order is arriving with a shipping method on it, so nothing ever matches a row in your table.

The usual cause is a shop whose orders carry no shipping line at all — digital goods, local pickup, or a checkout that does not create one. Ask <support@adpage.io> to run the admin check on your container: it reports how many orders were read and which shipping and payment methods they actually carried. Zero methods against a positive order count settles it.

When your shop genuinely has no shipping methods to distinguish, a flat amount per order is the honest setting. A table that never matches is a fallback rate wearing a table's clothes.

## A method is in the table but is never charged

The lookup is an exact string match. `Mollie - iDEAL` typed by hand does not match the real `mollie - ideal`, so those orders quietly get the fallback rate instead.

Do not type method names. Click them from the **Found in Shopify** list in the Cost Items editor, which reads the methods your shop actually used.

## purchase\_price is 0.00 on every purchase

The existing setup needs an XML feed. Without one, the parameter is present and empty on every order, and nothing in the interface points it out.

Either connect a feed, or move to the AdPage Profit on Ad Spend variable, which also works from the Shopify or Magento catalogue.

## profit\_value equals gross\_profit

Cost Items is switched off, so shipping, payment and other cost are all 0 and there is nothing to subtract. Switch it on in your container settings.

## Nothing comes back at all on an order

The lookup answers `no_revenue` when the event carries no order value. Without revenue there is no margin to compute: only the cost side would be left, and that would come back as a negative number. A negative conversion value is worse in Google Ads than no value at all, so nothing is returned and your tag's own fallback stands.

Check that `value` is actually on the event. A genuine loss — revenue below cost — is not caught by this and does come through as a negative profit.

## A zero you cannot interpret

The fallback value of the variable is `0` by default, which you cannot tell apart from a genuine zero margin. Set *Value when nothing is found* to empty: the variable then returns nothing and the parameter is dropped instead of sent as a zero.

This matters most in Google Ads, where a zero conversion value is worse than no value at all.

A fallback the variable cannot read as a number — `0,5` with a comma, a stray letter — is treated the same as an empty one, so a typo there drops the parameter rather than sending something meaningless.

## 401 on the lookup

Two possible causes, and the answer deliberately does not say which: a wrong token, or Profit on Ad Spend switched off for this container. Check both.

Just created or replaced the token? Give it five minutes. The configuration is cached, so a new token needs a moment and an old one stays valid that bit longer.

## The margin is off by roughly the VAT rate

Purchase prices in a feed are sometimes listed including VAT. If you answered that question wrong when connecting the feed, every cost is off by the VAT rate and so is every margin.

Correct it in the feed settings and re-sync.

Costs from Shopify and Magento are read excluding VAT and have no such setting, so this one cannot happen to them.


---

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