I am using https://github.com/googleads/google-api-ads-ruby/ gem for using
adwords api for OfflineConversionFeedService. Code looks alright:
module AdwordsHelperdef mark_conversion_in_ads(customer)begin
config_filename = File.join(Rails.root, 'config', 'adwords_api.yml')
adwords = AdwordsApi::Api.new(config_filename)
conversion_feed_srv =
adwords.service(:OfflineConversionFeedService, :v201702)
conversion_time = Time.new.strftime("%Y%m%d %H%M%S")
conversion_value = '100'.to_f
feed = {
:google_click_id => customer.gclid,
:conversion_name => 'LeadCreatedAll',
:conversion_time => conversion_time,
:conversion_value => conversion_value,
:conversion_currency_code => 'GBP'
}
return_feeds = conversion_feed_srv.mutate([
{:operator => 'ADD', :operand
=> feed}])
return_feeds[:value].each do |return_feed|
puts ("Uploaded offline conversion value %.2f for Google Click ID '%s', " +
'to %s') % [return_feed[:conversion_value],
return_feed[:google_click_id],
return_feed[:conversion_name]]
end
rescue AdwordsApi::Errors::ApiException => e
puts e.backtrace
Logger.log_message("Exception occurred: %s\n%s" % [e.to_s, e.message])rescue
AdsCommon::Errors::OAuth2VerificationRequired => e
puts "Authorization credentials are not valid. Edit adwords_api.yml for " +
"OAuth2 client ID and secret and run misc/setup_oauth2.rb example " +
"to retrieve and store OAuth2 tokens."
puts "See this wiki page for more details:\n\n " +
'https://github.com/googleads/google-api-ads-ruby/wiki/OAuth2'
# HTTP errors.rescue AdsCommon::Errors::HttpError => e
puts "HTTP Error: %s" % e
# API errors.rescue AdwordsApi::Errors::ApiException => e
puts "Message: %s" % e.message
puts 'Errors:'
e.errors.each_with_index do |error, index|
puts "\tError [%d]:" % (index + 1)
error.each do |field, value|
puts "\t\t%s: %s" % [field, value]
end
endend
end
end
My adwords_api.yml file is:
---:authentication::method: OAUTH2_SERVICE_ACCOUNT:oauth2_keyfile:
"/path/to_server_account_file/jsonkey.json":developer_token:
test_level_developer_token_of_production_manager_account:client_customer_id:
client_customer_id_of_test_manager_account:oauth2_token:
:access_token: access_token_generated_setup_oauth.rb
:issued_at: 2017-03-16 13:12:25.005441000 +05:30
:expires_in: 3600
:id_token:
:service:
:environment: PRODUCTION:connection:
:enable_gzip: false:library:
:log_level: INFO
I have been trying to test this setup for a long time and am getting this
error: Exception occurred: [AuthenticationError.NOT_ADS_USER @ ;
trigger:''] [AuthenticationError.NOT_ADS_USER @ ; trigger:'']
I have tried a lot of links: managing test accounts
<https://developers.google.com/adwords/api/docs/guides/accounts-overview#getting_started_with_test_accounts>
Can someone please provide exact steps on how to test it out. For some more
clarification, I have Test Account developer key in adwords.
Using adwords api v201702 The api I am trying to use is OfflineConversion
<https://developers.google.com/adwords/api/docs/reference/v201702/OfflineConversionFeedService.OfflineConversionFeedOperation>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/e478a53d-2a21-4d21-b210-71a55c0a38a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.