google-adwords-api 0.14.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTU0N2JkMzRmZjM1MmI4Nzc1ZTcyMTBjY2NjN2Y0ZTdhYjUzZjliNQ==
4
+ OTUyMDFjMzdlOGJkYmQxMjlkNzkwMjczNmM0Y2QwY2Q3YjA2MWMwNw==
5
5
  data.tar.gz: !binary |-
6
- NDM3YmM4YTJkYWUzYjk5NjQwYTE5OGQxZjUyYjc1OTIwMTAyMWIwYQ==
6
+ ODI5YmY2Mzc3YjYyNjk0ZDQwMzI5NjA4YWRmMTZhODc5OGIyZDAyZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MGNiMTBiNjlhMDZmZGQ5NmJjMjlmZWQ1NWViNmJlMjgzNWZjZjA1NGI1NjNh
10
- OTMwYmZhZDVkOWI2YmRjZGJkNjAwY2M4MWQ4NmM1ZDgyMjAwYWY4YjE0MzAw
11
- OWM0NjZjMmI0YTg2YzYwYWNmM2Q2YjNjYmE3YmYwZjMwMGU3Nzk=
9
+ NjEzMTUwZjQyNmJlMWFiMGJhYzZjZWU0MGRmYTkzMjJiMGMwZmViZjQxMDJk
10
+ NWJiYmVkZmU1ZjcyZjhhYjNhY2ZkY2UxMTJkNzUwNWEyYjIyOTE3YWQzMTRk
11
+ YjBhZTU5MjA2ZTMzNTEwZDkxNGY0NDA0NjVkMWRmZDUwNmQ0NzI=
12
12
  data.tar.gz: !binary |-
13
- NzIwNzQ5ZjdmNjI0OGIxOTVhYzY0YTI3Zjk1YmFhNzBhY2M0ZDEzNWI4MmU0
14
- MWIwMDFlYzc0ZTJlMDVkNDRhMzU5NDllOWY1M2U2M2Q4M2U3Y2MzYjNhODNi
15
- N2I5ZjA5ZDY1NGZjMjU0YTRhMTQ0MGVlYjkyNTRmYTE4YmRiYjQ=
13
+ NGMwZTdhZjA1MWY1ZDA3ZGM3N2ZmZjc2NTE2OWVmZjFmYzdkNDkyZWMwZTYw
14
+ YTY1ZDFkMzZlMDk3M2E0NWNmNjFhZDk5Y2M5M2YxNzEzY2ZjN2Q5YTlmMDk2
15
+ YThiNTMwYjg4MzhhOTViNWZkMDY0YjRlZTRkMjcwMTI0ZGI1NjM=
data/ChangeLog CHANGED
@@ -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
+
1
7
  0.14.0:
2
8
  - Removed deprecated API version v201402.
3
9
  - Removed support for returnMoneyInMicros header.
@@ -62,7 +62,7 @@ def add_text_ad_with_upgraded_urls(ad_group_id)
62
62
  # Specify a tracking URL for 3rd party tracking provider. You may specify
63
63
  # one at customer, campaign, ad group, ad, criterion, or feed item levels.
64
64
  :tracking_url_template => 'http://tracker.example.com/' +
65
- '?cid={_season}&promocode={_promocode}&u={lpurl}',
65
+ '?season={_season}&promocode={_promocode}&u={lpurl}',
66
66
  :url_custom_parameters => tracking_url_parameters,
67
67
  # Specify a list of final URLs. This field cannot be set if :url field
68
68
  # is set. This may be specified at ad, criterion, and feed item levels.
@@ -53,22 +53,24 @@ def add_ad_groups(campaign_id)
53
53
  ]
54
54
  },
55
55
  :settings => [
56
- # Targetting restriction settings - these setting only affect serving
56
+ # Targeting restriction settings - these settings only affect serving
57
57
  # for the Display Network.
58
58
  {
59
59
  :xsi_type => 'TargetingSetting',
60
60
  :details => [
61
61
  # Restricting to serve ads that match your ad group placements.
62
+ # This is equivalent to choosing "Target and bid" in the UI.
62
63
  {
63
64
  :xsi_type => 'TargetingSettingDetail',
64
65
  :criterion_type_group => 'PLACEMENT',
65
- :target_all => true
66
+ :target_all => false
66
67
  },
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.
68
70
  {
69
71
  :xsi_type => 'TargetingSettingDetail',
70
72
  :criterion_type_group => 'VERTICAL',
71
- :target_all => false
73
+ :target_all => true
72
74
  }
73
75
  ]
74
76
  }
@@ -203,7 +203,7 @@ def add_ad_customizer(ad_group_ids)
203
203
  :headline => 'Luxury Cruise to {=CustomizerFeed.Name}',
204
204
  :description1 => 'Only {=CustomizerFeed.Price}',
205
205
  :description2 => 'Offer ends in {=countdown(CustomizerFeed.Date)}!',
206
- :url => 'http://www.example.com',
206
+ :final_urls => ['http://www.example.com'],
207
207
  :display_url => 'www.example.com'
208
208
  }
