KEYWORDS_PERFORMANCE_REPORT Incorrect Data

2014-04-16 Thread lasha
Hello

I'm trying to get YESTERDAY's keyword performance data. When ever I use 
selector and specify campaigns I want to get data from it provides correct 
data. But when I remove selector and trying to get all yesterdays 
performance the data I receive is incorrect.

Any clue what can be wrong?


?php
/**
 * This example downloads a criteria report to a file.
 *
 * Copyright 2012, Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @packageGoogleApiAdsAdWords
 * @subpackage v201309
 * @category   WebServices
 * @copyright  2012, Google Inc. All Rights Reserved.
 * @licensehttp://www.apache.org/licenses/LICENSE-2.0 Apache License,
 * Version 2.0
 * @author Eric Koleda
 */

// Include the initialization file
require_once dirname(dirname(__FILE__)) . '/init.php';

require_once ADWORDS_UTIL_PATH . '/ReportUtils.php';

/**
 * Runs the example.
 * @param AdWordsUser $user the user to run the example with
 * @param string $filePath the path of the file to download the report to
 */
function DownloadCriteriaReportExample(AdWordsUser $user, $filePath) {
  // Load the service, so that the required classes are available.
  $user-LoadService('ReportDefinitionService', ADWORDS_VERSION);

  // Create selector.
  $selector = new Selector();
  $selector-fields = 
array('Id','CampaignId','AdGroupId','KeywordText','KeywordMatchType','Clicks','AveragePosition','Impressions','Cost','AverageCpc','Device','QualityScore','Status','MaxCpc','Date');

  // Filter out deleted criteria.
  
  //$selector-predicates[] = new Predicate('CampaignId', 'IN', 
array(164051439,164051319,164051559));

  // Create report definition.
  $reportDefinition = new ReportDefinition();
  $reportDefinition-selector = $selector;
  $reportDefinition-reportName = 'ACCOUNT #' . uniqid();
  $reportDefinition-dateRangeType = 'YESTERDAY';
  $reportDefinition-reportType = 'KEYWORDS_PERFORMANCE_REPORT';
  $reportDefinition-downloadFormat = 'XML';

  // Exclude criteria that haven't recieved any impressions over the date 
range.
  $reportDefinition-includeZeroImpressions = FALSE;

  // Set additional options.
  $options = array('version' = ADWORDS_VERSION, 'returnMoneyInMicros' = 
TRUE);

  // Download report.
  ReportUtils::DownloadReport($reportDefinition, $filePath, $user, 
$options);
  echo 'pre';
  print_r ($filePath);
  printf(Report with name '%s' was downloaded to '%s'.\n,
  $reportDefinition-reportName, $filePath);
}

// Don't run the example if the file is being included.
if (__FILE__ != realpath($_SERVER['PHP_SELF'])) {
  // return;
}

try {
  // Get AdWordsUser from credentials in ../auth.ini
  // relative to the AdWordsUser.php file's directory.
  $user = new AdWordsUser();

  // Log every SOAP XML request and response.
  // $user-LogAll();

  // Download the report to a file in the same directory as the example.
  $filePath = dirname(__FILE__) . '/keywords_yesterday.xml';

  // Run the example.
  DownloadCriteriaReportExample($user, $filePath);
} catch (Exception $e) {
  printf(An error has occurred: %s\n, $e-getMessage());
}

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: KEYWORDS_PERFORMANCE_REPORT Incorrect Data

2014-04-16 Thread lasha
Resolved. Problem was on my side.
Duplicate Keyword ID.

I was not aware that same keyword may have same ID in different ad groups.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.