Hi Eric,
Thanks a ton for the response. It works as expected now.
For anyone who is having trouble with this, here is the code:
$newAdGroupCriteriaService = $user-
>GetAdGroupCriterionService('v200909');
$KIDSelector = new AdGroupCriterionSelector();
$idFilter = new AdGroupCriterionIdFilter();
$idFilter->adGroupId = $adGroupId;
$idFilter->criterionId = $KID;
$KIDSelector->idFilters = array($idFilter);
$KIDSelector->statsSelector = new statsSelector();
$KIDSelector->statsSelector->dateRange = new
DateRange($startDate,
$endDate);
$keywordResponse =
$newAdGroupCriteriaService->get($KIDSelector);
$keywordStats = $keywordResponse->entries[0]->stats;
print_r($keywordResponse->entries[0]->bids->maxCpc->amount-
>microAmount);
echo "<br><br/>";
print_r($keywordStats->clicks);
Regards
Prasad
On Mar 24, 11:31 pm, AdWords API Advisor
<[email protected]> wrote:
> Hi Prasad,
>
> The statsSelector needs to be set on the AdGroupCriterionSelector, not
> the service.
>
> http://code.google.com/apis/adwords/v2009/docs/reference/AdGroupCrite...
>
> Best,
> - Eric Koleda, AdWords API Team
>
> On Mar 23, 12:38 am, prasad darla <[email protected]> wrote:
>
> > Hi All,
>
> > We recently undertook changes to move to the v2009 API. We use the PHP
> > library. Most of our code has been modified and it works fine. I was
> > able to create and update new Campaign etc. I also got Campaignstats
> > using the new CampaignService. However I am unable to get the
> >criterionstatsas per the new API AdGroupCriterionService. I get
> > other information about the criteria including the text, its max bid
> > etc but the Criteriastatslike Impressions, Clicks are always empty.
>
> > Here is my code snippet:
>
> > <code>
> > $newAdGroupCriteriaService = $user->GetAdGroupCriterionService('v200909');
>
> > $newAdGroupCriteriaService->statsSelector = new statsSelector();
> > $newAdGroupCriteriaService->statsSelector->dateRange = new
> > DateRange($startDate,$endDate);
>
> > $KIDSelector = new AdGroupCriterionSelector();
> > // Create id filter.
> > $idFilter = new AdGroupCriterionIdFilter();
> > $idFilter->criterionId = $KID;
> > $KIDSelector->idFilters = array($idFilter);
>
> > $keywordStats = $newAdGroupCriteriaService->get($KIDSelector);
>
> > print_r($keywordStats);
> > </code>
>
> > The KeywordStats printed contains relevant information about the
> > Criteria but nostats. The stat objects startDate amd endDate fields
> > are always empty and so are thestats.
>
> > AdGroupCriterionPage Object ( [entries] => Array ( [0] =>
> > BiddableAdGroupCriterion Object ( [userStatus] => ACTIVE
> > [systemServingStatus] => ELIGIBLE [approvalStatus] => APPROVED
> > [destinationUrl] => [bids] => ManualCPCAdGroupCriterionBids Object
> > ( [maxCpc] => Bid Object ( [amount] => Money Object ( [microAmount] =>
> > 660000 [ComparableValueType] => Money [_parameterMap:private] => Array
> > ( [ComparableValue.Type] => ComparableValueType ) ) ) [bidSource] =>
> >CRITERION[positionPreferenceBids] => [AdGroupCriterionBidsType] =>
> > ManualCPCAdGroupCriterionBids [_parameterMap:private] => Array
> > ( [AdGroupCriterionBids.Type] => AdGroupCriterionBidsType ) )
> > [firstPageCpc] => Bid Object ( [amount] => Money Object
> > ( [microAmount] => 10000 [ComparableValueType] => Money
> > [_parameterMap:private] => Array ( [ComparableValue.Type] =>
> > ComparableValueType ) ) ) [qualityInfo] => QualityInfo Object
> > ( [isKeywordAdRelevanceAcceptable] => 1
> > [isLandingPageQualityAcceptable] => 1 [isLandingPageLatencyAcceptable]
> > => 1 [qualityScore] => 10 ) [stats] =>StatsObject ( [startDate] =>
> > [endDate] => [network] => SEARCH [clicks] => [impressions] => [cost]
> > => [averagePosition] => [averageCpc] => [averageCpm] => [ctr] =>
> > [conversions] => [conversionRate] => [costPerConversion] =>
> > [conversionsManyPerClick] => [conversionRateManyPerClick] =>
> > [costPerConversionManyPerClick] => [StatsType] =>Stats
> > [_parameterMap:private] => Array ( [Stats.Type] => StatsType ) )
> > [adGroupId] => 98347538458[criterion] => Keyword Object ( [text] => my
> > keyword text [matchType] => PHRASE [id] => 634776627363
> > [CriterionType] => Keyword [_parameterMap:private] => Array
> > ( [Criterion.Type] => CriterionType ) ) [AdGroupCriterionType] =>
> > BiddableAdGroupCriterion [_parameterMap:private] => Array
> > ( [AdGroupCriterion.Type] => AdGroupCriterionType ) ) )
> > [totalNumEntries] => 1 [PageType] => AdGroupCriterionPage
> > [_parameterMap:private] => Array ( [Page.Type] => PageType ) )
>
> > Can anyone throw any light on this? I think its mostly a problem with
> > the AdGroupCriterionService usage and hence I am posting the query
> > here. Please let me know if you need any other information.
>
> > Thanks in advance,
> > Prasad
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Have you migrated to v200909 yet?
The v13 sunset is on April 22, 2010.
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
To unsubscribe from this group, send email to
adwords-api+unsubscribegooglegroups.com or reply to this email with the words
"REMOVE ME" as the subject.