How to update existing keyword text using adwords php client library ?

32 views
Skip to first unread message

Sarvagya Pandey

unread,
Aug 8, 2017, 3:52:54 AM8/8/17
to AdWords API Forum
How to update a Keyword Final URL
Code I am using:

        // Get the service, which loads the required classes.
$adGroupCriterionService = $adWordsServices->get($session, AdGroupCriterionService::class);
// Create selector.
$selector = new Selector();
$selector->setFields(['KeywordText', 'KeywordMatchType', 'Id','Status','TopOfPageCpc','CpcBid','FinalUrls']);
$selector->setOrdering([new OrderBy('KeywordText', 'ASCENDING')]);
// Create predicates.
$selector->setPredicates([new Predicate('AdGroupId', PredicateOperator::IN, [$adGroupId]  )] );
$selector->setPredicates([new Predicate('CriteriaType', PredicateOperator::IN, ['KEYWORD']  )] );
$selector->setPredicates([new Predicate('Id', PredicateOperator::IN, [$keywordId]  )] );

        // Make the get request.
$page = $adGroupCriterionService->get($selector);
        foreach ($page->getEntries() as $adGroupCriterion) {
               var_dump($adGroupCriterion);
        }


Response :

Google\AdsApi\AdWords\v201609\cm\BiddableAdGroupCriterion Object
(
    [userStatus:protected] => ENABLED
    [systemServingStatus:protected] => 
    [approvalStatus:protected] => 
    [disapprovalReasons:protected] => 
    [destinationUrl:protected] => 
    [firstPageCpc:protected] => 
    [topOfPageCpc:protected] => Google\AdsApi\AdWords\v201609\cm\Bid Object
        (
            [amount:protected] => Google\AdsApi\AdWords\v201609\cm\Money Object
                (
                    [microAmount:protected] => 123456
                    [ComparableValueType:protected] => 
                    [ComparableValue.Type] => Money
                )

        )

    [firstPositionCpc:protected] => 
    [qualityInfo:protected] => 
    [biddingStrategyConfiguration:protected] => Google\AdsApi\AdWords\v201609\cm\BiddingStrategyConfiguration Object
        (
            [biddingStrategyId:protected] => 
            [biddingStrategyName:protected] => 
            [biddingStrategyType:protected] => MANUAL_CPC
            [biddingStrategySource:protected] => 
            [biddingScheme:protected] => 
            [bids:protected] => Array
                (
                    [0] => Google\AdsApi\AdWords\v201609\cm\CpcBid Object
                        (
                            [bid:protected] => Google\AdsApi\AdWords\v201609\cm\Money Object
                                (
                                    [microAmount:protected] => 12340000
                                    [ComparableValueType:protected] => 
                                    [ComparableValue.Type] => Money
                                )

                            [cpcBidSource:protected] => CRITERION
                            [BidsType:protected] => 
                            [Bids.Type] => CpcBid
                        )

                )

        )

    [bidModifier:protected] => 
    [finalUrls:protected] => 
    [finalMobileUrls:protected] => 
    [finalAppUrls:protected] => 
    [trackingUrlTemplate:protected] => 
    [urlCustomParameters:protected] => 
    [adGroupId:protected] => 12343924932
    [criterionUse:protected] => BIDDABLE
    [criterion:protected] => Google\AdsApi\AdWords\v201609\cm\Keyword Object
        (
            [text:protected] => Test Keyword ABCD
            [matchType:protected] => PHRASE
            [id:protected] => 12343743102
            [type:protected] => KEYWORD
            [CriterionType:protected] => 
            [Criterion.Type] => Keyword
        )

    [labels:protected] => 
    [forwardCompatibilityMap:protected] => 
    [baseCampaignId:protected] => 
    [baseAdGroupId:protected] => 
    [AdGroupCriterionType:protected] => 
    [AdGroupCriterion.Type] => BiddableAdGroupCriterion
)

Vincent Racaza (AdWords API Team)

unread,
Aug 8, 2017, 5:04:26 AM8/8/17
to AdWords API Forum
Hi Sarvagya,

Could you confirm if this is the same issue on the other forum post that you created? Your description in this post is updating keyword text but the code is about getting AdGroupCriterion same as the other forum post. If you can confirm that this is the same issue on the other post, then let us continue the discussion there so that there will be one thread to monitor for your issue.

Thanks,
Vincent
AdWords API Team
Reply all
Reply to author
Forward
0 new messages