CodeSample1.
require 'adwords_api
...
def example1
@adwords_api = AdwordsApi::Api.new(Rails.configuration.adwords_auth)
kind_of_service = :CampaignService
@service = @adwords_api.service(kind_of_service, Rails.configuration.adwords_api_version)
selector = {:fields=>["Id", "Name", "Status"], :predicates=>[], :ordering=>[{:field=>"Name", :sort_order=>"ASCENDING"}], :paging=>{:start_index=>1, :number_results=>1}}
@service.get(selector)
end
end
Other values for :kind_of_service may include
:AdGroupAdService
:AdGroupCriterionService
:AdGroupService
AdwordsUserListService
There are also multiple patterns for selector.
Question2.
There is a section that uses download_report.
I would like to know how to reproduce this with AdsAPI.
The report_definition is an example of what is expected.
def example2
adwords_api = AdwordsApi::Api.new(Rails.configuration.adwords_auth)
...
reporter = adwords_api.report_utils(Rails.configuration.adwords_api_version)
report_definition = {:selector=>{:fields=>["Date", "CampaignId", "AdGroupId", "Id", "CriterionId", "Device", "AdType", "Cost", "Impressions", "Clicks", "Conversions", "AveragePosition"], :date_range=>{:min=>"20221025", :max=>"20221025"}},
:report_name=>"AD_PERFORMANCE_REPORT",
:report_type=>"AD_PERFORMANCE_REPORT",
:date_range_type=>"CUSTOM_DATE",
:download_format=>"TSV"}
raw_report = reporter.download_report(report_definition)
end
|
||||||