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.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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].
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/44946d96-9835-4d54-9309-b9b27148bc1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to