Skip to content

Commit 8d3afc7

Browse files
authored
Merge pull request #38 from BingAds/sunset-v9-v10
Sunset v9 v10
2 parents bb71312 + 1cab39e commit 8d3afc7

File tree

1,662 files changed

+3742
-30019
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,662 files changed

+3742
-30019
lines changed

samples/V11/AdExtensions.php

Lines changed: 14 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@
4444
use Microsoft\BingAds\V11\CampaignManagement\AdExtensionIdToEntityIdAssociation;
4545
use Microsoft\BingAds\V11\CampaignManagement\AdExtensionStatus;
4646
use Microsoft\BingAds\V11\CampaignManagement\AdExtensionsTypeFilter;
47-
use Microsoft\BingAds\V11\CampaignManagement\AccountMigrationStatusesInfo;
48-
use Microsoft\BingAds\V11\CampaignManagement\MigrationStatusInfo;
49-
use Microsoft\BingAds\V11\CampaignManagement\MigrationStatus;
5047
use Microsoft\BingAds\V11\CampaignManagement\Address;
5148
use Microsoft\BingAds\V11\CampaignManagement\SiteLink;
5249
use Microsoft\BingAds\V11\CampaignManagement\AssociationType;
@@ -62,7 +59,6 @@
6259
use Microsoft\BingAds\Samples\V11\CampaignManagementHelper;
6360
use Microsoft\BingAds\Samples\V11\CustomerManagementHelper;
6461

65-
$GLOBALS['SitelinkMigration'] = "SiteLinkAdExtension";
6662
$GLOBALS['AuthorizationData'] = null;
6763
$GLOBALS['Proxy'] = null;
6864
$GLOBALS['CustomerProxy'] = null;
@@ -101,51 +97,7 @@
10197
$GLOBALS['CampaignProxy'] = new ServiceClient(ServiceClientType::CampaignManagementVersion11, $GLOBALS['AuthorizationData'], AuthHelper::GetApiEnvironment());
10298

10399
date_default_timezone_set('UTC');
104-
105-
// To prepare for the sitelink ad extensions migration in 2017, you will need to determine
106-
// whether the account has been migrated from SiteLinksAdExtension to Sitelink2AdExtension.
107-
// All ad extension service operations available for both types of sitelinks; however you will
108-
// need to determine which type to add, update, and retrieve.
109-
110-
$sitelinkMigrationIsCompleted = false;
111-
112-
// Optionally you can find out which pilot features the customer is able to use. Even if the customer
113-
// is in pilot for sitelink migrations, the accounts that it contains might not be migrated.
114-
$featurePilotFlags = CustomerManagementHelper::GetCustomerPilotFeatures($GLOBALS['AuthorizationData']->CustomerId)->FeaturePilotFlags->int;
115-
116-
// The pilot flag value for Sitelink ad extension migration is 253.
117-
// Pilot flags apply to all accounts within a given customer; however,
118-
// each account goes through migration individually and has its own migration status.
119-
if (in_array(253, $featurePilotFlags))
120-
{
121-
// Account migration status below will be either NotStarted, InProgress, or Completed.
122-
print("Customer is in pilot for Sitelink migration.\n\n");
123-
}
124-
else
125-
{
126-
// Account migration status below will be NotInPilot.
127-
print("Customer is not in pilot for Sitelink migration.\n\n");
128-
}
129-
130-
// Even if you have multiple accounts per customer, each account will have its own
131-
// migration status. This example checks the account provided above.
132-
$accountMigrationStatusesInfos = CampaignManagementHelper::GetAccountMigrationStatuses(
133-
array($GLOBALS['AuthorizationData']->AccountId),
134-
$GLOBALS['SitelinkMigration'])->MigrationStatuses;
135-
136-
foreach ($accountMigrationStatusesInfos->AccountMigrationStatusesInfo as $accountMigrationStatusesInfo)
137-
{
138-
CampaignManagementHelper::OutputAccountMigrationStatusesInfo($accountMigrationStatusesInfo);
139-
140-
foreach ($accountMigrationStatusesInfo->MigrationStatusInfo->MigrationStatusInfo as $migrationStatusInfo)
141-
{
142-
if (($migrationStatusInfo->Status == MigrationStatus::Completed) && ($GLOBALS['SitelinkMigration'] == $migrationStatusInfo->MigrationType))
143-
{
144-
$sitelinkMigrationIsCompleted = true;
145-
}
146-
}
147-
}
148-
100+
149101
// Specify one or more campaigns.
150102