209
209
 
@@ -75,8 +75,8 @@ def add_click_to_download_ad(ad_group_id)
75
75
  :xsi_type => 'TemplateAd',
76
76
  :name => 'Ad for demo game',
77
77
  :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'],
80
80
  :display_url => 'play.google.com',
81
81
  :template_elements => [ad_data]
82
82
  }
@@ -96,7 +96,7 @@ def add_click_to_download_ad(ad_group_id)
96
96
  if response and response[:value]
97
97
  response[:value].each do |ad|
98
98
  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]]]
100
100
  end
101
101
  else
102
102
  raise StandardError, 'No ads were added.'
@@ -60,24 +60,24 @@ def add_site_links(campaign_id)
60
60
  # Attribute of type STRING.
61
61
  link_text_feed_attribute_id = feed[:attributes][0][:id]
62
62
  # Attribute of type URL.
63
- link_url_feed_attribute_id = feed[:attributes][1][:id]
63
+ final_url_feed_attribute_id = feed[:attributes][1][:id]
64
64
  # Attribute of type STRING.
65
65
  line_1_feed_attribute_id = feed[:attributes][2][:id]
66
66
  #Attribute of type STRING.
67
67
  line_2_feed_attribute_id = feed[:attributes][3][:id]
68
68
  puts "Feed with name '%s' and ID %d was added with" %
69
69
  [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 " +
71
71
  "and Line 1 attribute ID %d and Line 2 attribute ID %d." % [
72
72
  link_text_feed_attribute_id,
73
- link_url_feed_attribute_id,
73
+ final_url_feed_attribute_id,
74
74
  line_1_feed_attribute_id,
75
75
  line_2_feed_attribute_id
76
76
  ]
77
77
 
78
78
  sitelinks_data[:feed_id] = feed[:id]
79
79
  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
81
81
  sitelinks_data[:line_1_feed_id] = line_1_feed_attribute_id
82
82
  sitelinks_data[:line_2_feed_id] = line_2_feed_attribute_id
83
83
  else
@@ -133,7 +133,7 @@ def add_site_links(campaign_id)
133
133
  :string_value => item[:text]
134
134
  },
135
135
  {
136
- :feed_attribute_id => sitelinks_data[:link_url_feed_id],
136
+ :feed_attribute_id => sitelinks_data[:final_url_feed_id],
137
137
  :string_value => item[:url]
138
138
  },
139
139
  {
@@ -173,8 +173,8 @@ def add_site_links(campaign_id)
173
173
  :field_id => PLACEHOLDER_FIELD_SITELINK_LINK_TEXT
174
174
  },
175
175
  {
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
178
178
  },
179
179
  {
180
180
  :feed_attribute_id => sitelinks_data[:line_1_feed_id],
@@ -271,7 +271,7 @@ if __FILE__ == $0
271
271
  # https://developers.google.com/adwords/api/docs/appendix/placeholders
272
272
  PLACEHOLDER_SITELINKS = 1
273
273
  PLACEHOLDER_FIELD_SITELINK_LINK_TEXT = 1
274
- PLACEHOLDER_FIELD_SITELINK_LINK_URL = 2
274
+ PLACEHOLDER_FIELD_SITELINK_FINAL_URL = 5
275
275
  PLACEHOLDER_FIELD_SITELINK_LINE_1_TEXT = 3
276
276
  PLACEHOLDER_FIELD_SITELINK_LINE_2_TEXT = 4
277
277
 
@@ -18,8 +18,8 @@
18
18
  # See the License for the specific language governing permissions and
19
19
  # limitations under the License.
20
20
  #
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.
23
23
  #
24
24
  # Tags: AdGroupAdService.mutate
25
25
 
@@ -62,7 +62,7 @@ def add_text_ad_with_upgraded_urls(ad_group_id)
62
62
  # Specify a tracking URL for 3rd party tracking provider. You may specify
63
63
  # one at customer, campaign, ad group, ad, criterion, or feed item levels.
64
64
  :tracking_url_template => 'http://tracker.example.com/' +
65
- '?cid={_season}&promocode={_promocode}&u={lpurl}',
65
+ '?season={_season}&promocode={_promocode}&u={lpurl}',
66
66
  :url_custom_parameters => tracking_url_parameters,
67
67
  # Specify a list of final URLs. This field cannot be set if :url field
68
68
  # is set. This may be specified at ad, criterion, and feed item levels.
@@ -53,22 +53,24 @@ def add_ad_groups(campaign_id)
53
53
  ]
