Account Performance Report and Labels

282 views
Skip to first unread message

David

unread,
Oct 16, 2014, 8:51:52 AM10/16/14
to adwor...@googlegroups.com
Hi guys,

I am having difficulty obtaining data for labels within an AdWords account. I can pull data from the Account Performance Report for other metrics and dimensions, such as by month or device but when I try to apply labels I get an error.

Some sample code is as follows:


        $requiredFields_ar = array("Labels", "Cost", "ConversionValue", "Clicks", "Impressions", "Conversions");
        getAccountPerformanceReport($clientCustomerId, $xmlFilePath, $requiredFields_ar, "CUSTOM_DATE", $dateFrom, $dateTo);


    //Get an account performance report for a given customer ID and time period.
    function getAccountPerformanceReport($clientCustomerId, $filePath, $requiredFields_ar, $timePeriod, $dateFrom = "false", $dateTo = "false") {
        $user = new AdWordsUser();
        $user->SetClientCustomerId($clientCustomerId);
       
        // Load the service, so that the required classes are available.
        $user->LoadService('ReportDefinitionService', "v201409");

        // Create selector.
        $selector = new Selector();
        $selector->fields = $requiredFields_ar;
       
        //If we have a custom date range, use it.
        if ($timePeriod == "CUSTOM_DATE") {
            $selector->dateRange = new DateRange($dateFrom, $dateTo);
        }

        // Create report definition.
        $reportDefinition = new ReportDefinition();
        $reportDefinition->selector = $selector;
        $reportDefinition->reportName = 'Criteria performance report #' . uniqid();
        $reportDefinition->dateRangeType = $timePeriod;
        $reportDefinition->reportType = 'ACCOUNT_PERFORMANCE_REPORT';
        $reportDefinition->downloadFormat = 'XML';

        // Set additional options.
        $options = array('version' => "v201409");

        // Download report.
        ReportUtils::DownloadReport($reportDefinition, $filePath, $user, $options);
    }

This code works without the "Labels" parameter in my requiredFields array and is the same code I use for pulling other data from the account performance report. But when I apply the Labels attribute I get an error:

 ReportDownloadException: Report download failed. Underlying errors are Type = 'ReportDefinitionError.INVALID_FIELD_NAME_FOR_REPORT', Trigger = 'Labels', FieldPath = ''. in C:\wamp\www\project\googleads\src\Google\Api\Ads\AdWords\Util\ReportUtils.php on line 194

The field name Labels isn't invalid because it is listed in the documentation in the same table that lists the other report fields I use.

I am basically trying to get the data under Dimensions > Labels > Labels - Campaign Type in the AdWords account. This is a list of labels and their metrics.

Any idea where I am going wrong? Spent two hours searching Google and I'm not finding much info because labels seem to be a relatively new addition to the API. I am coding in PHP.

Michael Cloonan (AdWords API Team)

unread,
Oct 16, 2014, 3:03:31 PM10/16/14
to adwor...@googlegroups.com
Hello,

The Account Performance Report does not support labels. Please see our Report Types guide for a complete list of columns this report supports.

This also makes sense, because labels cannot be applied to accounts specifically. Only fields which can have labels applied to them would make sense to have label-based options on their reports.

Regards,
Mike, AdWords API Team

David

unread,
Oct 17, 2014, 6:33:04 AM10/17/14
to adwor...@googlegroups.com
Hi Michael,

Thanks for your response.

Your reply makes sense. I'm sure I was looking at the account performance report when I used the labels yesterday, but I don't see it listed now so I must have scrolled past to a different report by accident. There's a lot of reports on that page so easy to get lost!

I did find what I'm looking for in the Campaign Performance report however.

Regards,

David.
Reply all
Reply to author
Forward
0 new messages