151103
$campaigns = array();
@@ -282,21 +234,9 @@
282234
$encodedExtension = new SoapVar($extension, SOAP_ENC_OBJECT, 'StructuredSnippetAdExtension', $GLOBALS['CampaignProxy']->GetNamespace());
283235
$adExtensions[] = $encodedExtension;
284236

285-
// Before migration only the deprecated SiteLinksAdExtension type can be added,
286-
// and after migration only the new Sitelink2AdExtension type can be added.
287-
if($sitelinkMigrationIsCompleted)
237+
foreach(GetSampleSitelink2AdExtensions() as $encodedExtension)
288238
{
289-
foreach(GetSampleSitelink2AdExtensions() as $encodedExtension)
290-
{
291-
$adExtensions[] = $encodedExtension;
292-
}
293-
}
294-
else
295-
{
296-
foreach(GetSampleSiteLinksAdExtensions() as $encodedExtension)
297-
{
298-
$adExtensions[] = $encodedExtension;
299-
}
239+
$adExtensions[] = $encodedExtension;
300240
}
301241

302242
// Add all extensions to the account's ad extension library
@@ -324,11 +264,14 @@
324264

325265
for ($index = 0; $index < count($adExtensionIdentities->AdExtensionIdentity); $index++)
326266
{
327-
$adExtensionIdToEntityIdAssociations[$index] = new AdExtensionIdToEntityIdAssociation();
328-
$adExtensionIdToEntityIdAssociations[$index]->AdExtensionId = $adExtensionIdentities->AdExtensionIdentity[$index]->Id;;
329-
$adExtensionIdToEntityIdAssociations[$index]->EntityId = $nillableCampaignIds[0];
330-
331-
$adExtensionIds[$index] = $adExtensionIdentities->AdExtensionIdentity[$index]->Id;
267+
if(!empty($adExtensionIdentities->AdExtensionIdentity[$index]) && isset($adExtensionIdentities->AdExtensionIdentity[$index]->Id))
268+
{
269+
$adExtensionIdToEntityIdAssociations[$index] = new AdExtensionIdToEntityIdAssociation();
270+
$adExtensionIdToEntityIdAssociations[$index]->AdExtensionId = $adExtensionIdentities->AdExtensionIdentity[$index]->Id;;
271+
$adExtensionIdToEntityIdAssociations[$index]->EntityId = $nillableCampaignIds[0];
272+
273+
$adExtensionIds[$index] = $adExtensionIdentities->AdExtensionIdentity[$index]->Id;
274+
}
332275
};
333276

334277
// Associate the specified ad extensions with the respective campaigns or ad groups.
@@ -346,19 +289,16 @@
346289
$adExtensionIdToEntityIdAssociations,
347290
AssociationType::Campaign
348291
)->EditorialReasons;
349-
350-
// If migration has been completed, then you should request the Sitelink2AdExtension objects.
351-
// You can always request both types; however, before migration only the deprecated SiteLinksAdExtension
352-
// type will be returned, and after migration only the new Sitelink2AdExtension type will be returned.
292+
353293
$adExtensionsTypeFilter = array(
354-
$sitelinkMigrationIsCompleted ? AdExtensionsTypeFilter::Sitelink2AdExtension : AdExtensionsTypeFilter::SiteLinksAdExtension,
355294
AdExtensionsTypeFilter::AppAdExtension,
356295
AdExtensionsTypeFilter::CallAdExtension,
357296
AdExtensionsTypeFilter::CalloutAdExtension,
358297
AdExtensionsTypeFilter::ImageAdExtension,
359298
AdExtensionsTypeFilter::LocationAdExtension,
360299
AdExtensionsTypeFilter::ReviewAdExtension,
361-
AdExtensionsTypeFilter::StructuredSnippetAdExtension,
300+
AdExtensionsTypeFilter::Sitelink2AdExtension,
301+
AdExtensionsTypeFilter::StructuredSnippetAdExtension,
362302
);
363303

