Hi, Can you please make sure you are requesting the exactly same dateRange, predicates and fields for the UI and API again? If there is still a difference, please share the request and response soap xml logs and the stats from the UI.
FYI: I recommend to use AdHoc reports to retrieve stats, it take less time for the stats to be fixed and it can be filtered/segmented in a more flexible way. Best, - Takeshi, AdWords API Team On Monday, July 8, 2013 9:56:46 PM UTC+9, Daniel van der Ende wrote: > > Hi, > > I'm trying to read out statistics for our ads and adgroups using the PHP > API for Google Adwords. I'm having some trouble, however, getting the > correct values for impressions, clicks and cost. > I'm using the following code: > > $user->SetClientCustomerId($clientId); > $adService = $user->GetService("AdGroupAdService", ADWORDS_VERSION); > $selector = new Selector(); > $selector->fields = array("Id", "Name", "Clicks", "Impressions", "Cost"); > $selector->predicates[] = new Predicate("AdGroupId", "IN", > array($adGroupId)); > // DateRange is previously defined for another API call, which > returns the correct values. > $selector->dateRange = $dateRange; > $selector->paging = new Paging(0, AdWordsConstants::RECOMMENDED_PAGE_SIZE); > do { > // Make the get request. > $page = $adService->get($selector); > > if (isset($page->entries)) { > foreach ($page->entries as $ad) { > $newLineObject->adName = $ad->name; > $newLineObject->clicks = $ad->ad->AdStats->clicks; > $newLineObject->impressions = $ad->adStats->impressions; > $newLineObject->cost = $ad->ad->AdStats->cost->microAmount/ > AdWordsConstants::MICROS_PER_DOLLAR; > } > } > else { > print "No matching ads were found.\n"; > } > $selector->paging->startIndex += AdWordsConstants::RECOMMENDED_PAGE_SIZE; > > } while ($page->totalNumEntries > $selector->paging->startIndex); > > This obviously isn't the entire code, but other elements are not related > to the adwords api. When I print the values obtained, I'm getting vastly > different figures for impressions, clicks and cost than I can find in my > client center. For example, for a single ad in my client center I see 12000 > impressions, whereas the figure returned by the API indicates almost > 2000000 impressions. > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 --- 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. For more options, visit https://groups.google.com/groups/opt_out.