54
54
  },
55
55
  :settings => [
56
- # Targetting restriction settings - these setting only affect serving
56
+ # Targeting restriction settings - these settings only affect serving
57
57
  # for the Display Network.
58
58
  {
59
59
  :xsi_type => 'TargetingSetting',
60
60
  :details => [
61
61
  # Restricting to serve ads that match your ad group placements.
62
+ # This is equivalent to choosing "Target and bid" in the UI.
62
63
  {
63
64
  :xsi_type => 'TargetingSettingDetail',
64
65
  :criterion_type_group => 'PLACEMENT',
65
- :target_all => true
66
+ :target_all => false
66
67
  },
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.
68
70
  {
69
71
  :xsi_type => 'TargetingSettingDetail',
70
72
  :criterion_type_group => 'VERTICAL',
71
- :target_all => false
73
+ :target_all => true
72
74
  }
73
75
  ]
74
76
  }
@@ -51,7 +51,7 @@ def add_keywords(ad_group_id)
51
51
  },
52
52
  # Optional fields:
53
53
  :user_status => 'PAUSED',
54
- :destination_url => 'http://example.com/mars'
54
+ :final_urls => ['http://example.com/mars']
55
55
  },
56
56
  {:xsi_type => 'BiddableAdGroupCriterion',
57
57
  :ad_group_id => ad_group_id,
@@ -46,7 +46,7 @@ def add_text_ads(ad_group_id)
46
46
  :headline => 'Luxury Cruise to Mars',
47
47
  :description1 => 'Visit the Red Planet in style.',
48
48
  :description2 => 'Low-gravity fun for everyone!',
49
- :url => 'http://www.example.com',
49
+ :final_urls => ['http://www.example.com'],
50
50
  :display_url => 'www.example.com'
51
51
  },
52
52
  {
@@ -54,7 +54,7 @@ def add_text_ads(ad_group_id)
54
54
  :headline => 'Luxury Cruise to Mars',
55
55
  :description1 => 'Enjoy your stay at Red Planet.',
56
56
  :description2 => 'Buy your tickets now!',
57
- :url => 'http://www.example.com',
57
+ :final_urls => ['http://www.example.com'],
58
58
  :display_url => 'www.example.com'
59
59
  }
60
60
  ]
@@ -50,7 +50,7 @@ def set_ad_parameters(ad_group_id, criterion_id)
50
50
  :headline => 'Luxury Mars Cruises',
51
51
  :description1 => 'Low-gravity fun for {param1:cheap}.',
52
52
  :description2 => 'Only {param2:a few} seats left!',
53
- :url => 'http://www.example.com',
53
+ :final_urls => ['http://www.example.com'],
54
54
  :display_url => 'www.example.com'
55
55
  }
56
56
  }
@@ -49,7 +49,7 @@ def validate_text_ad(ad_group_id)
49
49
  :headline => 'Luxury Cruise to Mars',
50
50
  :description1 => 'Visit the Red Planet in style.',
51
51
  :description2 => 'Low-gravity fun for everyone!',
52
- :url => 'http://www.example.com',
52
+ :final_urls => ['http://www.example.com'],
53
53
  :display_url => 'www.example.com'
54
54
  }
55
55
  }
@@ -50,7 +50,7 @@ def handle_policy_violation_error(ad_group_id)
50
50
  :headline => 'Mars Cruise!!!',
51
51
  :description1 => 'Visit the Red Planet in style.',
52
52
  :description2 => 'Low-gravity fun for everyone!',
53
- :url => 'http://www.example.com',
53
+ :final_urls => ['http://www.example.com'],
54
54
  :display_url => 'www.example.com',
55
55
  }
