Skip to content

Commit d7d683f

Browse files
committed
Preparing src for release 6.4.0
1 parent fef163e commit d7d683f

File tree

216 files changed

+241943
-1251
lines changed

Some content is hidden

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

216 files changed

+241943
-1251
lines changed

ChangeLog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
### 6.4.0
2+
3+
AdWords:
4+
- Added support and examples for v201509.
5+
6+
Common:
7+
- Fixed [issue #96](https://github.com/googleads/googleads-php-lib/issues/96).
8+
19
### 6.3.0
210

311
DFP:

examples/AdWords/v201502/AccountManagement/CreateAccount.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?php
22
/**
3-
* This example creates a new account under an MCC account. Note: this example
4-
* must be run using the credentials of an MCC account, and by default the new
5-
* account will only be accessible via the parent MCC account.
3+
* This example creates a new account under an AdWords manager account. Note:
4+
* this example must be run using the credentials of an AdWords manager account,
5+
* and by default the new account will only be accessible via the parent AdWords
6+
* manager account.
67
*
78
* Restriction: adwords-only
89
*

examples/AdWords/v201502/AccountManagement/GetAccountHierarchy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* This example gets the account hierarchy under the current account. Note: this
4-
* example must be run using the credentials of an MCC account.
4+
* example must be run using the credentials of an AdWords manager account.
55
*
66
* Restriction: adwords-only
77
*

examples/AdWords/v201502/BasicOperations/UpdateKeyword.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ function UpdateKeywordExample(AdWordsUser $user, $adGroupId, $criterionId) {
6767

6868
// Display result.
6969
$adGroupCriterion = $result->value[0];
70-
printf("Keyword with ID '%s' has updated destination URL '%s'.\n",
71-
$adGroupCriterion->criterion->id, $adGroupCriterion->destinationUrl);
70+
printf("Keyword with ID '%s' has updated final URL '%s'.\n",
71+
$adGroupCriterion->criterion->id, $adGroupCriterion->finalUrls->urls[0]);
7272
}
7373

7474
// Don't run the example if the file is being included.

examples/AdWords/v201502/CampaignManagement/AddExperiment.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
require_once dirname(dirname(__FILE__)) . '/init.php';
3737

3838
// Enter parameters required by the code example.
39-
$campaignId = "INSERT_CAMPAIGN_ID_HERE";
40-
$adGroupId = "INSERT_AD_GROUP_ID_HERE";
39+
$campaignId = 'INSERT_CAMPAIGN_ID_HERE';
40+
$adGroupId = 'INSERT_AD_GROUP_ID_HERE';
4141

4242
/**
4343
* Runs the example.

examples/AdWords/v201502/Express/GetPromotions.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ function GetPromotionsExample(AdWordsUser $user, $businessId) {
4343

4444
// Create selector.
4545
$selector = new Selector();
46-
$selector->fields = array('PromotionId', 'Name');
46+
$selector->fields = array('PromotionId', 'Name', 'Status', 'DestinationUrl',
47+
'CallTrackingEnabled', 'Budget', 'PromotionCriteria', 'RemainingBudget',
48+
'Creatives', 'CampaignIds');
4749
$selector->ordering[] = new OrderBy('Name', 'ASCENDING');
4850

4951
// Create paging controls.

examples/AdWords/v201502/Extensions/AddGoogleMyBusinessLocationExtensions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ function AddGoogleMyBusinessLocationExtensions(
160160

161161
// OPTIONAL: Create a CampaignFeed to specify which FeedItems to use at the
162162
// Campaign level. This will be similar to the CampaignFeed in the
163-
// AddSiteLinks example, except you can also filter based on the business
163+
// AddSitelinks example, except you can also filter based on the business
164164
// name and category of each FeedItem by using a FeedAttributeOperand in
165165
// your matching function.
166166

examples/AdWords/v201502/Extensions/AddSitelinksUsingFeeds.php

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@
3939
* @param string $campaignId the ID of the campaign to add the sitelinks to
4040
*/
4141
function AddSitelinksUsingFeedsExample(AdWordsUser $user, $campaignId) {
42-
$sitelinksData = CreateSiteLinksFeed($user);
43-
$sitelinksData = CreateSiteLinksFeedItems($user, $sitelinksData);
44-
CreateSiteLinksFeedMapping($user, $sitelinksData);
45-
CreateSiteLinksCampaignFeed($user, $sitelinksData, $campaignId);
42+
$sitelinksData = CreateSitelinksFeed($user);
43+
$sitelinksData = CreateSitelinksFeedItems($user, $sitelinksData);
44+
CreateSitelinksFeedMapping($user, $sitelinksData);
45+
CreateSitelinksCampaignFeed($user, $sitelinksData, $campaignId);
4646
}
4747

4848
/**
4949
* Creates the feed that holds the sitelinks data.
5050
* @param AdWordsUser $user the user to run the example with
5151
*/
52-
function CreateSiteLinksFeed(AdWordsUser $user) {
52+
function CreateSitelinksFeed(AdWordsUser $user) {
5353
// Map that holds IDs associated to the feeds metadata.
5454
$sitelinksData = array();
5555

@@ -72,7 +72,7 @@ function CreateSiteLinksFeed(AdWordsUser $user) {
7272

7373
// Create the feed.
7474
$sitelinksFeed = new Feed();
75-
$sitelinksFeed->name = 'Feed For Site Links';
75+
$sitelinksFeed->name = 'Feed For Sitelinks';
7676
$sitelinksFeed->attributes = array($textAttribute, $finalUrlAttribute,
7777
$line1Attribute, $line2Attribute);
7878
$sitelinksFeed->origin = 'USER';
@@ -113,38 +113,39 @@ function CreateSiteLinksFeed(AdWordsUser $user) {
113113
* @param AdWordsUser $user the user to run the example with
114114
* @param map $sitelinksData IDs associated to created sitelinks feed metadata
115115
*/
116-
function CreateSiteLinksFeedItems(AdWordsUser $user, $sitelinksData) {
116+
function CreateSitelinksFeedItems(AdWordsUser $user, $sitelinksData) {
117117
// Get the FeedItemService, which loads the required classes.
118118
$feedItemService = $user->GetService('FeedItemService', ADWORDS_VERSION);
119119

120120
// Create operations to add FeedItems.
121-
$home = NewSiteLinkFeedItemAddOperation($sitelinksData, 'Home',
121+
$home = NewSitelinkFeedItemAddOperation($sitelinksData, 'Home',
122122
'http://www.example.com', 'Home line 1', 'Home line 2');
123-
$stores = NewSiteLinkFeedItemAddOperation($sitelinksData, 'Stores',
123+
$stores = NewSitelinkFeedItemAddOperation($sitelinksData, 'Stores',
124124
'http://www.example.com/stores', 'Stores line 1', 'Stores line 2');
125-
$onSale = NewSiteLinkFeedItemAddOperation($sitelinksData, 'On Sale',
125+
$onSale = NewSitelinkFeedItemAddOperation($sitelinksData, 'On Sale',
126126
'http://www.example.com/sale', 'On Sale line 1', 'On Sale line 2');
127-
$support = NewSiteLinkFeedItemAddOperation($sitelinksData, 'Support',
127+
$support = NewSitelinkFeedItemAddOperation($sitelinksData, 'Support',
128128
'http://www.example.com/support', 'Support line 1', 'Support line 2');
129-
$products = NewSiteLinkFeedItemAddOperation($sitelinksData, 'Products',
129+
$products = NewSitelinkFeedItemAddOperation($sitelinksData, 'Products',
130130
'http://www.example.com/products', 'Products line 1', 'Products line 2');
131-
$aboutUs = NewSiteLinkFeedItemAddOperation($sitelinksData, 'About Us',
131+
$aboutUs = NewSitelinkFeedItemAddOperation($sitelinksData, 'About Us',
132132
'http://www.example.com/about', 'About Us line 1', 'About Us line 2');
133133

134134
$operations = array($home, $stores, $onSale, $support, $products, $aboutUs);
135135

136136
$result = $feedItemService->mutate($operations);
137-
$sitelinksData['siteLinkFeedItemIds'] = array();
137+
$sitelinksData['sitelinkFeedItemIds'] = array();
138138

139139
foreach ($result->value as $feedItem) {
140140
printf("FeedItem with feedItemId %d was added.\n", $feedItem->feedItemId);
141-
$sitelinksData['siteLinkFeedItemIds'][] = $feedItem->feedItemId;
141+
$sitelinksData['sitelinkFeedItemIds'][] = $feedItem->feedItemId;
142142
}
143143

144144
return $sitelinksData;
145145
}
146146

147-
// See the Placeholder reference page for a list of all the placeholder types and fields.
147+
// See the Placeholder reference page for a list of all the placeholder types
148+
// and fields.
148149
// https://developers.google.com/adwords/api/docs/appendix/placeholders.html
149150
define('PLACEHOLDER_SITELINKS', 1);
150151
define('PLACEHOLDER_FIELD_SITELINK_LINK_TEXT', 1);
@@ -157,7 +158,7 @@ function CreateSiteLinksFeedItems(AdWordsUser $user, $sitelinksData) {
157158
* @param AdWordsUser $user the user to run the example with
158159
* @param map $sitelinksData IDs associated to created sitelinks feed metadata
159160
*/
160-
function CreateSiteLinksFeedMapping(AdWordsUser $user, $sitelinksData) {
161+
function CreateSitelinksFeedMapping(AdWordsUser $user, $sitelinksData) {
161162
// Get the FeedMappingService, which loads the required classes.
162163
$feedMappingService = $user->GetService('FeedMappingService',
163164
ADWORDS_VERSION);
@@ -208,19 +209,19 @@ function CreateSiteLinksFeedMapping(AdWordsUser $user, $sitelinksData) {
208209
* @param map $sitelinksData IDs associated to created sitelinks feed metadata
209210
* @param string $campaignId the ID of the campaign to add the sitelinks to
210211
*/
211-
function CreateSiteLinksCampaignFeed(AdWordsUser $user, $sitelinksData,
212+
function CreateSitelinksCampaignFeed(AdWordsUser $user, $sitelinksData,
212213
$campaignId) {
213214
// Get the CampaignFeedService, which loads the required classes.
214215
$campaignFeedService = $user->GetService('CampaignFeedService',
215216
ADWORDS_VERSION);
216217
$matchingFunctionString = sprintf(
217218
'AND( IN(FEED_ITEM_ID, {%s}), EQUALS(CONTEXT.DEVICE, "Mobile") )',
218-
implode(',', $sitelinksData['siteLinkFeedItemIds']));
219-
219+
implode(',', $sitelinksData['sitelinkFeedItemIds']));
220+
220221
$campaignFeed = new CampaignFeed();
221222
$campaignFeed->feedId = $sitelinksData['sitelinksFeedId'];
222223
$campaignFeed->campaignId = $campaignId;
223-
224+
224225
$matchingFunction = new FeedFunction();
225226
$matchingFunction->functionString = $matchingFunctionString;
226227
$campaignFeed->matchingFunction = $matchingFunction;
@@ -248,7 +249,7 @@ function CreateSiteLinksCampaignFeed(AdWordsUser $user, $sitelinksData,
248249
* @param string $text text of the sitelink
249250
* @param string $finalUrl URL of the sitelink
250251
*/
251-
function NewSiteLinkFeedItemAddOperation($sitelinksData, $text, $finalUrl,
252+
function NewSitelinkFeedItemAddOperation($sitelinksData, $text, $finalUrl,
252253
$line1, $line2) {
253254
// Create the FeedItemAttributeValues for our text values.
254255
$linkTextAttributeValue = new FeedItemAttributeValue();

examples/AdWords/v201502/Migration/MigrateToExtensionSettings.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
define('PLACEHOLDER_FIELD_FINAL_MOBILE_URLS', 6);
4949
define('PLACEHOLDER_FIELD_TRACKING_URL_TEMPLATE', 7);
5050

51-
class SiteLinkFromFeed {
51+
class SitelinkFromFeed {
5252
public $feedId;
5353
public $feedItemId;
5454
public $text;
@@ -74,7 +74,7 @@ function MigrateToExtensionSettingsExample(AdWordsUser $user) {
7474
$feeds = GetFeeds($user);
7575
foreach ($feeds as $feed) {
7676
// Retrieve all the sitelinks from the current feed.
77-
$feedItems = GetSiteLinksFromFeed($user, $feed->id);
77+
$feedItems = GetSitelinksFromFeed($user, $feed->id);
7878
printf("Loaded %d sitelinks for feed ID %d.\n",
7979
count($feedItems), $feed->id);
8080

@@ -171,9 +171,9 @@ function GetFeedMapping($user, $feedId, $placeholderTypeId) {
171171
return $attributeMappings;
172172
}
173173

174-
function GetSiteLinksFromFeed($user, $feedId) {
174+
function GetSitelinksFromFeed($user, $feedId) {
175175
printf("Processing feed ID %d...\n", $feedId);
176-
$siteLinks = array();
176+
$sitelinks = array();
177177

178178
// Retrieve all the feed items from the feed.
179179
$feedItems = GetFeedItems($user, $feedId);
@@ -184,7 +184,7 @@ function GetSiteLinksFromFeed($user, $feedId) {
184184

185185
foreach ($feedItems as $feedItem) {
186186
$sitelinkFromFeed =
187-
new SiteLinkFromFeed($feedItem->feedId, $feedItem->feedItemId);
187+
new SitelinkFromFeed($feedItem->feedId, $feedItem->feedItemId);
188188

189189
foreach ($feedItem->attributeValues as $attributeValue) {
190190
// This attribute hasn't been mapped to a field.
@@ -223,10 +223,10 @@ function GetSiteLinksFromFeed($user, $feedId) {
223223
}
224224
}
225225
$sitelinkFromFeed->scheduling = $feedItem->scheduling;
226-
$siteLinks[$feedItem->feedItemId] = $sitelinkFromFeed;
226+
$sitelinks[$feedItem->feedItemId] = $sitelinkFromFeed;
227227
}
228228
}
229-
return $siteLinks;
229+
return $sitelinks;
230230
}
231231

232232
function GetPlatformRestrictionsForCampaign($campaignFeed) {

examples/AdWords/v201502/Optimization/GetKeywordIdeas.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,12 @@ function GetKeywordIdeasExample(AdWordsUser $user) {
7979
$keyword = $data['KEYWORD_TEXT']->value;
8080
$search_volume = isset($data['SEARCH_VOLUME']->value)
8181
? $data['SEARCH_VOLUME']->value : 0;
82-
$categoryIds =
83-
implode(', ', $data['CATEGORY_PRODUCTS_AND_SERVICES']->value);
82+
if ($data['CATEGORY_PRODUCTS_AND_SERVICES']->value === null) {
83+
$categoryIds = '';
84+
} else {
85+
$categoryIds =
86+
implode(', ', $data['CATEGORY_PRODUCTS_AND_SERVICES']->value);
87+
}
8488
printf("Keyword idea with text '%s', category IDs (%s) and average "
8589
. "monthly search volume '%s' was found.\n",
8690
$keyword, $categoryIds, $search_volume);

0 commit comments

Comments
 (0)