Problem in getting Campain's Clicks / Cost when status is Active

76 views
Skip to first unread message

Vaios Panourgias

unread,
May 12, 2014, 4:03:40 PM5/12/14
to adwor...@googlegroups.com

  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);

                  ...............................................................
                      ...............................................................
                         ...............................................................

Josh Radcliff (AdWords API Team)

unread,
May 14, 2014, 1:37:41 PM5/14/14
to adwor...@googlegroups.com
Hi,

I may be asking a silly question, but are you sure that the active campaigns actually have clicks (and therefore cost)?

If that's not the issue, could you send some sample campaign IDs only to me by clicking Reply to Author?

Thanks,
Josh, AdWords API Team

Josh Radcliff (AdWords API Team)

unread,
May 19, 2014, 11:02:40 AM5/19/14
to adwor...@googlegroups.com
Hi,

The campaign you mentioned in your email to me is a Dynamic Search Ads (DSA) campaign, so I would recommend one of the DSA-specific reports:
The Criteria Performance Report doesn't make much sense for DSAs because that report lets you tie your impressions back to specific AdGroupCriterion on your ad groups, but DSA ads often don't have AdGroupCriteria, so there's nothing to assign each impression to in the Criteria Performance Report.

Note that you can still use campaign, ad group, or ad-level reports such as the Campaign Performance ReportAd Group Performance Report and Ad Performance Report for your DSA campaigns.

Best regards,
Josh, AdWords API Team

Vaios Panourgias

unread,
May 19, 2014, 11:19:52 AM5/19/14
to adwor...@googlegroups.com
Thank you very much for your time.

I'll try everything you suggest and i will let you know!
Reply all
Reply to author
Forward
0 new messages