Hi all,
I'm building a Rails app that takes advantage of the get_keyword_ideas
method
(https://code.google.com/p/google-api-ads-ruby/source/browse/adwords_api/examples/v201306/optimization/get_keyword_ideas.rb)
built into the adwords_api Ruby gem.
I'm currently working through a test account, and I've hit a roadblock: if
I submit even a single request through the method as I've set it up, I get
a RateExceededError:
[RateExceededError <rateName=RequestsPerMinute, rateKey=new_qps,
rateScope=ACCOUNT, retryAfterSeconds=30>]
As you can probably guess, waiting 30 seconds and retrying doesn't do
anything. I suspect that the size of my request is somehow offending the
rate limit, but I'm not sure how to impose a limit on it (or if that's even
the problem).
For what it's worth, here's the method I'm calling:
def get_keyword_ideas(keyword_text)
targeting_idea_srv = create_adwords_api.service(:TargetingIdeaService,
get_api_version)
selector = {
:idea_type => 'KEYWORD',
:request_type => 'IDEAS',
:requested_attribute_types =>
['KEYWORD_TEXT', 'SEARCH_VOLUME',
'CATEGORY_PRODUCTS_AND_SERVICES'],
:search_parameters => [
{
:xsi_type => 'RelatedToQuerySearchParameter',
:queries => [keyword_text]
},
{
:xsi_type => 'LanguageSearchParameter',
:languages => [{:id => 1000}]
}
],
:paging => {
:start_index => 0,
# my attempt to limit size of the request as much as possible:
:number_results => 1
}
}
offset = 0
results = []
begin
page = targeting_idea_srv.get(selector)
results += page[:entries] if page and page[:entries]
offset += PAGE_SIZE
selector[:paging][:start_index] = offset
end while offset < page[:total_num_entries]
results.each do |result|
data = result[:data]
keyword = data['KEYWORD_TEXT'][:value]
puts "Found keyword with text '%s'" % keyword
products_and_services = data['CATEGORY_PRODUCTS_AND_SERVICES'][:value]
if products_and_services
puts "\tWith Products and Services categories: [%s]" %
products_and_services.join(', ')
end
average_monthly_searches = data['SEARCH_VOLUME'][:value]
if average_monthly_searches
puts "\tand average monthly search volume: %d" %
average_monthly_searches
end
end
puts "Total keywords related to '%s': %d." % [keyword_text,
results.length]
end
In my campaigns_controller file, I'm attempting to call the message as
simply as possible:
def keywords
render :text => get_keyword_ideas("whiskey")
end
Any help is sincerely appreciated.
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.