Remove sitelinks from campaign by stopwords

21 views
Skip to first unread message

lad...@exito.de

unread,
Nov 26, 2021, 4:47:24 AM11/26/21
to AdWords API and Google Ads API Forum
Hi guys,

I need to build a script, that takes all sitelink-extensions of a defined campaign, check their attributes for occurance of a list of Stopwords an remove the sitelink, if one stopword occurs in the sitelink extension.

First Step: I select the sitelink-extensions of the campaign. 

extension_type_enum = self.__google_ads_client.enums.ExtensionTypeEnum
extension_type_name = extension_type_enum.SITELINK.name
campaign_resource_name = self.__google_ads_client.get_service("CampaignService").campaign_path(self.account_id, str(row_campaign.campaign.id))
query = f"""
SELECT
campaign_extension_setting.campaign,
campaign_extension_setting.extension_type,
campaign_extension_setting.extension_feed_items
FROM campaign_extension_setting
WHERE
campaign_extension_setting.campaign = '{campaign_resource_name}'
AND campaign_extension_setting.extension_type = '{extension_type_name}'"""

stream = self.__customer_service.search_stream(customer_id=self.account_id, query=query)
extension_feed_item_resource_names = []
for batch in stream:
for row in batch.results:
extension_feed_item_resource_names.extend(
row.campaign_extension_setting.extension_feed_items
)

This is working very well. I get all the feed item ressource names of my sitelinks.
The point where i struggle is to get the extension_feed_item by this ressource names. Can anyone help me out? I need to get the extension_feed_item, so i can check the attributes against my Stoplist.

Google Ads API Forum Advisor

unread,
Nov 29, 2021, 12:01:05 AM11/29/21
to lad...@exito.de, adwor...@googlegroups.com
Hi,

Thank you for reaching out to our API support team.

If you were able to opt out in the initial feed based to asset based migration, then you may indeed be able to still manage your feeds and extensions until February 2022. That being said, we would also recommend that you migrate to asset based extensions as soon as possible.

Moving forward to your concern, if you are looking for a way to retrieve attributes, then the attribute_values can be extracted from the feed_item report instead, or you may also us the extension_feed_item report.

Best regards,

Reminder: Share your feedback about the Google Ads (AdWords) API! Take the 2021 Google Ads API and AdWords API Annual Survey
 
Google Logo
Peter Laurence Napa Oliquino
Google Ads API Team
 


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