$textAd->UrlCustomParameters->Parameters[] = $customParameter1; $customParameter2 = new CustomParameter(); $customParameter2->Key = "season"; $customParameter2->Value = "summer"; $textAd->UrlCustomParameters->Parameters[] = $customParameter2; $ads[] = new SoapVar($textAd, SOAP_ENC_OBJECT, 'TextAd', $proxy->GetNamespace()); } $ads[0]->enc_value->Title = "Women's Shoe Sale"; $ads[1]->enc_value->Title = "Women's Super Shoe Sale"; $ads[2]->enc_value->Title = "Women's Red Shoe Sale"; $ads[3]->enc_value->Title = ""; $ads[4]->enc_value->Title = "Women's Super Shoe Sale"; // Add the campaign, ad group, keywords, and ads $campaignIds = AddCampaigns($proxy, $AccountId, $campaigns); $adGroupIds = AddAdGroups($proxy, $campaignIds[0], $adGroups); $addKeywordsResponse = AddKeywords($proxy, $adGroupIds[0], $keywords); $keywordIds = $addKeywordsResponse->KeywordIds->long; $keywordErrors = $addKeywordsResponse->PartialErrors->BatchError; $addAdsResponse = AddAds($proxy, $adGroupIds[0], $ads); $adIds = $addAdsResponse->AdIds->long; $adErrors = $addAdsResponse->PartialErrors->BatchError; // Print the new assigned campaign and ad group identifiers PrintCampaignIdentifiers($campaignIds); PrintAdGroupIdentifiers($adGroupIds); // Print the new assigned keyword and ad identifiers, as well as any partial errors PrintKeywordResults($keywords, $keywordIds, $keywordErrors); PrintAdResults($ads, $adIds, $adErrors); // Delete the campaign, ad group, keyword, and ad that were previously added. // You should remove this line if you want to view the added entities in the // Bing Ads web application or another tool. DeleteCampaigns($proxy, $AccountId, array($campaignIds[0]));
// Set bids (optional). $bid = new CpcBid(); $bid->bid = new Money(500000); $biddingStrategyConfiguration = new BiddingStrategyConfiguration(); $biddingStrategyConfiguration->bids[] = $bid; $adGroupCriterion->biddingStrategyConfiguration = $biddingStrategyConfiguration; $adGroupCriteria[] = $adGroupCriterion; // Create operation. $operation = new AdGroupCriterionOperation(); $operation->operand = $adGroupCriterion; $operation->operator = 'ADD'; $operations[] = $operation; } // Make the mutate request. $result = $adGroupCriterionService->mutate($operations); // Display results. foreach ($result->value as $adGroupCriterion) { echo "Keyword with text" . $adGroupCriterion->criterion->text . " match type" . $adGroupCriterion->criterion->matchType . "and ID" . $adGroupCriterion->criterion->id . "was added"; } } try { // Get AdWordsUser from credentials in "../auth.ini" // relative to the AdWordsUser.php file's directory. $user = new AdWordsUser(); // Log every SOAP XML request and response. $user->LogAll(); // Run the example. AddKeywords($user, $adGroupId); } catch (Exception $e) { printf("An error has occurred: %s\n", $e->getMessage()); }