Hello guys and girls!

I'm a newbie at the whole API thing and I'm a bit stuck at the part
where I should retreive the keywords or adgroups for the
campaignStats.

Here is the code:

$zacDat1 = $_POST['zacDat'];
$koncDat1 = $_POST['koncDat'];

$zacDat = str_replace("/", "", $zacDat1);
$koncDat = str_replace("/", "", $koncDat1);

//echo $zacDat . " in " . $koncDat;


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();

  $campaignService = $user->GetCampaignService('v200909');
  $today =  date('Y-m-d');

  $start_date = $zacDat;
  $end_date = $koncDat;



  $selector = new CampaignSelector();
  $selector->ids = array($campaignId);
  $page = $campaignService->get($selector);


  $statsSelector = new StatsSelector();
  $dateRange = new DateRange();
  $dateRange->min = $start_date;
  $dateRange->max = $end_date;
  $statsSelector->dateRange = $dateRange;
  $selector->statsSelector = $statsSelector;


  $page = $campaignService->get($selector);


 if (isset($page->entries)) {
    foreach ($page->entries as $campaign) {
        echo 'Campaign ID:' . $campaign->id . ' Campaign name:' .
$campaign->name .' Campaign startdate:"' . $campaign-
>startDate."<br>";

        echo 'Campaign Clicks:' . $campaign->stats->clicks ."<br>";  //
this is empty at present
        //echo 'Campaign Keywords:' . $campaign->stats-> ."<br>"; ???
                echo 'Campaign Impressions:' . $campaign->stats-
>impressions ."<br>";  //this is empty at present
        echo 'Campaign CTR:' . (($campaign->stats-
>ctr)*100) ."%<br><br>";  //this is empty at present
        }
}


I get the clicks, the impressions, ctr, everything, but I don't know
how to get also the adgroups or keywords.

Hope you can point me in the right direction or give me some code
examples. ;)

Thanks!

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 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

Reply via email to