We present an approach to automate the bidding and budgeting of multi-unit digital advertising campaigns. Such campaigns typically involve groups of ad-units that span multiple user segments, ad-delivery channels and media that together are meant to deliver on the advertiser’s goals. Our model handles the simultaneous optimization of a flexible portfolio of such ad-units bought via real-time bidding (RTB). Unlike “black-box” automated bidding systems, we solve for optimal bidding and budgeting by linking the automation to a clearly posed optimization problem that produces interpretable and analytic optimality conditions that are verifiable. We also present a set of solution algorithms that have provably fast convergence properties, and reduces the need to estimate complex input functions from the data, thereby reducing estimation error. Further, we show how to integrate this solution with existing multi-touch attribution (MTA) models in a modular way, thereby demonstrating how to leverage the attribution results provided by modern MTA models for campaign bidding and budgeting. The system we present has been fully deployed on the advertising platform of JD.com. We present randomized control trials we implement on the platform that show empirically that usage of the system improves advertiser’s campaign goals substantially relative to that under their default choices.