Re: How to get CampaignStats in Adwords v201101 in C#

2011-04-08 Thread David Torres
Hi,

You need to request every statistical field required in the selector.fields 
to have campaignStats populated back to you, see 
http://code.google.com/apis/adwords/docs/reference/latest/CampaignService.CampaignStats.html
 so 
if you, for example, wants clicks you need to add it as Clicks in the 
selector fields.

Best,

-David Torres - AdWords API Team


-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en


How to get CampaignStats in Adwords v201101 in C#

2011-04-05 Thread sa...@cwm.co.il
Hi!

I am trying to get campaign and its stats in Adwords v201101.
I succeeded in getting the campaign :

AdWordsUser user = new AdWordsUser(_headers);//getting the headers to
the AdwordsUser

CampaignService cs =
(CampaignService)user.GetService(AdWordsService.v201101.CampaignService);
cs.User = user;
//adding the same details as in AdwordsUser
cs.RequestHeader = new RequestHeader();
cs.RequestHeader.developerToken = _headers[developerToken];
cs.RequestHeader.userAgent = _headers[userAgent];
cs.RequestHeader.authToken = _headers[authToken];
cs.RequestHeader.clientCustomerId = ClientCustomerId;

Selector selector = new Selector();
selector.fields = new string[] { Id, Name, Status};

DateRange daterange = new DateRange();
daterange.min = 20110301
daterange.max = 20110331;

selector.dateRange = daterange;

CampaignPage campaignPage = cs.get(selector); // getting CampaignPage
according to the selector

foreach (Campaign entry in campaignPage.entries)
{
lblEntries.Text += Id:  + entry.id + br/ +
Name:  + entry.name + br/ + Status  + entry.status + br/;

}



but i can`t select campaigns stats because there is no field for it
that i can write in :selector.fields ( because campaignStats is a non
selectable field)
according to this page :
http://code.google.com/apis/adwords/docs/reference/latest/CampaignService.Campaign.html#campaignStats
i need to use CampaignSelector.statsSelector
but it doesn`t work because the CampaignSelector doesn`t belong to
v201101 it belongs to v201008


Thanks





-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en