budget-by-margin
Reallocate Meta campaign budgets by margin-led return, using Shopify unit costs and sales rather than platform ROAS alone.
Latest eval run
- PASSdefault inputs on demo data$0.113 · 22.6s · 7 tool calls · 4 proposals
I proposed 4 budget changes across 6 campaigns, based on the 7 completed days from Oct 9 to Oct 15, 2026. This run used demo store data and demo Meta Ads data, not a real store or ad account. Rain Shell - Prospecting: spend $1,227.23, Meta-attributed revenue $3,888.88 (store revenue for Packable Rain Shell: $10,449), ROAS 3.17, gross margin 39.5%, margin ROAS 1.25. Increase proposed: daily budget from $180.00 to $216.00 (+20%), because ROAS is at least 1.15x the 2.5 target. Hammock - Launch: spend $822.84, Meta-attributed revenue $2,343.73 (store revenue for Ultralight Hammock: $6,142), ROAS 2.85, gross margin 29.7%, margin ROAS 0.85. Decrease proposed: daily budget from $120.00 to $96.00 (-20%), because it loses money after cost of goods (break-even ROAS is 3.37). Tee - Always-on: spend $612.62, Meta-attributed revenue $1,474.23 (store revenue for Trail Runner Tee: $3,762), ROAS 2.41, gross margin 68.4%, margin ROAS 1.65. Hold, no change. Daypack - Retargeting: spend $404.67, Meta-attributed revenue $1,827.83 (store revenue for Everyday Daypack 20L: $7,654), ROAS 4.52, gross margin 59.6%, margin ROAS 2.69. Increase proposed: daily budget from $60.00 to $72.00 (+20%), because ROAS is at least 1.15x the target. Socks + Beanie - Bundle: spend $270.21, Meta-attributed revenue $709.32 (store revenue: Merino Crew Socks (3-pack) $2,072, Wool Beanie $1,920), ROAS 2.63, gross margin 65.8%, margin ROAS 1.73. Hold, no change. Camp Mug - Awareness: spend $166.67, Meta-attributed revenue $149.25 (store revenue for Camp Mug: $1,674), ROAS 0.9, gross margin 66.7%, margin ROAS 0.6. Decrease proposed: daily budget from $25.00 to $20.00 (-20%), because it loses money after cost of goods. Hammock - Launch needs your attention most: its ROAS of 2.85 beats your 2.5 target, but at a 29.7% margin it earns only 0.85 in margin per dollar spent, so it loses money on $822.84 of spend. These 4 changes are only proposals for someone to review. Nothing has changed in the ad account.
- PASSunreachable target cuts every campaign$0.115 · 30.5s · 9 tool calls · 6 proposals
I proposed 6 budget changes for 6 campaigns, covering Oct 9–15, 2026. All six are 20% cuts. This run used demo store data and a demo Meta ad account, not your real accounts. Rain Shell - Prospecting: spend $1,227.23, Meta revenue $3,888.88 (store revenue for Packable Rain Shell: $10,449), ROAS 3.17, gross margin 39.5%, margin ROAS 1.25. Decrease: $180.00 to $144.00 a day, because ROAS is below 0.85x the target of 6. Hammock - Launch: spend $822.84, Meta revenue $2,343.73 (store revenue for Ultralight Hammock: $6,142), ROAS 2.85, gross margin 29.7%, margin ROAS 0.85. Decrease: $120.00 to $96.00 a day, because it loses money once product costs are counted (break-even ROAS is 3.37). Tee - Always-on: spend $612.62, Meta revenue $1,474.23 (store revenue for Trail Runner Tee: $3,762), ROAS 2.41, gross margin 68.4%, margin ROAS 1.65. Decrease: $90.00 to $72.00 a day, because ROAS is below 0.85x the target. Daypack - Retargeting: spend $404.67, Meta revenue $1,827.83 (store revenue for Everyday Daypack 20L: $7,654), ROAS 4.52, gross margin 59.6%, margin ROAS 2.69. Decrease: $60.00 to $48.00 a day, because ROAS is below 0.85x the target. Socks + Beanie - Bundle: spend $270.21, Meta revenue $709.32 (store revenue: Merino Crew Socks (3-pack) $2,072, Wool Beanie $1,920), ROAS 2.63, gross margin 65.8%, margin ROAS 1.73. Decrease: $40.00 to $32.00 a day, because ROAS is below 0.85x the target. Camp Mug - Awareness: spend $166.67, Meta revenue $149.25 (store revenue for Camp Mug: $1,674), ROAS 0.9, gross margin 66.7%, margin ROAS 0.6. Decrease: $25.00 to $20.00 a day, because it loses money once product costs are counted. Your target ROAS of 6 is well above every campaign's break-even ROAS, which ranges from 1.46 to 3.37. Because of that, the rules cut four campaigns that are actually profitable after product costs: Rain Shell, Tee, Daypack and Socks + Beanie. Daypack - Retargeting has a margin ROAS of 2.69. If 6 isn't the target you mean to judge by, rerun with a lower one before approving those four cuts. The campaign to look at first is Hammock - Launch. It has the second-highest spend at $822.84, and its 2.85 ROAS looks fine, but after the hammock's 29.7% margin it earns only $0.85 back for every $1 spent. These changes are proposals for someone to review. Nothing in the store or ad account has changed.
- PASStwo weeks with a tighter cap keeps the same four decisions$0.093 · 22.4s · 7 tool calls · 4 proposals
I proposed 4 budget changes across 6 Meta campaigns for Oct 2–15, 2026 (the 14 full days ending yesterday). This run uses demo store and demo Meta Ads data, not a real store or ad account. Rain Shell - Prospecting: spent $2,449.91 for $7,858.57 in Meta revenue (store revenue for Packable Rain Shell: $18,834). ROAS 3.21, gross margin 39.5%, margin ROAS 1.27. Decision: increase from $180.00 to $198.00 a day (+10%). Hammock - Launch: spent $1,634.69 for $4,612.28 in Meta revenue (store revenue for Ultralight Hammock: $11,914). ROAS 2.82, gross margin 29.7%, margin ROAS 0.84; it needs a ROAS of 3.37 to break even. Decision: decrease from $120.00 to $108.00 a day (−10%). Tee - Always-on: spent $1,221.32 for $2,929.00 in Meta revenue (store revenue for Trail Runner Tee: $6,802). ROAS 2.40, gross margin 68.4%, margin ROAS 1.64. Decision: hold, because ROAS is inside the hold range of 2.125 to 2.875. Daypack - Retargeting: spent $814.88 for $3,655.67 in Meta revenue (store revenue for Everyday Daypack 20L: $14,329). ROAS 4.49, gross margin 59.6%, margin ROAS 2.67. Decision: increase from $60.00 to $66.00 a day (+10%). Socks + Beanie - Bundle: spent $543.79 for $1,421.71 in Meta revenue (store revenue: Merino Crew Socks (3-pack) $4,088, Wool Beanie $3,312). ROAS 2.61, gross margin 65.8%, margin ROAS 1.72. Decision: hold, because ROAS is inside the hold range. Camp Mug - Awareness: spent $338.74 for $304.10 in Meta revenue (store revenue for Camp Mug: $3,060). ROAS 0.90, gross margin 66.7%, margin ROAS 0.60. Decision: decrease from $25.00 to $22.50 a day (−10%). Every product had a unit cost entered, so every campaign has a margin figure, and none of the results were cut short. Hammock - Launch needs your attention most: its 2.82 ROAS beats your 2.5 target, but the hammock's 29.7% margin means it loses money once product costs are counted (margin ROAS 0.84). These changes are proposals waiting for review. Nothing in the store or ad account has changed.
- PASSlow target lifts everything that clears margin$0.106 · 27.4s · 9 tool calls · 6 proposals
I proposed budget changes for all 6 campaigns, based on Oct 9–15, 2026 (today is left out because it isn't over). Nothing has changed in the account; these are proposals for someone to review. The data is demo data, not a real store or Meta ad account. Every product has a unit cost entered, so every campaign has a margin figure. I used your target ROAS of 1.5: an increase needed a ROAS of 1.725 or more, and a decrease needed a ROAS below 1.275 or a margin ROAS below 1.0 (1.0 is break-even after product costs). Rain Shell - Prospecting: spend $1,227.23, Meta revenue $3,888.88 (store sales of Packable Rain Shell $10,449), ROAS 3.17, gross margin 39.5%, margin ROAS 1.25. Increase daily budget from $180.00 to $216.00. Hammock - Launch: spend $822.84, Meta revenue $2,343.73 (store sales of Ultralight Hammock $6,142), ROAS 2.85, gross margin 29.7%, margin ROAS 0.85 (it needs a ROAS of 3.37 to break even). Decrease from $120.00 to $96.00. Tee - Always-on: spend $612.62, Meta revenue $1,474.23 (store sales of Trail Runner Tee $3,762), ROAS 2.41, gross margin 68.4%, margin ROAS 1.65. Increase from $90.00 to $108.00. Daypack - Retargeting: spend $404.67, Meta revenue $1,827.83 (store sales of Everyday Daypack 20L $7,654), ROAS 4.52, gross margin 59.6%, margin ROAS 2.69. Increase from $60.00 to $72.00. Socks + Beanie - Bundle: spend $270.21, Meta revenue $709.32 (store sales of Merino Crew Socks 3-pack $2,072 and Wool Beanie $1,920), ROAS 2.63, gross margin 65.8%, margin ROAS 1.73. Increase from $40.00 to $48.00. Camp Mug - Awareness: spend $166.67, Meta revenue $149.25 (store sales of Camp Mug $1,674), ROAS 0.9, gross margin 66.7%, margin ROAS 0.6. Decrease from $25.00 to $20.00. Hammock - Launch needs your attention most: its ROAS of 2.85 is well above your 1.5 target, but the hammock's 29.7% margin means it loses money after product costs. It's also the second-biggest spender, so judging it on ROAS alone would be expensive. All six changes are recorded as proposals for review.
The prompt
Budget by margin
You decide where the merchant's Meta budget should move next, loyal to the merchant's margin rather than to the platform's ROAS. A campaign that clears the ROAS target can still lose money once cost of goods is counted; a campaign below target on a high-margin product can still be worth more.
Steps
- Period: the
dayscompleted days ending yesterday, in the store timezone. Today is a partial day and is left out. - Call
get_top_productsfor the period withlimit25. This is what the store actually sold, by product. - Call
get_product_marginsonce. Products without a cost have no margin; say so for any campaign that depends on one. - Call
get_campaign_spendonce for the period, passing every product with a margin asproduct_margins. The result gives each campaign its spend, attributed revenue,roas,gross_margin_pct,margin_roas(contribution margin earned per unit of spend; 1.0 is break-even) andbreak_even_roas. Do not callget_adsets_for_campaignunless a campaign's decision is unclear. - Decide for each campaign, applying the first rule that matches:
margin_roasbelow 1.0: decrease the daily budget bymax_change_pct. It loses money after cost of goods, whatever its ROAS.roasat or above 1.15 timestarget_roas: increase bymax_change_pct.roasbelow 0.85 timestarget_roas: decrease bymax_change_pct.- Otherwise hold. No proposal.
- A campaign with no
daily_budgetor nomargin_roasis reported but never gets a proposal.
- For every increase or decrease call
set_campaign_daily_budgetonce with the campaign's id and name,current_daily_budgetfrom the tool result,proposed_daily_budgetequal to the current budget moved by exactlymax_change_pct, to the cent, never rounded past the cap,max_change_pctpassed through, and areasonthat states the period's spend, attributed revenue, ROAS, gross margin and margin ROAS.
Output
Plain text, no markdown. Lead with one line: how many budget changes were proposed out of how many campaigns, over which dates. Then one line per campaign, highest spend first: campaign name, spend, attributed revenue, ROAS, gross margin, margin ROAS, and the decision with the new daily budget when one was proposed. Where a campaign's product also appears in the Shopify top products, add that product's store revenue for the period beside Meta's attributed revenue, so the merchant sees the platform's claim next to the store's own figure. End with one sentence naming the single campaign the merchant most needs to look at and why, and a line saying the changes were recorded as proposals for review.
Every figure comes from a tool result in this run. The only arithmetic you do is the budget move in step 6 and the two threshold comparisons in step 5.