Stay organized with collectionsSave and categorize content based on your preferences.
By default, Dynamic Search Ads (DSAs) are set up to target entire websites, or
portions of them without focusing on specific page URLs. If you need better
control over the URLs, you can use DSA page feeds to specify precisely which
URLs to use with your DSAs. When you provide a page feed of your
products and their landing pages, it helps Google Ads determine when to show your
ads and where to direct people on your website.
This guide shows you how to create asset-based DSA page feeds.
Create assets for each page on your website
First, create anAssetfor each URL on your website.
defcreate_assets(client:GoogleAdsClient,customer_id:str,dsa_page_url_label:str)->List[str]:"""Creates assets to be used in a DSA page feed.Args:client: an initialized GoogleAdsClient instance.customer_id: a client customer ID.dsa_page_url_label: the label for the DSA page URLs.Returns:a list of the created assets' resource names."""urls:List[str]=["http://www.example.com/discounts/rental-cars","http://www.example.com/discounts/hotel-deals","http://www.example.com/discounts/flight-deals",]operations:List[AssetOperation]=[]# Creates one asset per URL.forurlinurls:# Creates an asset operation and adds it to the list of operations.operation:AssetOperation=client.get_type("AssetOperation")asset:Asset=operation.createpage_feed_asset:PageFeedAsset=asset.page_feed_assetpage_feed_asset.page_url=url# Recommended: adds labels to the asset. These labels can be used later# in ad group targeting to restrict the set of pages that can serve.page_feed_asset.labels.append(dsa_page_url_label)operations.append(operation)# Issues a mutate request to add the assets and prints its information.asset_service:AssetServiceClient=client.get_service("AssetService")response:MutateAssetsResponse=asset_service.mutate_assets(customer_id=customer_id,operations=operations)print(f"Added{len(response.results)}assets:")resource_names:List[str]=[]result:MutateAssetResultforresultinresponse.results:resource_name:str=result.resource_nameprint(f"\tCreated an asset with resource name: '{resource_name}'")resource_names.append(resource_name)returnresource_names
defcreate_assets(client,dsa_page_url_label,customer_id)urls=['http://www.example.com/discounts/rental-cars','http://www.example.com/discounts/hotel-deals','http://www.example.com/discounts/flight-deals',]operations=urls.mapdo|url|client.operation.create_resource.assetdo|asset|asset.page_feed_asset=client.resource.page_feed_assetdo|pfa|# Sets the URL of the page to include.pfa.page_url=url# Recommended: adds labels to the asset. These labels can be used later# in ad group targeting to restrict the set of pages that can serve.pfa.labels<<dsa_page_url_labelendendendresponse=client.service.asset.mutate_assets(customer_id:customer_id,operations:operations,)resource_names=[]response.results.eachdo|result|resource_name=result.resource_nameputs"Created asset with resource name '#{resource_name}'"resource_names<<resource_nameendresource_namesend
my$urls=["http://www.example.com/discounts/rental-cars","http://www.example.com/discounts/hotel-deals","http://www.example.com/discounts/flight-deals"];# Create one operation per URL.my$asset_operations=[];foreachmy$url(@$urls){my$page_feed_asset=Google::Ads::GoogleAds::V21::Common::PageFeedAsset->new({# Set the URL of the page to include.pageUrl=>$url,# Recommended: add labels to the asset. These labels can be used later in# ad group targeting to restrict the set of pages that can serve.labels=>[$dsa_page_url_label]});my$asset=Google::Ads::GoogleAds::V21::Resources::Asset->new({pageFeedAsset=>$page_feed_asset});push@$asset_operations,Google::Ads::GoogleAds::V21::Services::AssetService::AssetOperation->new({create=>$asset});}# Add the assets.my$response=$api_client->AssetService()->mutate({customerId=>$customer_id,operations=>$asset_operations});# Print some information about the response.my$resource_names=[];foreachmy$result(@{$response->{results}}){push@$resource_names,$result->{resourceName};printf"Created asset with resource name '%s'.\n",$result->{resourceName};}return$resource_names;
Next, create a collection of assets known as anAssetSet. This grouping represents all the URLs that
should be considered for a particular campaign. AnAssetcan be in multipleAssetSetobjects.
defcreate_asset_set(client:GoogleAdsClient,customer_id:str)->str:"""Creates an asset set.Args:client: an initialized GoogleAdsClient instance.customer_id: a client customer ID.Returns:the created asset set's resource name."""operation:AssetSetOperation=client.get_type("AssetSetOperation")# Creates an asset set which will be used to link the dynamic page feed# assets to a campaign.asset_set:AssetSet=operation.createasset_set.name=f"My dynamic page feed{get_printable_datetime()}"asset_set.type_=client.enums.AssetSetTypeEnum.PAGE_FEED# Issues a mutate request to add the asset set and prints its information.asset_set_service:AssetSetServiceClient=client.get_service("AssetSetService")response:MutateAssetSetsResponse=asset_set_service.mutate_asset_sets(customer_id=customer_id,operations=[operation])resource_name:str=response.results[0].resource_nameprint(f"Created an asset set with resource name: '{resource_name}'")returnresource_name
defcreate_asset_set(client,customer_id)# Creates an AssetSet which will be used to link the dynamic page feed assets to a campaign.# Creates an operation to add the AssetSet.operation=client.operation.create_resource.asset_setdo|asset_set|asset_set.name="My dynamic page feed#{Time.now}"asset_set.type=:PAGE_FEEDend# Sends the mutate request.response=client.service.asset_set.mutate_asset_sets(customer_id:customer_id,operations:[operation],)# Prints some information about the response.resource_name=response.results.first.resource_nameputs"Created asset set with resource name '#{resource_name}'"resource_nameend
# Create an AssetSet which will be used to link the dynamic page feed assets to# a campaign.my$asset_set=Google::Ads::GoogleAds::V21::Resources::AssetSet->new({name=>"My dynamic page feed #".uniqid(),type=>PAGE_FEED});# Create an operation to add the AssetSet.my$operation=Google::Ads::GoogleAds::V21::Services::AssetSetService::AssetSetOperation->new({create=>$asset_set});# Send the mutate request.my$response=$api_client->AssetSetService()->mutate({customerId=>$customer_id,operations=>[$operation]});# Print some information about the response.my$resource_name=$response->{results}[0]{resourceName};printf"Created asset set with resource name '%s'.\n",$resource_name;return$resource_name;
defadd_assets_to_asset_set(client:GoogleAdsClient,customer_id:str,asset_resource_names:List[str],asset_set_resource_name:str,)->None:"""Adds assets to an asset set by creating an asset set asset link.Args:client: an initialized GoogleAdsClient instance.customer_id: a client customer ID.asset_resource_names: a list of asset resource names.asset_set_resource_name: a resource name for an asset set."""operations:List[AssetSetAssetOperation]=[]forresource_nameinasset_resource_names:# Creates an asset set asset operation and adds it to the list of# operations.operation:AssetSetAssetOperation=client.get_type("AssetSetAssetOperation")asset_set_asset:AssetSetAsset=operation.createasset_set_asset.asset=resource_nameasset_set_asset.asset_set=asset_set_resource_nameoperations.append(operation)# Issues a mutate request to add the asset set assets and prints its# information.asset_set_asset_service:AssetSetAssetServiceClient=client.get_service("AssetSetAssetService")response:MutateAssetSetAssetsResponse=(asset_set_asset_service.mutate_asset_set_assets(customer_id=customer_id,operations=operations))print(f"Added{len(response.results)}asset set assets:")result:MutateAssetSetAssetResultforresultinresponse.results:print("\tCreated an asset set asset link with resource name "f"'{result.resource_name}'")
defadd_assets_to_asset_set(client,asset_resource_names,asset_set_resource_name,customer_id)operations=asset_resource_names.mapdo|asset_resource_name|client.operation.create_resource.asset_set_assetdo|asa|asa.asset=asset_resource_nameasa.asset_set=asset_set_resource_nameendendresponse=client.service.asset_set_asset.mutate_asset_set_assets(customer_id:customer_id,operations:operations,)resource_name=response.results.first.resource_nameputs"Created asset set asset with resource name '#{resource_name}'"end
my$operations=[];foreachmy$asset_resource_name(@$asset_resource_names){my$asset_set_asset=Google::Ads::GoogleAds::V21::Resources::AssetSetAsset->new({asset=>$asset_resource_name,assetSet=>$asset_set_resource_name});# Create an operation to add the link.my$operation=Google::Ads::GoogleAds::V21::Services::AssetSetAssetService::AssetSetAssetOperation->new({create=>$asset_set_asset});push@$operations,$operation;}# Send the mutate request.my$response=$api_client->AssetSetAssetService()->mutate({customerId=>$customer_id,operations=>$operations});# Print some information about the response.my$resource_name=$response->{results}[0]{resourceName};printf"Created AssetSetAsset link with resource name '%s'.\n",$resource_name;
deflink_asset_set_to_campaign(client:GoogleAdsClient,customer_id:str,campaign_id:str,asset_set_resource_name:str,)->None:"""Links the asset set to the campaign by creating a campaign asset set.Args:client: an initialized GoogleAdsClient instance.customer_id: a client customer ID.campaign_id: the ID for a Campaign.asset_set_resource_name: a resource name for an asset set."""googleads_service:GoogleAdsServiceClient=client.get_service("GoogleAdsService")# Creates a campaign asset set representing the link between an asset set# and a campaign.operation:CampaignAssetSetOperation=client.get_type("CampaignAssetSetOperation")campaign_asset_set:CampaignAssetSet=operation.createcampaign_asset_set.asset_set=asset_set_resource_namecampaign_asset_set.campaign=googleads_service.campaign_path(customer_id,campaign_id)campaign_asset_set_service:CampaignAssetSetServiceClient=(client.get_service("CampaignAssetSetService"))response:MutateCampaignAssetSetsResponse=(campaign_asset_set_service.mutate_campaign_asset_sets(customer_id=customer_id,operations=[operation]))resource_name:str=response.results[0].resource_nameprint(f"Created a campaign asset set with resource name: '{resource_name}'")
deflink_asset_set_to_campaign(client,asset_set_resource_name,customer_id,campaign_id)# Creates a CampaignAssetSet representing the link between an AssetSet and a Campaign.# Creates an operation to add the CampaignAssetSet.operation=client.operation.create_resource.campaign_asset_setdo|cas|cas.campaign=client.path.campaign(customer_id,campaign_id)cas.asset_set=asset_set_resource_nameend# Issues the mutate request.response=client.service.campaign_asset_set.mutate_campaign_asset_sets(customer_id:customer_id,operations:[operation],)resource_name=response.results.first.resource_nameputs"Created a campaign asset set with resource name '#{resource_name}'"end
# Create a CampaignAssetSet representing the link between an AssetSet and a Campaign.my$campaign_asset_set=Google::Ads::GoogleAds::V21::Resources::CampaignAssetSet->new({campaign=>Google::Ads::GoogleAds::V21::Utils::ResourceNames::campaign($customer_id,$campaign_id),assetSet=>$asset_set_resource_name});# Create an operation to add the CampaignAssetSet.my$operation=Google::Ads::GoogleAds::V21::Services::CampaignAssetSetService::CampaignAssetSetOperation->new({create=>$campaign_asset_set});# Issue the mutate request.my$response=$api_client->CampaignAssetSetService()->mutate({customerId=>$customer_id,operations=>[$operation]});# Print some information about the response.my$resource_name=$response->{results}[0]{resourceName};printf"Created a CampaignAssetSet with resource name '%s'.\n",$resource_name;
Recommended: Target page feed URLs using custom labels
You can optionally use custom labels to target and bid on URLs in the page feed.
This can be done by creating a criterion based on aWebpageInfothat filters using a condition that
has itsoperandset asWebpageConditionOperand.CUSTOM_LABEL.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-03 UTC."],[[["\u003cp\u003eDynamic Search Ads Page Feeds allow granular control over the specific URLs targeted by your ads for increased relevance.\u003c/p\u003e\n"],["\u003cp\u003eImplementation involves creating Assets for each URL, grouping them into an AssetSet, and linking the Assets to the AssetSet.\u003c/p\u003e\n"],["\u003cp\u003eUsing page feeds provides benefits like precise URL targeting, improved ad relevance, enhanced campaign performance, and greater flexibility in campaign structuring.\u003c/p\u003e\n"],["\u003cp\u003eCode examples in various programming languages demonstrate the process of creating and managing DSA page feeds using the Google Ads API.\u003c/p\u003e\n"],["\u003cp\u003eCustom labels can be used to further refine targeting and bidding within your page feed for more granular control over your campaigns.\u003c/p\u003e\n"]]],[],null,[]]