ExtensionFeedItem - How to update/remove settings from device?

32 views
Skip to first unread message

Christoph Lanz

unread,
May 7, 2020, 8:35:16 AM5/7/20
to AdWords API and Google Ads API Forum
Dear Google Ads Api Team,

I am building a function to manage Sitelinks. Some of the settings are managed with the "ExtensionFeedItem" function, which controls:

- Startdate
- Enddate
- Scheduling
- Device Preference

I am able to create and update these settings, but once they are created I am not able to remove them again. Especially trouble causes me the "device" setting:
- When I set the device preference to "2" (mobile) it works fine, but when I try to set again to "0" (all devices), the API ignores this input.
- Not indicating the "device" would also do no change in the Sitelink.
- deleting the entire extension feed item would delete the whole Sitelink, which would reset sitelink history, I would like to avoid this if possible.

Could you please help me to see what I am missing?

Many thanks in advance!

Kind regards,

Christoph


Example code of my function: 

$extensionsetting = new ExtensionFeedItem([
'resource_name' => 'customers/CUSTOMERID/extensionFeedItems/FEEDITEMID,
'start_date_time' => $STARTDATE,
'end_date_time' => $ENDDATE,
'ad_schedules' => $SCHEDULINGINFO, 
'device' => '2'
]);

$adGroupExtensionSettingOperation = new ExtensionFeedItemOperation();
$adGroupExtensionSettingOperation->setUpdate($extensionsetting);
$adGroupExtensionSettingOperation->setUpdateMask(FieldMasks::allSetFieldsOf($extensionsetting));

Google Ads API Forum Advisor Prod

unread,
May 7, 2020, 12:32:57 PM5/7/20
to christo...@logitravel.com, adwor...@googlegroups.com
Hi Christoph,

Thank you for reaching out. In order to remove/set a specific attribute to the default value, I would recommend performing an update_mask operation on the ExtensionFeedItemService. You should specifically set the path of the update_mask to "device" as I explained in this forum post.

Regards,
Mitchell
Google Ads API Team

ref:_00D1U1174p._5004Q1zKevJ:ref

Christoph Lanz

unread,
May 8, 2020, 10:39:15 AM5/8/20
to Google Ads API Forum Advisor Prod, adwor...@googlegroups.com
Hello Mitchell,

Great, many thanks! This gave me the hint that I needed!

Kind regards, and have a nice weekend,

Christoph
Reply all
Reply to author
Forward
0 new messages