Skip to content
This repository has been archived by the owner on Dec 1, 2017. It is now read-only.

Latest commit

 

History

History
29 lines (18 loc) · 1.18 KB

README.md

File metadata and controls

29 lines (18 loc) · 1.18 KB

Bing Ads Reports

Installation

gem install bing-ads-reporting

Usage

Initialise service

service = BingAdsReporting::Service.new({developer_token: '', application_token: '', authentication_token: '', :account_id: '', customer_id: ''})

Create report and get it's ID

period = Datebox::Period.new('2013-07-01', '2013-07-03')
id = service.generate_report({report_type: 'KeywordPerformance',
                              report_format: 'Tsv',
                              aggregation: 'Daily',
                              aggregation_period: 'ReportAggregation::Daily',
                              columns: %w[AccountId AccountName CampaignId CampaignName AdGroupId AdGroupName KeywordId Keyword DestinationUrl DeliveredMatchType AverageCpc CurrentMaxCpc AdDistribution CurrencyCode Impressions Clicks Ctr CostPerConversion Spend AveragePosition TimePeriod CampaignStatus AdGroupStatus DeviceType]},
                             {period: period})

Get report URL for download by report ID if it's ready

service.report_url(id) if service.report_ready?(id)

or get its content by ID (also once ready)

service.report_body(id) if service.report_ready?(id)