I am using following code for generating
1- campaign budget info
1a- ad spend in dollars
1b- clicks
1d- click through percentage
1e- average cpc
Why I am getting null values
<?php
error_reporting(E_STRICT | E_ALL);

// You can set the include path to src directory or reference
// AdWordsUser.php directly via require_once.
// $path = '/path/to/aw_api_php_lib/src';
$path = dirname(__FILE__) . '/src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);

require_once 'src/Google/Api/Ads/AdWords/Lib/AdWordsUser.php';
//require_once 'src/Google/Api/Ads/Common/Lib/SoapClientFactory.php';

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

  // Log SOAP XML request and response.
  $user->LogDefaults();

  // Get the CampaignService.
  $campaignService = $user->GetCampaignService('v201101');
 // $campaignServ = $user->GetBulkMutateJobService('v201101');
  //$selector->ids = array($campaignId);
  // Create selector.
  $selector = new Selector();
 $selector->fields = array('Id', 'Name', 'Status', 'ServingStatus',
      'StartDate', 'EndDate', 'Amount');
  $selector->ordering = array(new OrderBy('StartDate', 'ASCENDING'));
  $selector->dateRange = new DateRange();
  /****************************************************
  /*Creating Date
  /*****************************************************/
    /* @var $max date */
  $min = mktime(0,0,0,date("m"),date("d")-1,date("Y"));
  $selector->dateRange->min = date("Ymd", $min);
  $selector->dateRange->max = date("Ymd");
// Get all campaigns.
  $page = $campaignService->get($selector);
  // Display campaigns.
  if (isset($page->entries)) {
      echo '<table border="1" class="Camp"><th>AdWords Campaign
Present</th><tr><td>Name</td><td>ID</td><td>Campaign Clicks</
td><td>Budget</td>
          <td>Start Date</td><td>End Date</td><td>Status</
td><td>Average CPC</td><td>Click through rate</td></tr>';
    foreach ($page->entries as $campaign) {
       print '<tr><td>' . $campaign->name . '</td><td>'
          . $campaign->id . '</td><td>'. $campaign->campaignStats-
>clicks.'</td><td>'.$campaign->budget->amount->microAmount
               .'</td><td>'.$campaign->startDate.'</td>
              <td>'.$campaign->endDate.'</td><td>'.$campaign-
>status.'</td><td>'.$campaign->campaignStats->Ctr.'</td><td>'.
$campaign->campaignStats->AverageCpc.'</td></tr>';
    }
    echo '</table><br>';
  } else {
    print "No campaigns were found Please craete ads to get the
details.\n";
  }
 } catch (Exception $e) {
  print $e->getMessage();
}
?>
what should I do to get some data please guide me where should I look
for sample code that could download the campaign data required.

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Reply via email to