56
56
  }
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env ruby
2
+ # Encoding: utf-8
3
+ #
4
+ # Author:: api.mcloonan@gmail.com (Michael Cloonan)
5
+ #
6
+ # Copyright:: Copyright 2015, Google Inc. All Rights Reserved.
7
+ #
8
+ # License:: Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17
+ # implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ #
21
+ # This code example upgrades an ad to use upgraded URLs.
22
+ #
23
+ # Tags: AdGroupAdService.get, AdGroupAdService.upgradeUrl
24
+
25
+ require 'adwords_api'
26
+
27
+ def upgrade_ad_url(ad_group_id, ad_id)
28
+ # AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
29
+ # when called without parameters.
30
+ adwords = AdwordsApi::Api.new
31
+
32
+ # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
33
+ # the configuration file or provide your own logger:
34
+ # adwords.logger = Logger.new('adwords_xml.log')
35
+
36
+ ad_group_ad_srv = adwords.service(:AdGroupAdService, API_VERSION)
37
+
38
+ selector = {
39
+ :fields => ['Id', 'Url'],
40
+ :predicates => [
41
+ {:field => 'AdGroupId', :operator => 'EQUALS', :values => [ad_group_id]},
42
+ {:field => 'Id', :operator => 'EQUALS', :values => [ad_id]}
43
+ ]
44
+ }
45
+
46
+ page = ad_group_ad_srv.get(selector)
47
+ ad_group_ad = page[:entries][0] if page[:entries]
48
+
49
+ raise StandardError, "Ad not found." if ad_group_ad.nil?
50
+
51
+ ad_url_upgrade = {
52
+ :ad_id => ad_group_ad[:ad][:id],
53
+ :final_url => ad_group_ad[:ad][:url]
54
+ }
55
+
56
+ response = ad_group_ad_srv.upgrade_url([ad_url_upgrade])
57
+ if response
58
+ ad_group_ad = response.first
59
+ puts "Ad with ID %d and destination url '%s' was upgraded." %
60
+ [ad_group_ad[:id], ad_group_ad[:final_urls].first]
61
+ else
62
+ raise StandardError, 'failed to upgrade ads.'
63
+ end
64
+ end
65
+
66
+ if __FILE__ == $0
67
+ API_VERSION = :v201409
68
+
69
+ begin
70
+ ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
71
+ ad_id = 'INSERT_AD_ID_HERE'.to_i
72
+ upgrade_ad_url(ad_group_id, ad_id)
73
+
74
+ # Authorization error.
75
+ rescue AdsCommon::Errors::OAuth2VerificationRequired => e
76
+ puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
77
+ "OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
78
+ "to retrieve and store OAuth2 tokens."
79
+ puts "See this wiki page for more details:\n\n " +
80
+ 'http://code.google.com/p/google-api-ads-ruby/wiki/OAuth2'
81
+
82
+ # HTTP errors.
83
+ rescue AdsCommon::Errors::HttpError => e
84
+ puts "HTTP Error: %s" % e
85
+
86
+ # API errors.
87
+ rescue AdwordsApi::Errors::ApiException => e
88
+ puts "Message: %s" % e.message
89
+ puts 'Errors:'
90
+ e.errors.each_with_index do |error, index|
91
+ puts "\tError [%d]:" % (index + 1)
92
+ error.each do |field, value|
93
+ puts "\t\t%s: %s" % [field, value]
94
+ end
95
+ end
96
+ end
97
+ end
@@ -38,7 +38,7 @@ def download_criteria_report(file_name)
38
38
  report_definition = {
39
39
  :selector => {
40
40
  :fields => ['CampaignId', 'AdGroupId', 'Id', 'Criteria', 'CriteriaType',
41
- 'Impressions', 'Clicks', 'Cost'],
41
+ 'FinalUrls', 'Impressions', 'Clicks', 'Cost'],
42
42
  # Predicates are optional.
43
43
  :predicates => {
44
44
  :field => 'Status',
@@ -250,14 +250,6 @@ module AdwordsApi
250
250
  @@subdir_config
251
251
  end
252
252
 
253
- def self.client_login_config(key)
254
- raise AdsCommon::Errors::AuthError,
255
- "ClientLogin is not supported. " +
256
- "Please use OAuth2 instead. See here for details:\n\t\t" +
257
- "https://developers.google.com/adwords/api/" +
258
- "docs/guides/authentication"
259
- end
260
-
261
253
  def self.default_config_filename
262
254
  DEFAULT_CONFIG_FILENAME
263
255
  end
@@ -21,6 +21,6 @@
21
21
 
22
22
  module AdwordsApi
23
23
  module ApiConfig
24
- CLIENT_LIB_VERSION = '0.14.0'
24
+ CLIENT_LIB_VERSION = '0.14.1'
25
25
  end
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-adwords-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danial Klimkin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-09 00:00:00.000000000 Z
12
+ date: 2015-02-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-ads-common
@@ -153,6 +153,7 @@ files:
153
153
  - examples/v201409/error_handling/handle_partial_failures.rb
154
154
  - examples/v201409/error_handling/handle_policy_violation_error.rb
155
155
  - examples/v201409/error_handling/handle_two_factor_authorization_error.rb
156
+ - examples/v201409/migration/upgrade_ad_url.rb
156
157
  - examples/v201409/misc/create_ad_words_session_without_properties_file.rb
157
158
  - examples/v201409/misc/get_all_images_and_videos.rb
158
159
  - examples/v201409/misc/setup_oauth2.rb