AdGroupExtensionSettingOperation removes existing feed items when trying to add a new one

76 views
Skip to first unread message

Tim

unread,
Apr 24, 2019, 2:48:14 PM4/24/19
to AdWords API and Google Ads API Forum
I've written code to add a sitelink to an ad group. When the ad group already has sitelinks in it will remove the existing sitelinks before adding the new one.

I require the code to leave existing sitelinks as they are and only add new ones, is this possible?

AdGroupExtensionSetting setting = new AdGroupExtensionSetting();
setting.setAdGroupId(sitelink.getAdGroupID());
setting.setExtensionType(FeedType.SITELINK);

ExtensionSetting extensionSetting = new ExtensionSetting();
extensionSetting.setExtensions(new ExtensionFeedItem[] { feedItem });
setting.setExtensionSetting(extensionSetting);

AdGroupExtensionSettingOperation operation = new AdGroupExtensionSettingOperation();
operation.setOperand(setting);
operation.setOperator(Operator.ADD);


googleadsapi...@google.com

unread,
Apr 24, 2019, 5:32:06 PM4/24/19
to th...@post.com, AdWords API and Google Ads API Forum
Hello Tim, 

You can associate the same feed item with multiple entities. If you are looking to use the same extension to all the AdGroups in a campaign, you may set it at the campaign level. Similarly, if you're using a specific extension at the campaign level, you may set them at the account level instead of individually setting to each campaign. You will be able to reuse the feeds and associate them at different levels. Please refer to the code sample in the guide and let us know if you have any issues.

Thanks,
Bharani, Google Ads API Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Tim

unread,
Apr 25, 2019, 4:57:06 AM4/25/19
to AdWords API and Google Ads API Forum
Hi Bharani,

Thanks for your reply. The problem I am having is not to do with associating a feed item with multiple entities, but instead the problem is that the associations between a feed item and an ad group gets lost when I add another association using the code supplied. I can get around this by supplying all the current associations when adding a new one, but I'd rather not have to if that is possible?

Thanks

googleadsapi...@google.com

unread,
Apr 25, 2019, 1:34:02 PM4/25/19
to th...@post.com, AdWords API and Google Ads API Forum
Hi Tim, 

Thank you for clarifying this. When you're updating the existing Ad group with a new feedItem, you will need to use the AdGroupExtensionSetting.mutate() with the operator as SET/ADD. To prevent the new settings to overwrite the existing settings, you will need to send back all the FeedItems. Please check this guide on how to update the FeedItems. 

Regards,
Bharani, Google Ads API Team
Reply all
Reply to author
Forward
0 new messages