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.namecampaign_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.