BingAds / BingAds-PHP-SDK

Other
56 stars 46 forks source link

How to get the report of all the ad groups of a campaign #23

Closed elegos closed 7 years ago

elegos commented 7 years ago

Hello!

I'm trying to find out in the Bing Ads API docs which call (and how to configure it) in order to get the report of all the ad groups of a campaign for the given period of time.

May you please link me to the relative doc, or to create an example for me?

Thanks.

eric-urban commented 7 years ago

Hello @elegos -

Which report type are you interested in using e.g. here is an example for KeywordPerformanceReportRequest. The sample will download data for all campaigns in the account.

If you only want a specific campaign, set the corresponding scope e.g. the following changes to the GetKeywordPerformanceReportRequest example function:

$report->Scope = new AccountThroughAdGroupReportScope();
$report->Scope->AccountIds = null;
$report->Scope->AdGroups = null;
$scopes = array();
$campaignReportScope = new CampaignReportScope();
$campaignReportScope->AccountId = $accountId;
$campaignReportScope->CampaignId = CampaignIdGoesHere;
$scopes[] = $campaignReportScope;
$report->Scope->Campaigns = $scopes;

I hope this helps!

Also note that we are actively monitoring the Bing Ads API Development forum in case you have any other Bing Ads API questions.

Best regards, Eric

elegos commented 7 years ago

Thanks Eric :+1: