How can I get client ids

62 просмотра
Перейти к первому непрочитанному сообщению

Dymytry

не прочитано,
7 апр. 2011 г., 03:23:5407.04.2011
– AdWords API Forum
Greetings folks!

My current task is to collect the costs of the campaigns for some
defined date interval. I can succesfullt do it via the
CampaignService. But I have several clients, and thus I need to create
different AdWordsUser instances for each of them before using the
CampaignService. A problem is that I dont know the ids of the clients.
I know only their names. So can you suggest me:

How can I get a list of all client ids?

Actually, I dont need a special client to be reached. I need all the
data from all clients and campaigns. So may be its possible to run
this code without specifying the client id? I tryied omitting it, but
this resulted in "No campaigns found".

ps

A small addon: as far as I understand I can obtain the same data by
creating daily report via the web interface and downloading it daily.
Is this a better way? Is it cheaper? I have tryed to create such a
report but I failed to set a generation time for it. I dont understand
when it runs and its bad, because I need the data to be ready in the
morning..

I will appreciate any help and links, thanks!

Dymytry

не прочитано,
7 апр. 2011 г., 03:33:2807.04.2011
– AdWords API Forum
Here is the code I use:

// Get the CampaignService.
CampaignServiceInterface campaignService =

user.getService(AdWordsService.V201008.CAMPAIGN_SERVICE);

// Create selector.
CampaignSelector selector = new CampaignSelector();
StatsSelector statsSelector = new StatsSelector();
DateRange dateRange = new DateRange(); //YYYYMMDD
dateRange.setMin("20110401");
dateRange.setMax("20110404");
statsSelector.setDateRange(dateRange);
selector.setStatsSelector(statsSelector);

// Get all campaigns.
CampaignPage page = campaignService.get(selector);
if (page.getEntries() != null) {
for (Campaign campaign : page.getEntries()) {
CampaignStats campaignStats =
campaign.getCampaignStats();
Money money = campaignStats.getCost();
//save money somewhere
}
} else {
System.out.println("No campaigns were found.");
}

Eric Koleda

не прочитано,
11 апр. 2011 г., 16:49:3611.04.2011
– adwor...@googlegroups.com
Hi Dymytry,

The CampaignService can only operate on one client account at at time, and you'll need to set the clientEmail or clientCustomerId headers appropriately.  You can use the ServicedAccountService to determine which accounts exist under your MCC account.  It is also possible to get this information via reporting, and we plan to (re)launch cross-client reporting in v201101 very shortly, so stay tuned to the AdWords API blog.

Best,
- Eric Koleda, AdWords API Team

mher...@saveology.com

не прочитано,
25 апр. 2011 г., 15:33:1325.04.2011
– AdWords API Forum
@Eric

Sorry to ask using a previous post but this is exactly what I'm
looking for,

I'm new to the Google Adwords API, I've already tried the
ServicedAccountService from Apex in Salesforce but I'm only getting my
own MCC accountId, I can see all my clients when accessing through the
UI

Anash P. Oommen

не прочитано,
2 мая 2011 г., 02:28:4802.05.2011
– adwor...@googlegroups.com
Hi,

You could refer to http://code.google.com/p/google-api-adwords-php/source/browse/trunk/examples/v201101/GetAccountHierarchy.php to retrieve all the client accounts under an MCC.

Cheers,
Anash P. Oommen,
AdWords API Advisor.

mher...@saveology.com

не прочитано,
4 мая 2011 г., 11:14:5204.05.2011
– AdWords API Forum
Thanks,

For future reference the trouble was because I needed to add the
serviceTypes to my ServicedAccountSelector,

APEX
AccountSelector = new
GoogleAdwordsServicedAccMcmV2011.ServicedAccountSelector();
AccountSelector.serviceTypes = new String[]{'UI_AND_API',
'UNKNOWN'};
AccountSelector.submanagersOnly = false;

the code on the link doesn't work the same way when translated to APEX
in salesforce.com

PHP
// Create selector.
$selector = new ServicedAccountSelector();
// To get the links paging must be disabled.
$selector->enablePaging = false;

Maybe because the library does something when creating a new
ServicedAccountSelector() I'm not doing.
Ответить всем
Отправить сообщение автору
Переслать
0 новых сообщений