How to get keyword status information from adwords api
I am using the adwords php api hosted here https://github.com/googleads/googleads-php-lib
It has got examples and I am using this one
https://github.com/googleads/googleads-php-lib/blob/master/examples/AdWords/v201309/BasicOperations/GetKeywords.php
that particular example fetches keywords in a given adgroup using the adgroup id and customerid.
The keyword information does not contain the status of the keyword, ie ACTIVE/PAUSED
How to get that ?
The selectable fields do not seem to have a field for current status. The list is here
https://developers.google.com/adwords/api/docs/appendix/selectorfields#v201309-AdGroupCriterionService
So how do I get the current status of the keywords when fetching them using the get method of AdGroupCriterionService ?
A keyword's status can be selected in AdGroupCriterionService by adding 'UserStatus' to the array of fields in your selector.
Specifically, in the example doc you mentioned above, change this:
$selector->fields = array('KeywordText', 'KeywordMatchType', 'Id');
to this:
$selector->fields = array('KeywordText', 'KeywordMatchType', 'Id', 'UserStatus');
Check out the BiddableAdGroupCriterion. This is a sub-class of the AdGroupCriterion.
One of the properties of the BiddableAdGroupCriterion is UserStatus. This is an enum with three possible values: ACTIVE
, DELETED
or PAUSED
.
This should be what you're after.
Good luck!
The status is on the parent class object AdGroupCriterion. Here is an example:
$selector->fields = array('Id', 'KeywordText', 'KeywordMatchType', 'AdGroupId', 'Status');
...
foreach ($page->entries as $adGroupCriterion) {
$adGroupCriterion->userStatus
$keyword = $adGroupCriterion->criterion;
链接地址: http://www.djcxy.com/p/32348.html
上一篇: Adwords广告类型问题