Issue with adding Income TIER

29 views
Skip to first unread message

Harisankar Mohanty

unread,
Jan 16, 2019, 12:43:45 PM1/16/19
to AdWords API and Google Ads API Forum
Hello,

I am trying to add Income Tiers (TIER_1, TIER_2 etc) to a location by using this code (PHP) but getting error message Fatal error:  Class 'App\Targeting\FeedFunction' not found 



$session = $sessionBuilder->withClientCustomerId($customerId)->build();
        $campaignCriterionService = $adWordsServices->get($session, CampaignCriterionService::class);

        $campaignCriteria = [];
        $operations = [];
        
        $campaignCriteria = [];
        $incomeTierArr = array('TIER_1', 'TIER_2', 'TIER_3', 'TIER_4', 'TIER_5', 'TIER_6_TO_10');
        
        foreach($incomeTierArr as $tier) {
            $tier = new IncomeOperand($tier);
            $Loc = new GeoTargetOperand(array($location));
            $firstGroup = new LocationGroups();
            $firstGroup->setMatchingFunction(new FeedFunction('AND', $tier, $Loc));
            $campaignCriteria[] = new CampaignCriterion($campaignId, null, $firstGroup);
}
       
        foreach ($campaignCriteria as $campaignCriterion) {
            $operations[] = new CampaignCriterionOperation($campaignCriterion, 'ADD');
        }
        
        $result = $campaignCriterionService->mutate($operations);


Can you please let me know where is the problem.

googleadsapi...@google.com

unread,
Jan 16, 2019, 5:11:19 PM1/16/19
to AdWords API and Google Ads API Forum
Hello Mohanty, 

It looks like you are using the FeedFunction logic and the script is not able to find this one. Please note that the IncomeOperand can no longer be used as a FunctionArgumentOperand for LocationGroups. Mutate requests adding new operands of this type will result in FunctionError.Reason.INVALID_OPERAND_TYPE error. You may refer to this related forum post as a reference. I have shared this with the team to update the documentation. Let me know if you have any further questions.

Regards,
Bharani, AdWords API Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

Reply all
Reply to author
Forward
0 new messages