Wednesday, 27 July 2016

Undefined index : SEARCH_QUERY_PERFORMANCE_REPORT

Hi All, 

Am getting a type error for the following script- can you please advise on why I am getting a type error. Display Report works fine, but Search Report doesn't. Thanks in advance.

ERROR: Undefined index: type in /home/maurice/www/hc/vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/Util/XmlDeserializer.php on line 136

CODE:

   //Download Search Query Performance Report
            $this->user->LoadService('ReportDefinitionService', $this->adwords_version);
            $unique_id = uniqid();
            $reportDefinition = new ReportDefinition();
            $reportDefinition->reportName = 'Search Query Performance Report #' . $unique_id;
           // $reportDefinition->dateRangeType = 'CUSTOM_DATE';
            $reportDefinition->reportType = 'SEARCH_QUERY_PERFORMANCE_REPORT';
            $reportDefinition->downloadFormat = 'XML';
            $selector = new Selector();
            $selector->fields = array(
                    'AdGroupId',
                    'AdGroupName',
                    'Impressions',
                    'Clicks',
                    'Ctr'
            );
            $startDate = date("Ymd", strtotime("-31 days"));
            $endDate = date("Ymd", strtotime("-1 days"));
            $selector->dateRange = new DateRange($startDate, $endDate);
            $selector->predicates[] = new Predicate('Status', 'EQUALS', array('ENABLED'));
            $selector->predicates[] = new Predicate('AdGroupId', 'IN', array_keys($this->active_adGroups));
            $reportDefinition->selector = $selector;
            $fileName = 'search.xml';
            $path = $this->directory . $fileName;
            $options = array('version' => $this->adwords_version);
            //$result = ReportUtils::DownloadReport($reportDefinition, $path, $this->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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@googlegroups.com
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 adwords-api+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/8d3cbe4e-92f2-4545-9a79-feb887052662%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment