Algorithm for campaign optimization (Digital Advertising)
sounds like a great place for a weighted average and a little algebra.

budget_n = (revenue_n / total_revenue) * total_budget

This is a simple solution you may have already tried, but in principle, the revenue fraction can be as complex as you need it to be as all the fractions across all campaigns add up to 1.