364304
// Get the specified ad extensions from the account'ss ad extension library.
@@ -579,68 +519,6 @@
579519
print $e->getTraceAsString()."\n\n";
580520
}
581521
}
582-
583-
function GetSampleSiteLinksAdExtensions()
584-
{
585-
$adExtensions = array();
586-
587-
$extension = new SiteLinksAdExtension();
588-
$extension->SiteLinks = array();
589-
590-
for ($index = 0; $index < 2; $index++)
591-
{
592-
$extension->SiteLinks[$index] = new SiteLink();
593-
$extension->SiteLinks[$index]->Description1 = "Simple & Transparent.";
594-
$extension->SiteLinks[$index]->Description2 = "No Upfront Cost.";
595-
$extension->SiteLinks[$index]->DisplayText = "Women's Shoe Sale " . ($index+1);
596-
597-
// Destination URLs are deprecated.
598-
// If you are currently using the Destination URL, you must upgrade to Final URLs.
599-
// Here is an example of a DestinationUrl you might have used previously.
600-
// $extension->SiteLinks[$index]->DestinationUrl = "http://www.contoso.com/womenshoesale/?season=spring&promocode=PROMO123";
601-
602-
// To migrate from DestinationUrl to FinalUrls, you can set DestinationUrl
603-
// to an empty string when updating the sitelink. If you are removing DestinationUrl,
604-
// then FinalUrls is required.
605-
// $extension->SiteLinks[$index]->DestinationUrl = "";
606-
607-
// With FinalUrls you can separate the tracking template, custom parameters, and
608-
// landing page URLs.
609-
610-
$extension->SiteLinks[$index]->FinalUrls = array();
611-
$extension->SiteLinks[$index]->FinalUrls[] = "http://www.contoso.com/womenshoesale";
612-
613-
// Final Mobile URLs can also be used if you want to direct the user to a different page
614-
// for mobile devices.
615-
$extension->SiteLinks[$index]->FinalMobileUrls = array();
616-
$extension->SiteLinks[$index]->FinalMobileUrls[] = "http://mobile.contoso.com/womenshoesale";
617-
618-
// You could use a tracking template which would override the campaign level
619-
// tracking template. Tracking templates defined for lower level entities
620-
// override those set for higher level entities.
621-
// In this example we are using the campaign level tracking template.
622-
$extension->SiteLinks[$index]->TrackingUrlTemplate = null;
623-
624-
// Set custom parameters that are specific to this sitelink,
625-
// and can be used by the sitelink, ad group, campaign, or account level tracking template.
626-
// In this example we are using the campaign level tracking template.
627-
$extension->SiteLinks[$index]->UrlCustomParameters = new CustomParameters();
628-
$extension->SiteLinks[$index]->UrlCustomParameters->Parameters = array();
629-
$customParameter1 = new CustomParameter();
630-
$customParameter1->Key = "promoCode";
631-
$customParameter1->Value = "PROMO" . ($index+1);
632-
$extension->SiteLinks[$index]->UrlCustomParameters->Parameters[] = $customParameter1;
633-
$customParameter2 = new CustomParameter();
634-
$customParameter2->Key = "season";
635-
$customParameter2->Value = "summer";
636-
$extension->SiteLinks[$index]->UrlCustomParameters->Parameters[] = $customParameter2;
637-
}
638-
639-
$encodedExtension = new SoapVar($extension, SOAP_ENC_OBJECT, 'SiteLinksAdExtension', $GLOBALS['CampaignProxy']->GetNamespace());
640-
$adExtensions[] = $encodedExtension;
641-
642-
return $adExtensions;
643-
}
644522

