Retrieve bid simulations

A bid simulation is made of simulation data and information about the time range, type of simulation data, campaign, ad group, or criterion on which it relates to. The simulation data is a sequence of simulation points that provides a histogram of the predicted performance with different bids during the given time frame. The information provided by a simulation point depends on the type of simulation data.

Any bid simulation can be retrieved with a GAQL query by selecting the right simulation data field (type of simulation data) from the right resource (bid level).

Bid Level & Resource SimulationType Simulation Data Field Simulation Point Type
Campaign Criterion

campaign_criterion_simulation

BID_MODIFIER bid_modifier_point_list.points BidModifierSimulationPoint
Ad Group Criterion

ad_group_criterion_simulation

CPC_BID cpc_bid_point_list.points CpcBidSimulationPoint
Ad Group

ad_group_simulation

CPC_BID

CPV_BID

TARGET_CPA

TARGET_ROAS

cpc_bid_point_list.points

cpv_bid_point_list.points

target_cpa_point_list.points

target_roas_point_list.points

CpcBidSimulationPoint

CpvBidSimulationPoint

TargetCpaSimulationPoint

TargetRoasSimulationPoint

The following example demonstrates how to retrieve and print all CPC bid-typed simulations available for any criteria of a given ad group filtering on its ID.

PHP

// Creates a query that retrieves the ad group criterion CPC bid simulations.
$query = sprintf(
    'SELECT ad_group_criterion_simulation.ad_group_id, ' .
    'ad_group_criterion_simulation.criterion_id, ' .
    'ad_group_criterion_simulation.start_date, ' .
    'ad_group_criterion_simulation.end_date, ' .
    'ad_group_criterion_simulation.cpc_bid_point_list.points ' .
    'FROM ad_group_criterion_simulation ' .
    'WHERE ad_group_criterion_simulation.type = CPC_BID ' .
    'AND ad_group_criterion_simulation.ad_group_id = %d',
    $adGroupId
);

// Issues a search stream request.
/** @var GoogleAdsServerStreamDecorator $stream */
$stream = $googleAdsServiceClient->searchStream($customerId, $query);

// Iterates over all rows in all messages and prints the requested field values for
// the ad group criterion CPC bid simulation in each row.
foreach ($stream->iterateAllElements() as $googleAdsRow) {
    /** @var GoogleAdsRow $googleAdsRow */
    $simulation = $googleAdsRow->getAdGroupCriterionSimulation();
    printf(
        'Found ad group criterion CPC bid simulation for ad group ID %d, ' .
        'criterion ID %d, start date "%s", end date "%s", and points:%s',
        $simulation->getAdGroupId(),
        $simulation->getCriterionId(),
        $simulation->getStartDate(),
        $simulation->getEndDate(),
        PHP_EOL
    );
    foreach ($simulation->getCpcBidPointList()->getPoints() as $point) {
        /** @var CpcBidSimulationPoint $point */
        printf(
            '  bid: %d => clicks: %d, cost: %d, impressions: %d, ' .
            'biddable conversions: %.2f, biddable conversions value: %.2f%s',
            $point->getCpcBidMicros(),
            $point->getClicks(),
            $point->getCostMicros(),
            $point->getImpressions(),
            $point->getBiddableConversions(),
            $point->getBiddableConversionsValue(),
            PHP_EOL
        );
    }

    print PHP_EOL;
}