$customParameter1->Value = "PROMO" . ($i + 1);
     $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.
Beispiel #2
0
<?php

include 'header.php';
$campaignId = $_GET['c_id'];
if (@$_POST['submit']) {
    $name = $_POST['name'];
    $amount = $_POST['amount'];
    try {
        // relative to the AdWordsUser.php file's directory.
        $user = new AdWordsUser();
        // Log every SOAP XML request and response.
        $user->LogAll();
        // Run the example.
        AddAdGroups($user, $campaignId, $name, $amount);
        echo "AdGroup has added";
    } catch (Exception $e) {
        printf("An error has occurred: %s\n", $e->getMessage());
    }
}
?>
<form action="" method="post" >
<label>Name</label> 
<input type="text" name="name" value=""><br>
<label>Bid Amount</label> 
<input type="text" name="amount" value=""><br>
<input type="submit" name="submit" value="submit"><br>
</form>


<?php 
include 'footer.php';
Beispiel #3
0
        $operations[] = $operation;
    }
    // Make the mutate request.
    $result = $adGroupService->mutate($operations);
    // Display result.
    $adGroups = $result->value;
    foreach ($adGroups as $adGroup) {
        echo "Ad group with name" . $adGroup->name . " and ID " . $adGroup->id . " was added.";
    }
}
if (@$_POST['submit']) {
    $name = $_POST['name'];
    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.
        AddAdGroups($user, $campaignId, $name, $channel);
    } catch (Exception $e) {
        printf("An error has occurred: %s\n", $e->getMessage());
    }
}
?>
<form action="" method="post" >
<label>Name</label> 
<input type="text" name="name" value=""><br>
<input type="submit" name="submit" value="submit"><br>
</form>
// AdGroupCriterionAction array
$ReferenceId = -1;
// Campaign Management WSDL
$wsdl = "https://campaign.api.bingads.microsoft.com/Api/Advertiser/CampaignManagement/V10/CampaignManagementService.svc?singleWsdl";
$ids = null;
try {
    $proxy = ClientProxy::ConstructWithAccountAndCustomerId($wsdl, $UserName, $Password, $DeveloperToken, $AccountId, $CustomerId, null);
    $stores = GetStores($proxy);
    if (!isset($stores)) {
        printf("Customer %d does not have any regeistered BMC stores.\n\n", $CustomerId);
        return;
    }
    // Create a Bing Shopping campaign using the ID of the first store in the list.
    $campaignIds = AddCampaigns($proxy, $AccountId, $stores[0]->Id);
    PrintCampaignIdentifiers($campaignIds->long);
    $adGroupIds = AddAdGroups($proxy, $campaignIds->long[0]);
    PrintAdGroupIdentifiers($adGroupIds->long);
    $response = AddAds($proxy, $adGroupIds->long[0]);
    PrintAdIdentifiers($response->AdIds->long, $response->PartialErrors);
    // Add criterion to the campaign. The criterion is used to limit the campaign to a subset of
    // your product catalog.
    $addCriterionResponse = AddCampaignCriterion($proxy, $campaignIds->long[0]);
    PrintCampaignCriterionIdentifiers($addCriterionResponse->CampaignCriterionIds->long, $addCriterionResponse->NestedPartialErrors);
    AddAndUpdateAdGroupCriterion($proxy, $AccountId, $PartitionActions, $adGroupIds->long[0]);
    $applyPartitionActionsResponse = AddBranchAndLeafCriterion($proxy, $AccountId, $PartitionActions, $adGroupIds->long[0]);
    $rootId = $applyPartitionActionsResponse->AdGroupCriterionIds->long[1];
    $electronicsCriterionId = $applyPartitionActionsResponse->AdGroupCriterionIds->long[8];
    UpdateBranchAndLeafCriterion($proxy, $PartitionActions, $AccountId, $adGroupIds->long[0], $rootId, $electronicsCriterionId);
    // Delete the campaign from the account.
    //DeleteCampaigns($proxy, $AccountId, $campaignIds->long);
    //printf("Deleted CampaignId %d\n", $campaignIds->long[0]); // Added just the one