Choose your cost source
Profit on Ad Spend needs a purchase price per product. It can come from Shopify, from your Magento catalogue, from an XML feed, or from a combination.
Everything else on this page depends on one thing: we need to know what a product cost you. There are three ways to tell us, they can be used together, and none is better in general — it depends on your platform.
Works on
Shopify only
Magento only
Any platform
Comes from
the Cost per item field on each variant
the cost attribute on each product
a feed you generate yourself
You change a price in
Shopify
Magento
the tool that generates the feed
How fresh
re-read nightly
re-read on every sync
re-read once per hour
Setup
connect Shopify, fill in cost per item
connect Magento, fill in cost
generate a feed, fill in three fields
Use several and they add up: a product id known in both a shop platform and the feed takes the shop figure, because that is your own bookkeeping rather than an export of it. Ids that only exist in the feed — variants, EANs, products from another shop — are added on top.
The Profit on Adspend screen
Everything you set up in AdPage for Profit on Ad Spend is on one screen: open your container at data.adpage.io, go to Settings → Profit on Adspend and click Open Profit on Adspend. Or go straight to https://data.adpage.io/containers/<your container id>/profit-on-adspend.
On that screen you find, top to bottom:
On / Off switch
Turns Profit on Ad Spend on or off for this container
Mode
Standard reads the XML feed per order when the purchase webhook comes in. Advanced syncs your costs, and adds cost items, the GTM variable and Data Studio reports
Product feed (Advanced) / XML feed (Standard)
Feed URL and the two columns we read, plus the sync status: how many products have a cost price
Cost items
Shipping, payment and other costs per order — see Cost Items. Advanced only
Set up in Google Tag Manager
The lookup token and instructions for the GTM variable. Advanced only
Check on a real order
Shows the profit calculated on a real order, so you can check the result. Advanced only
Shopify cost per item
Shopify already stores a purchase price per variant, so on Shopify there is nothing to generate and nothing to export.
Fill in Cost per item
In Shopify, open a product and scroll to the variant's Inventory section. Cost per item is the field we read. A variant without it has no known cost.
Shopify stores this excluding VAT, which is the basis Profit on Ad Spend calculates in. Include your import duties and other landed costs here — that is what makes it a purchase price rather than a supplier price.
Connect Shopify and approve the permissions
Connect the Shopify integration for this container. See Shopify for the connection itself.
Reading cost prices needs the read_inventory permission. Stores that installed AdPage before that permission existed do not have it, and Shopify then answers with an access error rather than with zero costs.
If you connected a while ago, open the AdPage app once from your Shopify admin and approve the permissions it asks for. That one-off re-consent is all it takes.
Turn on Profit on Ad Spend
Open the Profit on Adspend screen, switch it On and choose Advanced. (The same switch is also on the Send Profit on Adspend profit card under Webhook Matching.)
You should end up with a line like "20565 products with a cost price". That number is the check: far below your catalogue size means most variants have an empty Cost per item.
Which keys a Shopify cost lands under. Every priced variant is stored under both its SKU and its variant id, so an order line matches on whichever of the two it carries. A product id is added as well, but only when every variant of that product has the same cost — otherwise an order line carrying nothing but a product id would silently get one variant's price for all of them. Variant-priced products are the normal case, and there the product id is deliberately left out.
Magento catalogue
Turn on Profit on Ad Spend
Open the Profit on Adspend screen, switch it On and choose Advanced. Switching it on pulls the catalogue straight away. (The same switch is also on the Send Profit on Adspend profit card under Webhook Matching.)
You should end up with a line like "Active · 4274 products with a cost price from the Magento catalogue". That number is the check: if it is far below your catalogue size, most products have an empty cost field.
XML purchase-price feed
Works on any platform, and is the only option outside Shopify and Magento.
Generate an XML feed
An XML feed is a file containing information about a webshop's products, in a format different systems can read automatically. Change a price in your webshop and every connected system sees the change, without anyone updating it by hand.
You can generate one with Channable, a WooCommerce plugin, or a similar tool. It needs to contain at least a product id and a purchase price per product. The feed must be reachable without logging in.
Fill in the feed on the Profit on Adspend screen
Open the Profit on Adspend screen and fill in the Product feed block (called XML feed in Standard mode):
Feed URL — where the feed can be downloaded.
Product ID column — the field holding the product id, for example
g:id. This id must match theitem_idin your incoming GA4 event requests. If you have not changed theitem_idparameter in your GA4 event tags, that is theitem_idfrom your dataLayer.Cost price column — the field in the feed holding the purchase price, for example
g:cost_of_goods_soldorg:custom_label_2.
Click Save feed. In Advanced this syncs right away, so you immediately see how many products got a cost price.
Finding the item_id in the dataLayer. Open your webshop and go to a product page. Inspect the page, go to the Console tab and type window.dataLayer. Find the view_item event and read the item_id of the product you are looking at.

Tell us whether your feed prices include VAT
Purchase prices in a feed are sometimes listed including VAT and sometimes excluding it, and only you know which. Profit on Ad Spend calculates a pure ex-VAT margin, so if your feed lists prices including VAT, go to Webhook Matching, tick The purchase prices in my feed include VAT on the Send Profit on Adspend profit card, and fill in the VAT percentage.
Get this wrong and nothing breaks — your margin is simply off by the VAT rate. If the numbers look consistently too high or too low, check this setting first and re-sync.
Which ids have to match
Whichever source you use, a cost is only found when the product id we receive matches the id we have a cost for. We try every identifier an order line carries — item_id, variant id, sku, item_sku — and use the first one with a known cost, so a mismatch on one key can still resolve on another.
Whether that actually worked on a real order is visible in preview. See Set up the server container.
What else comes off the margin
A cost source covers the products. Shipping, payment and packaging are set separately, on the same Profit on Adspend screen — see Cost Items.
Was this helpful?

