Hi There,

Thank you for your advice.


Report section is the new challenge for me, I am following Google sample 
code  to get report. Sample code listed below:

*Issue* : Report is not generating, only blank file generating.
the blank file not have any file extension (CSV).
Dont know why it is printing "*Google\AdsApi\AdWords\AdWordsSession Object*" 
whole content with report setting 

*Google\AdsApi\AdWords\ReportSettings Object *in *runExample()*. even i did not 
print it.

I tried with active adwords accounts. but same issue with all AdWords 
account.
Also it also not printing the result of:
printf("Report with name '%s' was downloaded to '%s'.\n", $reportDefinition
->getReportName(), $filePath);




code Sample: 



public function main() {

        $refresh_token = 'YOUR REFRESH TOKEN';
      
        $oAuth2Credential = (new OAuth2TokenBuilder([
                
                ]))
                ->withClientId(Configure::read('GOOGLE_OAUTH_CLIENT_ID'))
                ->withClientSecret(Configure::read(
'GOOGLE_OAUTH_CLIENT_SECRET'))
                ->withRefreshToken($refresh_token)
                ->build();
        

        $session = (new AdWordsSessionBuilder())
                ->withUserAgent('YOUR USER AGENT')
                ->withDeveloperToken('YOUR DEVELOPER TOKEN')
                ->withOAuth2Credential($oAuth2Credential)
                ->build();

        $adwordsServices = new AdWordsServices();
        $customerService = $adwordsServices->get($session, CustomerService::
class);
        $customers = $customerService->getCustomers();
        $customer = $customers[0];

        printf("Found customer ID %d with time zone %s.\n", $customer->
getCustomerId(), $customer->getDateTimeZone());

        $filePath = sprintf(
                '%s.csv', tempnam('my_path', 'criteria-report-')
        );

        $this->runExample($session, $filePath);

       
    }

    public function runExample(AdWordsSession $session, $filePath) {
        // Create selector.
        $selector = new Selector();
        $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(
                'Criteria performance report #' . uniqid());
        $reportDefinition->setDateRangeType(
                ReportDefinitionDateRangeType::ALL_TIME);
        $reportDefinition->setReportType(
                ReportDefinitionReportType::CRITERIA_PERFORMANCE_REPORT);
        $reportDefinition->setDownloadFormat(DownloadFormat::CSV);

        // Download report.
        $reportDownloader = new ReportDownloader($session);
        $reportSettingsOverride = (new ReportSettingsBuilder())
                ->includeZeroImpressions(false)
                ->build();

 $reportDownloadResult = $reportDownloader->downloadReport(
                $reportDefinition, $reportSettingsOverride);
        $data = $reportDownloadResult->saveToFile($filePath);
       
        printf("Report with name '%s' was downloaded to '%s'.\n", 
$reportDefinition->getReportName(), $filePath);
    }


Please guide me in Right way.

thanks

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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.
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/7898756c-757d-4740-9838-0e96b9e4df75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • Report is not do... thedigifrog
    • Re: Report ... thedigifrog
      • Re: Rep... 'Vincent Racaza (AdWords API Team)' via AdWords API Forum
      • Re: Rep... 'Vincent Racaza (AdWords API Team)' via AdWords API Forum
        • Re:... thedigifrog
          • ... TheDigiFrog
            • ... 'Vincent Racaza (AdWords API Team)' via AdWords API Forum
              • ... thedigifrog
                • ... 'Vincent Racaza (AdWords API Team)' via AdWords API Forum
                • ... thedigifrog
                • ... thedigifrog

Reply via email to