Remove Frequency capping in campaign

121 views
Skip to first unread message

Yadigar Mammadov

unread,
May 5, 2020, 4:36:14 AM5/5/20
to AdWords API and Google Ads API Forum
Hello,
I have set frequency capping while updating the campaign with PHP client library as given below

$campaign = new Campaign([
                'resource_name' => ResourceNames::forCampaign(self::CUSTOMER_ID, $this->campaign_id),
                'status' => CampaignStatus::PAUSED,
                'frequency_caps'=>[ new \Google\Ads\GoogleAds\V3\Common\FrequencyCapEntry([
                    'key' => new \Google\Ads\GoogleAds\V3\Common\FrequencyCapKey([
                        'level'=> \Google\Ads\GoogleAds\V3\Enums\FrequencyCapLevelEnum\FrequencyCapLevel::CAMPAIGN,
                        'event_type'=> \Google\Ads\GoogleAds\V3\Enums\FrequencyCapEventTypeEnum\FrequencyCapEventType::IMPRESSION,
                        'time_unit'=> \Google\Ads\GoogleAds\V3\Enums\FrequencyCapTimeUnitEnum\FrequencyCapTimeUnit::DAY,
                    ]),
                    'cap' => new Int32Value(['value'=>10])

                ])],
                'frequency_caps'=> new \Google\Protobuf\Internal\RepeatedField()
            ]);

            $campaignOperation = new CampaignOperation();
            $campaignOperation->setUpdate($campaign);
            $campaignOperation->setUpdateMask(FieldMasks::allSetFieldsOf($campaign));

            // Issues a mutate request to update the campaign.
            $campaignServiceClient = $this->googleAdsClient->getCampaignServiceClient();
            $response = $campaignServiceClient->mutateCampaigns(
                self::CUSTOMER_ID,
                [$campaignOperation]
            );

The problem is I cannot reset frequency capping to null. Is there a way to remove frequency capping settings from the campaign?

Google Ads API Forum Advisor Prod

unread,
May 5, 2020, 12:36:08 PM5/5/20
to dev.y...@gmail.com, adwor...@googlegroups.com
Hi Yadigar,

Thank you for reaching out. You can remove the frequency_caps by using the UpdateMask operation as explained here for just that attribute then keep the value blank when building your Campaign. This will clear that attribute. You can find more information on PHP Field Masks here and an example of setting the mask here. It would look something like:

{
 "operations": {
     "update": {
        "resourceName": "customers/{Account Number}/campaigns/{Campaign Number}",
       },
       "update_mask": {
         "paths": "frequency_caps",
       }
    }
}

Regards,
Mitchell
Google Ads API Team

ref:_00D1U1174p._5004Q1zKBGP:ref
Reply all
Reply to author
Forward
0 new messages