645523
function GetSampleSitelink2AdExtensions()
646524
{
@@ -701,7 +579,4 @@ function GetSampleSitelink2AdExtensions()
701579
return $adExtensions;
702580
}
703581

704-
705-
706-
707582
?>

samples/V11/KeywordsAds.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,7 @@
312312
if(isset($addAdsResponse->PartialErrors->BatchError)){
313313
CampaignManagementHelper::OutputPartialErrors($addAdsResponse->PartialErrors->BatchError);
314314
}
315-
316-
315+
317316

318317
// Here is a simple example that updates the campaign budget.
319318
// If the campaign has a shared budget you cannot update the Campaign budget amount,

src/Auth/ServiceClient.php

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@
99
use Microsoft\BingAds\V11\CustomerManagement\CustomerManagementServiceSettings as CustomerManagementServiceSettingsVersion11;
1010
use Microsoft\BingAds\V11\Reporting\ReportingServiceSettings as ReportingServiceSettingsVersion11;
1111

12-
use Microsoft\BingAds\V10\AdInsight\AdInsightServiceSettings as AdInsightServiceSettingsVersion10;
13-
use Microsoft\BingAds\V10\Bulk\BulkServiceSettings as BulkServiceSettingsVersion10;
14-
use Microsoft\BingAds\V10\CampaignManagement\CampaignManagementServiceSettings as CampaignManagementServiceSettingsVersion10;
15-
use Microsoft\BingAds\V9\CustomerBilling\CustomerBillingServiceSettings as CustomerBillingServiceSettingsVersion9;
16-
use Microsoft\BingAds\V9\CustomerManagement\CustomerManagementServiceSettings as CustomerManagementServiceSettingsVersion9;
17-
use Microsoft\BingAds\V9\Reporting\ReportingServiceSettings as ReportingServiceSettingsVersion9;
18-
1912
use \DOMDocument;
2013
use \DOMXPath;
2114
use \SoapHeader;
@@ -44,14 +37,7 @@ class ServiceClient
4437
ServiceClientType::CampaignManagementVersion11 => CampaignManagementServiceSettingsVersion11::SandboxEndpoint,
4538
ServiceClientType::CustomerBillingVersion11 => CustomerBillingServiceSettingsVersion11::SandboxEndpoint,
4639
ServiceClientType::CustomerManagementVersion11 => CustomerManagementServiceSettingsVersion11::SandboxEndpoint,
47-
ServiceClientType::ReportingVersion11 => ReportingServiceSettingsVersion11::SandboxEndpoint,
48-
49-
ServiceClientType::AdInsightVersion10 => AdInsightServiceSettingsVersion10::SandboxEndpoint,
50-
ServiceClientType::BulkVersion10 => BulkServiceSettingsVersion10::SandboxEndpoint,
51-
ServiceClientType::CampaignManagementVersion10 => CampaignManagementServiceSettingsVersion10::SandboxEndpoint,
52-
ServiceClientType::CustomerBillingVersion9 => CustomerBillingServiceSettingsVersion9::SandboxEndpoint,
53-
ServiceClientType::CustomerManagementVersion9 => CustomerManagementServiceSettingsVersion9::SandboxEndpoint,
54-
ServiceClientType::ReportingVersion9 => ReportingServiceSettingsVersion9::SandboxEndpoint,
40+
ServiceClientType::ReportingVersion11 => ReportingServiceSettingsVersion11::SandboxEndpoint
5541
);
5642

