1. A method comprising: receiving publisher selections of advertisements from a plurality of advertisements; associating the selected advertisements with an advertisement environment in a document, wherein the advertisement environment is associated with a location in the document for presenting one or more advertisements; generating, by one or more processors, an advertisement request code for inclusion in the document, the advertisement request code configured to issue an advertisement request for selection of an advertisement from the selected advertisements for presentation in the advertisement environment; evaluating performance metrics for the selected advertisements presented in the advertisement environment; determining that the selected advertisements do not meet a performance threshold; in response to determining that the selected advertisements do not meet the performance threshold, optimizing the selection of selected advertisements based on the performance metrics comprising overriding the publisher selections; substituting a selected advertisement with a candidate advertisement of a plurality of candidate advertisements, wherein the candidate advertisements are different than the selected advertisements; and providing the candidate advertisement instead of the selected advertisement to a client device for rendering in the advertisement environment of the document.