Skip to content

Commit 749e0f4

Browse files
committed
Updating examples for Upgraded URLs.
1 parent f073818 commit 749e0f4

17 files changed

Lines changed: 139 additions & 40 deletions

File tree

adwords_api/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
0.14.1:
2+
- Corrected the comments and settings regarding target_all in add_ad_groups
3+
examples.
4+
- Added new example for migrating to Upgraded URLs.
5+
- Updated examples to reference final URLs.
6+
17
0.14.0:
28
- Removed deprecated API version v201402.
39
- Removed support for returnMoneyInMicros header.

adwords_api/examples/v201406/advanced_operations/add_text_ad_with_upgraded_urls.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def add_text_ad_with_upgraded_urls(ad_group_id)
6262
# Specify a tracking URL for 3rd party tracking provider. You may specify
6363
# one at customer, campaign, ad group, ad, criterion, or feed item levels.
6464
:tracking_url_template => 'http://tracker.example.com/' +
65-
'?cid={_season}&promocode={_promocode}&u={lpurl}',
65+
'?season={_season}&promocode={_promocode}&u={lpurl}',
6666
:url_custom_parameters => tracking_url_parameters,
6767
# Specify a list of final URLs. This field cannot be set if :url field
6868
# is set. This may be specified at ad, criterion, and feed item levels.

adwords_api/examples/v201406/basic_operations/add_ad_groups.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,24 @@ def add_ad_groups(campaign_id)
5353
]
5454
},
5555
:settings => [
56-
# Targetting restriction settings - these setting only affect serving
56+
# Targeting restriction settings - these settings only affect serving
5757
# for the Display Network.
5858
{
5959
:xsi_type => 'TargetingSetting',
6060
:details => [
6161
# Restricting to serve ads that match your ad group placements.
62+
# This is equivalent to choosing "Target and bid" in the UI.
6263
{
6364
:xsi_type => 'TargetingSettingDetail',
6465
:criterion_type_group => 'PLACEMENT',
65-
:target_all => true
66+
:target_all => false
6667
},
67-
# Using your ad group verticals only for bidding.
68+
# Using your ad group verticals only for bidding. This is equivalent
69+
# to choosing "Bid only" in the UI.
6870
{
6971
:xsi_type => 'TargetingSettingDetail',
7072
:criterion_type_group => 'VERTICAL',
71-
:target_all => false
73+
:target_all => true
7274
}
7375
]
7476
}

adwords_api/examples/v201409/advanced_operations/add_ad_customizer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def add_ad_customizer(ad_group_ids)
203203
:headline => 'Luxury Cruise to {=CustomizerFeed.Name}',
204204
:description1 => 'Only {=CustomizerFeed.Price}',
205205
:description2 => 'Offer ends in {=countdown(CustomizerFeed.Date)}!',
206-
:url => 'http://www.example.com',
206+
:final_urls => ['http://www.example.com'],
207207
:display_url => 'www.example.com'
208208
}
209209

adwords_api/examples/v201409/advanced_operations/add_click_to_download_ad.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ def add_click_to_download_ad(ad_group_id)
7575
:xsi_type => 'TemplateAd',
7676
:name => 'Ad for demo game',
7777
:template_id => 353,
78-
:url =>
79-
'http://play.google.com/store/apps/details?id=com.example.demogame',
78+
:final_urls =>
79+
['http://play.google.com/store/apps/details?id=com.example.demogame'],
8080
:display_url => 'play.google.com',
8181
:template_elements => [ad_data]
8282
}
@@ -96,7 +96,7 @@ def add_click_to_download_ad(ad_group_id)
9696
if response and response[:value]
9797
response[:value].each do |ad|
9898
puts "Added new click-to-download ad to ad group ID %d with url '%s'." %
99-
[ad[:ad][:id], ad[:ad][:url]]
99+
[ad[:ad][:id], ad[:ad][:final_urls[0]]]
100100
end
101101
else
102102
raise StandardError, 'No ads were added.'

adwords_api/examples/v201409/advanced_operations/add_site_links.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,24 +60,24 @@ def add_site_links(campaign_id)
6060
# Attribute of type STRING.
6161
link_text_feed_attribute_id = feed[:attributes][0][:id]
6262
# Attribute of type URL.
63-
link_url_feed_attribute_id = feed[:attributes][1][:id]
63+
final_url_feed_attribute_id = feed[:attributes][1][:id]
6464
# Attribute of type STRING.
6565
line_1_feed_attribute_id = feed[:attributes][2][:id]
6666
#Attribute of type STRING.
6767
line_2_feed_attribute_id = feed[:attributes][3][:id]
6868
puts "Feed with name '%s' and ID %d was added with" %
6969
[feed[:name], feed[:id]]
70-
puts "\tText attribute ID %d and URL attribute ID %d " +
70+
puts "\tText attribute ID %d and Final URL attribute ID %d " +
7171
"and Line 1 attribute ID %d and Line 2 attribute ID %d." % [
7272
link_text_feed_attribute_id,
73-
link_url_feed_attribute_id,
73+
final_url_feed_attribute_id,
7474
line_1_feed_attribute_id,
7575
line_2_feed_attribute_id
7676
]
7777

