首页 > 解决方案 > 无法启用设置最高每次点击费用出价限制并使用 google adwords api 设置最高出价

问题描述

我已经使用 Google Adwords API 创建了 google adCampaigns、adGroups、Keywords、Ads、Locations,但我无法使用 api 设置“设置每次点击费用的最高出价限制” 在此处输入图像描述

我已使用此代码进行设置,但未设置

       $operations = [];
        // Create ad group with the specified ID.
        $groupId = $adGroup->getId();

        $adGroupNew = new AdGroup();
        $adGroupNew->setId($groupId);
        $cpcBidMicroAmount = intval($_GET['cpc']) * 1000000;
        // Update the CPC bid if specified.
        if (!is_null($cpcBidMicroAmount)) {
            $bid = new CpcBid();
            $money = new Money();
            $money->setMicroAmount($cpcBidMicroAmount);
            $bid->setBid($money);
            $biddingStrategyConfiguration = new BiddingStrategyConfiguration();
            $biddingStrategyConfiguration->setBids([$bid]);
            $adGroup->setBiddingStrategyConfiguration($biddingStrategyConfiguration);
        }

        // Create ad group operation and add it to the list.
        $operation = new AdGroupOperation();
        $operation->setOperand($adGroupNew);
        $operation->setOperator(Operator::SET);
        $operations[] = $operation;

        // Update the ad group on the server.
        $adGroupService->mutate($operations);

标签: google-ads-api

解决方案


    $biddingScheme = new TargetSpendBiddingScheme();
    $bidCeiling = new Money();
    $bidCeiling->setMicroAmount($_GET['cpc'] * 1000000);
    $biddingScheme->setBidCeiling($bidCeiling);
    $spendTarget = new Money();
    $spendTarget->setMicroAmount($_GET['cpc'] * 1000000);
    $biddingScheme->setSpendTarget($spendTarget);

在广告系列级别执行此操作以设置竞价上限


推荐阅读