$adWordsServices = new AdWordsServices();
$campaignService = $adWordsServices->get($this->AdWordsSession, CampaignService::class);
// Create a campaign with Status.
$campaign = new Campaign();
$campaign->setId($google_campaign_id);
$campaign->setStatus(CampaignStatus::PAUSED);
// Create a campaign operation and add it to the list.
$operation = new CampaignOperation();
$operation->setOperand($campaign);
$operation->setOperator(Operator::SET);
$operations = [$operation];
// Update the campaign on the server.
$result = $campaignService->mutate($operations);
$val = $result->getValue()[0];
$res = [
'getId' => $val->getId(),
'getName' => $val->getName(),
'getStatus' => $val->getStatus()
];
Hi there!
Thanks advance
Hello,
Thank you for writing to us. Please refer to this code sample to add campaigns via API. You need to set the campaign status to 'ENABLED' or 'PAUSED' using the below code snippet. Let us know if you need any additional information.
$campaign->setStatus(CampaignStatus::PAUSED);
Regards,
Nikisha Patel, Google Ads API Team