$placements = ['https://www.youtube.com/channel/UCMwS4p5XhAY9Rhqq7EGGKQA', 'https://www.youtube.com/channel/UCVHO-W63u8RrXa6BAHxfLtQ', foreach ($placements as $placement_value) { $sharedCriterion = new SharedCriterion([ 'placement' => new PlacementInfo([ 'url' => new StringValue(['value' => $placement_value]) ]), 'shared_set' => new StringValue( ['value' => 'customers/XXXX/sharedSets/XXXX']) ]);
$sharedCriterionOperation = new SharedCriterionOperation(); $sharedCriterionOperation->setCreate($sharedCriterion); $sharedCriterionOperations[] = $sharedCriterionOperation; }
$campaignSharedSet = new CampaignSharedSet([ 'campaign' => new StringValue( ['value' => ResourceNames::forCampaign($this->customerId, $campaignId)] ), 'shared_set' => new StringValue(['value' => 'customers/XXXXXXXXXX/sharedSets/XXXXXXXX']) ]);
$campaignSharedSetOperation = new CampaignSharedSetOperation(); $campaignSharedSetOperation->setCreate($campaignSharedSet);
$campaignSharedSetServiceClient = $googleAdsClient->getCampaignSharedSetServiceClient(); $response = $campaignSharedSetServiceClient->mutateCampaignSharedSets( $this->customerId, [$campaignSharedSetOperation] );
An uncaught Exception was encountered
Type: Exception
Message: Expect Google\Ads\GoogleAds\V3\Services\CampaignSharedSetOperation.
Filename: /google-ads-php/vendor/google/protobuf/src/Google/Protobuf/Internal/GPBUtil.php
Line Number: 197