5743
private $productionServiceClientEndpoints = array(
@@ -60,14 +46,7 @@ class ServiceClient
6046
ServiceClientType::CampaignManagementVersion11 => CampaignManagementServiceSettingsVersion11::ProductionEndpoint,
6147
ServiceClientType::CustomerBillingVersion11 => CustomerBillingServiceSettingsVersion11::ProductionEndpoint,
6248
ServiceClientType::CustomerManagementVersion11 => CustomerManagementServiceSettingsVersion11::ProductionEndpoint,
63-
ServiceClientType::ReportingVersion11 => ReportingServiceSettingsVersion11::ProductionEndpoint,
64-
65-
ServiceClientType::AdInsightVersion10 => AdInsightServiceSettingsVersion10::ProductionEndpoint,
66-
ServiceClientType::BulkVersion10 => BulkServiceSettingsVersion10::ProductionEndpoint,
67-
ServiceClientType::CampaignManagementVersion10 => CampaignManagementServiceSettingsVersion10::ProductionEndpoint,
68-
ServiceClientType::CustomerBillingVersion9 => CustomerBillingServiceSettingsVersion9::ProductionEndpoint,
69-
ServiceClientType::CustomerManagementVersion9 => CustomerManagementServiceSettingsVersion9::ProductionEndpoint,
70-
ServiceClientType::ReportingVersion9 => ReportingServiceSettingsVersion9::ProductionEndpoint,
49+
ServiceClientType::ReportingVersion11 => ReportingServiceSettingsVersion11::ProductionEndpoint
7150
);
7251

7352
private $serviceClientNamespaces = array(
@@ -76,14 +55,7 @@ class ServiceClient
7655
ServiceClientType::CampaignManagementVersion11 => CampaignManagementServiceSettingsVersion11::ServiceNamespace,
7756
ServiceClientType::CustomerBillingVersion11 => CustomerBillingServiceSettingsVersion11::ServiceNamespace,
7857
ServiceClientType::CustomerManagementVersion11 => CustomerManagementServiceSettingsVersion11::ServiceNamespace,
79-
ServiceClientType::ReportingVersion11 => ReportingServiceSettingsVersion11::ServiceNamespace,
80-
81-
ServiceClientType::AdInsightVersion10 => AdInsightServiceSettingsVersion10::ServiceNamespace,
82-
ServiceClientType::BulkVersion10 => BulkServiceSettingsVersion10::ServiceNamespace,
83-
ServiceClientType::CampaignManagementVersion10 => CampaignManagementServiceSettingsVersion10::ServiceNamespace,
84-
ServiceClientType::CustomerBillingVersion9 => CustomerBillingServiceSettingsVersion9::ServiceNamespace,
85-
ServiceClientType::CustomerManagementVersion9 => CustomerManagementServiceSettingsVersion9::ServiceNamespace,
86-
ServiceClientType::ReportingVersion9 => ReportingServiceSettingsVersion9::ServiceNamespace,
58+
ServiceClientType::ReportingVersion11 => ReportingServiceSettingsVersion11::ServiceNamespace
8759
);
8860

8961
/**

src/Auth/ServiceClientType.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,7 @@ final class ServiceClientType {
1212
const CampaignManagementVersion11 = 'CampaignManagementVersion11';
1313
const CustomerBillingVersion11 = 'CustomerBillingVersion11';
1414
const CustomerManagementVersion11 = 'CustomerManagementVersion11';
15-
const ReportingVersion11 = 'ReportingVersion11';
16-
17-
const AdInsightVersion10 = 'AdInsightVersion10';
18-
const BulkVersion10 = 'BulkVersion10';
19-
const CampaignManagementVersion10 = 'CampaignManagementVersion10';
20-
const CustomerBillingVersion9 = 'CustomerBillingVersion9';
21-
const CustomerManagementVersion9 = 'CustomerManagementVersion9';
22-
const ReportingVersion9 = 'ReportingVersion9';
23-
15+
const ReportingVersion11 = 'ReportingVersion11';
2416
}
2517

2618
?>

src/V10/AdInsight/AdApiError.php

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/V10/AdInsight/AdApiFaultDetail.php

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/V10/AdInsight/AdGroupBidLandscape.php

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)