I use a helper function to get the money too. public function moneyInDollars($money) { return number_format(($money / 1000000.00), 2); }
On Tuesday, July 12, 2016 at 6:52:03 AM UTC-7, Jay Desai wrote: > > I have setup the account with my mcc account and executed the examples > reporting code for campaign performance report for one of my customerclient > id. > > This is the code: > > <?php > > // Include the initialization file > require_once __DIR__ . '/examples/AdWords/Auth/init.php'; > require_once __DIR__. > '/src/Google/Api/Ads/AdWords/Util/v201601/ReportUtils.php'; > > > function DownloadCriteriaReportWithAwqlExample(AdWordsUser $user, > $filePath, > $reportFormat) { > // Optional: Set clientCustomerId to get reports of your child > accounts > $user->SetClientCustomerId('731-721-7585'); > > // Prepare a date range for the last week. Instead you can use > 'LAST_7_DAYS'. > // $dateRange = 'ALL_TIME'; > > // Create report query. > $reportQuery = 'SELECT CampaignName, Impressions, Clicks, Ctr, > AverageCpc, ' > . 'Cost, Date,Conversions,ConversionRate, > CostPerConversion,CampaignStatus FROM CAMPAIGN_PERFORMANCE_REPORT ' > . 'WHERE CampaignStatus = ENABLED DURING THIS_MONTH'; > > // Set additional options. > $options = array('version' => 'v201601'); > > > // Download report. > $reportUtils = new ReportUtils(); > $reportUtils->DownloadReportWithAwql($reportQuery, $filePath, $user, > $reportFormat, $options); > > printf("Report was downloaded to '%s'.\n", $filePath); > } > > > > > 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__) . '/report.csv'; > $reportFormat = 'CSV'; > > // Run the example. > DownloadCriteriaReportWithAwqlExample($user, $filePath, > $reportFormat); > } catch (Exception $e) { > printf("An error has occurred: %s\n", $e->getMessage()); > } > > // Don't run the example if the file is being included. > if (__FILE__ != realpath($_SERVER['PHP_SELF'])) { > return; > } > > I have executed this code and got the csv report where i have two fields > AverageCpc, and Cost. > > Both of these parameters must be rounded of or should be return in the > same format as we see in the google adwords campaigns dashboard. > > Here is the screenshot of how it looks i my csv file > > Avg.Cpc | Cost > 9788919 | 362190000 > > But when i validated with the adwords campaigns, it shows. > > Avg.Cpc | Cost > 9.7 | 36.21 > > Is there any problem with the code or i need to specify some extra > parameters for AvgCpc Value and Cost to format it properly ??? > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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/4f2b2a20-3acf-40cb-9dca-a323d2124b69%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.