COGS (cost of goods sold) lets Mida estimate profit on top of revenue in experiment results. You upload how much each product variant costs you; we combine that with your Purchase events so reports can show profit-related metrics, not only revenue.
What you need first
A Revenue goal that tracks the
Purchaseevent (revenue goals use this event name).Purchase events that include enough product identifiers to match your COGS file (see “How purchases match your CSV” below).
Purchase goal: JavaScript snippets
Use the event name Purchase. Place the script on the page where the order is confirmed (for example thank-you / order confirmation), or fire the same payload from your tag / backend integration.
1) Default snippet (revenue only)
Copy this if you only need revenue tracking:
<script type="text/javascript">
window.mdq = window.mdq || []
window.mdq.push(["track", "Purchase", {
revenue: 99.5,
quantity: 10,
currency: "USD"
}])
</script>
Replace revenue, quantity, and currency with the real order total, total units, and ISO currency code.
2) Optional: COGS / profit — multi-line order
Use when you upload a COGS CSV and need line items to match variant_id / product_id rows:
<script type="text/javascript">
window.mdq = window.mdq || []
window.mdq.push(["track", "Purchase", {
revenue: 99.5,
quantity: 10,
currency: "USD",
// Item 1:
item_1_id: "12345678901",
item_1_product_id: "9876543210",
item_1_quantity: 2,
// Item 2:
item_2_id: "22222222222",
item_2_product_id: "9876543210",
item_2_quantity: 1
}])
</script>
item_1_id,item_2_id, … = variant ids (must align withvariant_idin your COGS CSV).item_N_product_id= optional; used if the variant id does not match a row.item_N_quantity= quantity per line for COGS math.Add
item_3_*,item_4_*, … for more lines.
3) Optional: COGS / profit — single product (no line-item keys)
If you do not send item_* fields, we match on root fields:
<script type="text/javascript">
window.mdq = window.mdq || []
window.mdq.push(["track", "Purchase", {
revenue: 49.99,
quantity: 1,
currency: "USD",
product_id: "9876543210",
// variant_id: "12345678901" // Optional: just one id will do!
}])
</script>
We try variant_id, then product_id, then id, and use quantity when present.
Note: If you use Shopify event integrations with Mida, Purchase is often sent for you with the right shape; use the snippets above mainly for custom sites or when verifying payloads.
Where to set up COGS
Open your project’s COGS settings (e.g. Settings → COGS). There you can:
Download a COGS template CSV.
Upload a completed CSV after you fill in costs.
Optionally set fixed shipping / fulfillment per order and a transaction fee (% of revenue).
The COGS CSV
Include a
cogscolumn.Each row needs at least one id column; we use the first non-empty of
variant_id, thenproduct_id, thenid(orID).
How purchases match your CSV (summary)
With line items:
item_N_id(variant) and optionalitem_N_product_id,item_N_quantity.Without line items: root
variant_id,product_id, orid, plusquantity.
Optional: shipping and fees
Fixed shipping per order and transaction fee % in COGS settings are applied together with CSV COGS on profit reporting.
Troubleshooting
Profit missing or wrong: check that CSV
variant_id/product_idvalues matchitem_N_id(or root ids) onPurchase.Re-download the template, verify
cogsand id columns, and re-upload if needed.
