Create a Smart Display Campaign

Campaign budget

You can use an existing campaign budget or create a new one:


private static function createCampaignBudget(
    GoogleAdsClient $googleAdsClient,
    int $customerId
) {
    // Creates a campaign budget.
    $campaignBudget = new CampaignBudget([
        'name' => 'Interplanetary Cruise Budget #' . uniqid(),
        'delivery_method' => BudgetDeliveryMethod::STANDARD,
        'amount_micros' => 5000000

    // Creates a campaign budget operation.
    $campaignBudgetOperation = new CampaignBudgetOperation();

    // Issues a mutate request to add campaign budgets.
    $campaignBudgetServiceClient = $googleAdsClient->getCampaignBudgetServiceClient();
    /** @var MutateCampaignBudgetsResponse $campaignBudgetResponse */
    $campaignBudgetResponse = $campaignBudgetServiceClient->mutateCampaignBudgets(

    // Prints out some information about the created campaign budget.
    $campaignBudgetResourceName = $campaignBudgetResponse->getResults()[0]->getResourceName();
    printf("Added budget named '%s'.%s", $campaignBudgetResourceName, PHP_EOL);

    return $campaignBudgetResourceName;

Smart Display Campaign

To create a Smart Display campaign, follow the steps in our code example with these specifics:

  1. Set the advertising_channel_type to DISPLAY.

  2. Set the advertising_channel_sub_type to DISPLAY_SMART_CAMPAIGN.

  3. Set the target_cpa field to a newly created TargetCpa object. Target CPA is the only allowed bidding strategy for this campaign type.

You can also set targeting options for smart display campaign, by following the Add Campaign Targeting Criteria code example. The only campaign-level targeting options allowed are:


private static function createSmartDisplayCampaign(
    GoogleAdsClient $googleAdsClient,
    int $customerId,
    string $campaignBudgetResourceName
) {
    $campaign = new Campaign([
        'name' => 'Smart Display Campaign #' . uniqid(),
        // Smart Display campaign requires the advertising_channel_type as 'DISPLAY'.
        'advertising_channel_type' => AdvertisingChannelType::DISPLAY,
        // Smart Display campaign requires the advertising_channel_sub_type as
        'advertising_channel_sub_type' => AdvertisingChannelSubType::DISPLAY_SMART_CAMPAIGN,
        // Smart Display campaign requires the TargetCpa bidding strategy.
        'target_cpa' => new TargetCpa(['target_cpa_micros' => 5000000]),
        'campaign_budget' => $campaignBudgetResourceName,
        // Optional: Sets the start and end dates for the campaign, beginning one day from
        // now and ending a month from now.
        'start_date' => date('Ymd', strtotime('+1 day')),
        'end_date' => date('Ymd', strtotime('+1 month'))

    // Creates a campaign operation.
    $campaignOperation = new CampaignOperation();

    // Issues a mutate request to add the campaign.
    $campaignServiceClient = $googleAdsClient->getCampaignServiceClient();
    /** @var MutateCampaignsResponse $campaignResponse */
    $campaignResponse = $campaignServiceClient->mutateCampaigns(

    $campaignResourceName = $campaignResponse->getResults()[0]->getResourceName();
    printf("Added a Smart Display campaign named '%s'.%s", $campaignResourceName, PHP_EOL);

    return $campaignResourceName;