7878
sitelinks_data[:feed_id] = feed[:id]
7979
sitelinks_data[:link_text_feed_id] = link_text_feed_attribute_id
80-
sitelinks_data[:link_url_feed_id] = link_url_feed_attribute_id
80+
sitelinks_data[:final_url_feed_id] = final_url_feed_attribute_id
8181
sitelinks_data[:line_1_feed_id] = line_1_feed_attribute_id
8282
sitelinks_data[:line_2_feed_id] = line_2_feed_attribute_id
8383
else
@@ -133,7 +133,7 @@ def add_site_links(campaign_id)
133133
:string_value => item[:text]
134134
},
135135
{
136-
:feed_attribute_id => sitelinks_data[:link_url_feed_id],
136+
:feed_attribute_id => sitelinks_data[:final_url_feed_id],
137137
:string_value => item[:url]
138138
},
139139
{
@@ -173,8 +173,8 @@ def add_site_links(campaign_id)
173173
:field_id => PLACEHOLDER_FIELD_SITELINK_LINK_TEXT
174174
},
175175
{
176-
:feed_attribute_id => sitelinks_data[:link_url_feed_id],
177-
:field_id => PLACEHOLDER_FIELD_SITELINK_LINK_URL
176+
:feed_attribute_id => sitelinks_data[:final_url_feed_id],
177+
:field_id => PLACEHOLDER_FIELD_SITELINK_FINAL_URL
178178
},
179179
{
180180
:feed_attribute_id => sitelinks_data[:line_1_feed_id],
@@ -271,7 +271,7 @@ def add_site_links(campaign_id)
271271
# https://developers.google.com/adwords/api/docs/appendix/placeholders
272272
PLACEHOLDER_SITELINKS = 1
273273
PLACEHOLDER_FIELD_SITELINK_LINK_TEXT = 1
274-
PLACEHOLDER_FIELD_SITELINK_LINK_URL = 2
274+
PLACEHOLDER_FIELD_SITELINK_FINAL_URL = 5
275275
PLACEHOLDER_FIELD_SITELINK_LINE_1_TEXT = 3
276276
PLACEHOLDER_FIELD_SITELINK_LINE_2_TEXT = 4
277277

adwords_api/examples/v201409/advanced_operations/add_text_ad_with_upgraded_urls.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
# See the License for the specific language governing permissions and
1919
# limitations under the License.
2020
#
21-
# This example adds a text ad that uses upgraded URLs. This example will only
22-
# work if your account is a test account or is whitelisted for this feature.
21+
# This code example adds a text ad that uses advanced features of upgraded
22+
# URLs.
2323
#
2424
# Tags: AdGroupAdService.mutate
2525

@@ -62,7 +62,7 @@ def add_text_ad_with_upgraded_urls(ad_group_id)
6262
# Specify a tracking URL for 3rd party tracking provider. You may specify
6363
# one at customer, campaign, ad group, ad, criterion, or feed item levels.
6464
:tracking_url_template => 'http://tracker.example.com/' +
65-
'?cid={_season}&promocode={_promocode}&u={lpurl}',
65+
'?season={_season}&promocode={_promocode}&u={lpurl}',
6666
:url_custom_parameters => tracking_url_parameters,
6767
# Specify a list of final URLs. This field cannot be set if :url field
6868
# is set. This may be specified at ad, criterion, and feed item levels.

adwords_api/examples/v201409/basic_operations/add_ad_groups.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,24 @@ def add_ad_groups(campaign_id)
5353
]
5454
},
5555
:settings => [
56-
# Targetting restriction settings - these setting only affect serving
56+
# Targeting restriction settings - these settings only affect serving
5757
# for the Display Network.
5858
{
5959
:xsi_type => 'TargetingSetting',
6060
:details => [
6161
# Restricting to serve ads that match your ad group placements.
62+
# This is equivalent to choosing "Target and bid" in the UI.
6263
{
6364
:xsi_type => 'TargetingSettingDetail',
6465
:criterion_type_group => 'PLACEMENT',
65-
:target_all => true
66+
:target_all => false
6667
},
67-
# Using your ad group verticals only for bidding.
68+
# Using your ad group verticals only for bidding. This is equivalent
69+
# to choosing "Bid only" in the UI.
6870
{
6971
:xsi_type => 'TargetingSettingDetail',
7072
:criterion_type_group => 'VERTICAL',
71-
:target_all => false
73+
:target_all => true
7274
}
7375
]
7476
}

adwords_api/examples/v201409/basic_operations/add_keywords.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def add_keywords(ad_group_id)
5151
},
5252
# Optional fields:
5353
:user_status => 'PAUSED',
54-
:destination_url => 'http://example.com/mars'
54+
:final_urls => ['http://example.com/mars']
5555
},
5656
{:xsi_type => 'BiddableAdGroupCriterion',
5757
:ad_group_id => ad_group_id,

adwords_api/examples/v201409/basic_operations/add_text_ads.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ def add_text_ads(ad_group_id)
4646
:headline => 'Luxury Cruise to Mars',
4747
:description1 => 'Visit the Red Planet in style.',
4848
:description2 => 'Low-gravity fun for everyone!',
49-
:url => 'http://www.example.com',
49+
:final_urls => ['http://www.example.com'],
5050
:display_url => 'www.example.com'
5151
},
5252
{
5353
:xsi_type => 'TextAd',
5454
:headline => 'Luxury Cruise to Mars',
5555
:description1 => 'Enjoy your stay at Red Planet.',
5656
:description2 => 'Buy your tickets now!',
57-
:url => 'http://www.example.com',
57+
:final_urls => ['http://www.example.com'],
5858
:display_url => 'www.example.com'
5959
}
6060
]

0 commit comments

Comments
 (0)