Hello, I use the code example provided on the google website, the following 
account
$ mcc = '945-959-2387';
$ account_id = '5911335188';

Cannot get GEO_PERFORMANCE_REPORT similar report data
Here is the relevant code:


<?php
/**
 * Copyright 2017 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.
 */

namespace Google\AdsApi\Examples\AdWords\v201809\Reporting;

// require __DIR__ . '/../../../../vendor/autoload.php';
require __DIR__ . '/../../../../../../autoload.php';

use Google\AdsApi\AdWords\AdWordsSession;
use Google\AdsApi\AdWords\AdWordsSessionBuilder;
use Google\AdsApi\AdWords\Reporting\v201809\DownloadFormat;
use Google\AdsApi\AdWords\Reporting\v201809\ReportDefinition;
use Google\AdsApi\AdWords\Reporting\v201809\ReportDefinitionDateRangeType;
use Google\AdsApi\AdWords\Reporting\v201809\ReportDownloader;
use Google\AdsApi\AdWords\ReportSettingsBuilder;
use Google\AdsApi\AdWords\v201809\cm\Predicate;
use Google\AdsApi\AdWords\v201809\cm\PredicateOperator;
use Google\AdsApi\AdWords\v201809\cm\ReportDefinitionReportType;
use Google\AdsApi\AdWords\v201809\cm\Selector;
use Google\AdsApi\Common\OAuth2TokenBuilder;

/**
 * Downloads CRITERIA_PERFORMANCE_REPORT for the specified client customer 
ID.
 */
class DownloadGeoPerformanceReportWithSelector
{

    public static function runExample(AdWordsSession $session, $filePath)
    {
        // Create selector.
        $selector = new Selector();

 
        $selector->setFields(
            ['Impressions', 'Clicks', 'Conversions', 'Cost', 'Date', 
'ExternalCustomerId', 'CountryCriteriaId','CampaignId']
        );

/*         
        $selector->setFields(
            [
                'CampaignId',
                'AdGroupId',
                'Id',
                'Criteria',
                'CriteriaType',
                'Impressions',
                'Clicks',
                'Cost'
            ]
        );
*/
        // Use a predicate to filter out paused criteria (this is optional).
/*        
        $selector->setPredicates(
            [
                new Predicate('Status', PredicateOperator::NOT_IN, 
['PAUSED'])
            ]
        );
*/
        // Create report definition.
        $reportDefinition = new ReportDefinition();
        $reportDefinition->setSelector($selector);
        $reportDefinition->setReportName(
            'Geo Performance Report #' . uniqid()
        );
        $reportDefinition->setDateRangeType(
            ReportDefinitionDateRangeType::LAST_7_DAYS
        );
        $reportDefinition->setReportType(
            ReportDefinitionReportType::GEO_PERFORMANCE_REPORT
        );
        $reportDefinition->setDownloadFormat(DownloadFormat::CSV);

        // Download report.
        $reportDownloader = new ReportDownloader($session);
        // Optional: If you need to adjust report settings just for this one
        // request, you can create and supply the settings override here. 
Otherwise,
        // default values from the configuration file (adsapi_php.ini) are 
used.
        $reportSettingsOverride = (new 
ReportSettingsBuilder())->includeZeroImpressions(false)->build();
        $reportDownloadResult = $reportDownloader->downloadReport(
            $reportDefinition,
            $reportSettingsOverride
        );
        $reportDownloadResult->saveToFile($filePath);
        printf(
            "Report with name '%s' was downloaded to '%s'.\n",
            $reportDefinition->getReportName(),
            $filePath
        );
    }

    public static function main()
    {

// $mcc = '237-147-9138';
// $account_id = '9901274003';

// 测试 geo 类别取不到数据问题 
// 该账号在 adwords_tracking_country 表里找不到成本数据
$mcc = '945-959-2387';
$account_id = '5911335188';  // geo 没数据  ,location 有数据  


$mccConfigPath = dirname(__FILE__) . '/adwauth.' . $mcc . '.ini';


        // Generate a refreshable OAuth2 credential for authentication.
        $oAuth2Credential = (new 
OAuth2TokenBuilder())->fromFile($mccConfigPath)->build();

        // See: AdWordsSessionBuilder for setting a client customer ID that 
is
        // different from that specified in your adsapi_php.ini file.
        // Construct an API session configured from a properties file and 
the
        // OAuth2 credentials above.
        $session = (new 
AdWordsSessionBuilder())->fromFile($mccConfigPath)->withOAuth2Credential($oAuth2Credential)->withClientCustomerId($account_id)->build();


        $filePath = sprintf(
            '%s.csv',
            tempnam(sys_get_temp_dir(), 'geo-performance-report-')
        );
        self::runExample($session, $filePath);
    }
}

DownloadGeoPerformanceReportWithSelector::main();



However, I can find the account_id = '5911335188' report data for this 
account on the https://ads.google.com/aw/reporting/reporteditor/ website.
What is the reason. 

Note: The same code, I can change the interface to get the $ account_id = 
'9929989200'; report data.




在 2019年7月26日星期五 UTC+8下午6:09:43,adsapiforumadvisor写道:
>
> Hi,
>
> Thank you for reaching out. Allow me to provide support for your concern.
>
> Firstly, if you come across a cell with two dashes 
> <https://developers.google.com/adwords/api/docs/guides/reporting#two_dashes> 
> under the location column, it means that the location was not triggered for 
> this particular campaign. This would also mean that this will not be 
> returned in the UI. If the API results show rows with the two dashes, these 
> rows will not appear in the UI and will also not be calculated in the Total 
> results. You can refer to the mapping guide 
> <https://developers.google.com/adwords/api/docs/guides/uireports#campaigns> 
> under "Campaign Location Target Report" to check the equivalent report of 
> the Campaign Location Target Report in the UI. 
>
> As for the issue with Geo Performance Report, this report does not support 
> Universal App Campaigns. Could you confirm if some of your accounts only 
> contain UAC data? If yes, this could be the reason on maybe some of your 
> accounts do no generate report data.
>
> We also do not recommend to compare different reports as each report is 
> generated on a different level.
>
> Let me know if you have further clarifications.
>  
> Regards,
> Dannison
> Google Ads API Team
>
> ref:_00D1U1174p._5001UEGTFN:ref

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads 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 and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/6899e5e8-bfb2-4472-a709-5d022731db37%40googlegroups.com.

Reply via email to