Hi,
i use 'google-api-php-client' with API VERSION '201309', to implement a
web application that will help me manage my campaigns. Everything works
great... i can get the titles of my Accounts/Campaigns/AdGroups, their
status, etc...
In terms of a campaign, I can also get information about it's Cost, or it's
total Clicks...
Unfortunately, this happens only for those campaigns whose status is
'Paused'. If the campaign i'm trying to get info about is 'Active', then
all i get is zero values.
Is there something i'm missing on this issue; Or maybe there is someone else
who has encountered this problem in the past; And if so, did he made it to
solve
it, and how?
Any help will be greatly appreciated.
Below i quote a portion of my code, relevant to the function ι mentioned.
Thanks in advance!
$campaignService = $user->GetService('CampaignService',
$adwords_version);
$selector = new Selector();
$selector->fields = array('Id', 'Name', 'Status', 'StartDate',
'EndDate', 'AdServingOptimizationStatus', 'Amount', 'BudgetName',
'TargetContentNetwork', 'Period');
$selector->predicates[] = new Predicate('Id','IN', array($campaignId));
$selector->paging = new Paging(0,
AdWordsConstants::RECOMMENDED_PAGE_SIZE);
do {
$page = $campaignService->get($selector);
if (isset($page->entries)) {
foreach ($page->entries as $campaign) {
if ($campaign->status!='DELETED')
{
$cstartdate=$campaign->startDate;
$user->LoadService('ReportDefinitionService',
$adwords_version);
$selector2 = new Selector();
$selector2->fields = array('CampaignId','Clicks',
'Cost','AverageCpc');
$selector2->predicates[] = new Predicate('CampaignId','IN',
array($campaign->id));
$reportDefinition = new ReportDefinition();
$reportDefinition->selector = $selector2;
$reportDefinition->reportName = 'Criteria performance
report #' . uniqid();
$reportDefinition->dateRangeType ='ALL_TIME';
$reportDefinition->reportType =
'CRITERIA_PERFORMANCE_REPORT';
$reportDefinition->downloadFormat = 'CSV';
$options = array('version' => $adwords_version,
'returnMoneyInMicros' => FALSE);
$filePathreport='./reports/campaignreport.txt';
ReportUtils::DownloadReport($reportDefinition,
$filePathreport, $user, $options);
...............................................................
...............................................................
...............................................................
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.