동적 검색 광고 페이지 피드
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
기본적으로 동적 검색 광고 (DSA)는 특정 페이지 URL에 집중하지 않고 전체 웹사이트 또는 일부를 타겟팅하도록 설정됩니다. URL을 더 세부적으로 관리해야 하는 경우 DSA 페이지 피드를 사용하여 DSA에 사용할 URL을 정확하게 지정할 수 있습니다. 제품 및 방문 페이지의 페이지 피드를 제공하면 Google Ads에서 광고를 게재할 시기와 웹사이트에서 고객을 유도할 위치를 결정할 수 있습니다.
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::V22::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::V22::Resources::Asset->new({pageFeedAsset=>$page_feed_asset});push@$asset_operations,Google::Ads::GoogleAds::V22::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;
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::V22::Resources::AssetSet->new({name=>"My dynamic page feed #".uniqid(),type=>PAGE_FEED});# Create an operation to add the AssetSet.my$operation=Google::Ads::GoogleAds::V22::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::V22::Resources::AssetSetAsset->new({asset=>$asset_resource_name,assetSet=>$asset_set_resource_name});# Create an operation to add the link.my$operation=Google::Ads::GoogleAds::V22::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::V22::Resources::CampaignAssetSet->new({campaign=>Google::Ads::GoogleAds::V22::Utils::ResourceNames::campaign($customer_id,$campaign_id),assetSet=>$asset_set_resource_name});# Create an operation to add the CampaignAssetSet.my$operation=Google::Ads::GoogleAds::V22::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;
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-12-22(UTC)"],[],[]]