Please ignore this : 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
For rest i am looking at you. On Tuesday, September 26, 2017 at 10:14:36 AM UTC+5:30, thedi...@gmail.com wrote: > > > 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/1af87542-0e39-451d-86d8-7e081a01876d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.