Updating ad group feed matching function Google Ads Api

77 views
Skip to first unread message

Ewout Beukers

unread,
Jul 6, 2020, 3:48:16 AM7/6/20
to AdWords API and Google Ads API Forum

Hi,


I am having some issues with updating the ad group feed matching function using the Google Ads Api v3. I am using the PHP SDK.


I have created an AdGroupFeed to link my ad groups to sitelink extensions. However, I now want to update the matching_function, so that I can change the linked sitelinks.

I am using the update mask ‘matching_function.operator’, ‘matching_function.left_operands’ and ‘matching_function.right_operands’, but after sending these update operations to the AdGroupFeedService, I get the error:

Multiple errors in ‘details’. First error: Field 'matching_function.left_operands' cannot be modified by 'UPDATE' operation., at operations[0].update.matching_function.left_operands

Simply using 'matching_function' as the update mask also results in an error, stating that this field has sub fields.


I cannot seem to find anything in the documentation regarding this.


Any help on this would be much appreciated.


Regards,

Ewout

Google Ads API Forum Advisor Prod

unread,
Jul 7, 2020, 2:59:11 PM7/7/20
to ewout_...@hotmail.com, adwor...@googlegroups.com
Hi Ewout,

Thank you for reaching out. Can you please share your complete detailed request and response logs via Reply privately to author so I can further investigate the issue? You can find information on enabling logging here.

Regards,
Mitchell
Google Ads API Team

ref:_00D1U1174p._5004Q21jLKc:ref

rds1

unread,
Oct 14, 2020, 5:04:53 AM10/14/20
to AdWords API and Google Ads API Forum
For anyone finding this thread but no answer (like we did), one solution is to not attempt updating the matching function via its components (like the original poster and we attempted) but to build your own matching function string and update just that. This worked for our case, mutating a CustomerFeed.

PHP example, relevant parts marked green:

        $matchingString = "$operator($leftOperand,$rightOperand)"; // --> e.g. IN(FEED_ITEM_ID,{1000001,1000002,1000003})

        $matchingFunction = new MatchingFunction();
        $matchingFunction->setFunctionString((new StringValue())->setValue($matchingString));
        ...
        $updateMask = (new FieldMask())->setPaths(['matching_function.function_string']);
        $operation->setUpdateMask($updateMask);

Good luck!

Google Ads API Forum Advisor Prod

unread,
Oct 15, 2020, 2:16:16 AM10/15/20
to cyp...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for bumping this thread and providing your version of the solution. The previous discussion was moved privately, that said, relaying below the response from our colleague regarding the issue :

"Hi Ewout,

Please try setting the update_mask to the following (with $adGroupFeed being the name of the feed you're updating) and let me know if you are still facing the error:

$adGroupFeedOperation->setUpdateMask(FieldMasks::allSetFieldsOf($adGroupFeed));
"

Best regards,

Google Logo
Peter Laurence Napa Oliquino
Google Ads API Team
 


ref:_00D1U1174p._5004Q2697ui:ref
Reply all
Reply to author
Forward
0 new messages