Page Summary
-
DSA page feeds offer granular control over which URLs are used for Dynamic Search Ads, allowing you to specify precise pages instead of targeting entire websites.
-
To use DSA page feeds, you first create an Asset for each desired URL on your website.
-
Assets are then grouped into an AssetSet, representing the collection of URLs for a campaign.
-
The AssetSet is then associated with a specific campaign.
-
Custom labels can be used with page feeds to refine targeting and bidding based on specific URL groups.
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 an Asset for each URL on your website.
Java
List<String> urls = ImmutableList.of( "http://www.example.com/discounts/rental-cars", "http://www.example.com/discounts/hotel-deals", "http://www.example.com/discounts/flight-deals"); // Creates one operation per URL. List<AssetOperation> assetOperations = new ArrayList<>(); for (String url : urls) { PageFeedAsset pageFeedAsset = PageFeedAsset.newBuilder() // Sets the URL of the page to include. .setPageUrl(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. .addLabels(dsaPageUrlLabel) .build(); Asset asset = Asset.newBuilder().setPageFeedAsset(pageFeedAsset).build(); assetOperations.add(AssetOperation.newBuilder().setCreate(asset).build()); } // Creates the service client. try (AssetServiceClient assetServiceClient = googleAdsClient.getLatestVersion().createAssetServiceClient()) { // Adds the assets. MutateAssetsResponse response = assetServiceClient.mutateAssets(String.valueOf(customerId), assetOperations); // Prints some information about the result. List<String> resourceNames = response.getResultsList().stream() .map(MutateAssetResult::getResourceName) .collect(Collectors.toList()); resourceNames.forEach(r -> System.out.printf("Created asset with resource name %s.%n", r)); return resourceNames; }
C#
/// <summary> /// Creates Assets to be used in a DSA page feed. /// </summary> /// <param name="client">The Google Ads client.</param> /// <param name="customerId">The Google Ads customer ID for which the call is made.</param> /// <param name="dsaPageUrlLabel">The DSA page URL label.</param> /// <returns>The list of asset resource names.</returns> private static List<string> CreateAssets(GoogleAdsClient client, long customerId, string dsaPageUrlLabel) { AssetServiceClient assetService = client.GetService(Services.V22.AssetService); string[] urls = new[] { "http://www.example.com/discounts/rental-cars", "http://www.example.com/discounts/hotel-deals", "http://www.example.com/discounts/flight-deals" }; // Creates one operation per URL. List<AssetOperation> assetOperations = new List<AssetOperation>(); foreach (string url in urls) { PageFeedAsset pageFeedAsset = new PageFeedAsset() { // Sets the URL of the page to include. PageUrl = 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. Labels = { dsaPageUrlLabel } }; assetOperations.Add( new AssetOperation() { Create = new Asset() { PageFeedAsset = pageFeedAsset } }); } // Adds the assets. MutateAssetsResponse response = assetService.MutateAssets(customerId.ToString(), assetOperations); // Prints some information about the result. List<string> resourceNames = response.Results.Select( assetResult => assetResult.ResourceName).ToList(); foreach (string resourceName in resourceNames) { Console.Write($"Created asset with resource name {resourceName}."); } return resourceNames; }
PHP
$urls = [ 'http://www.example.com/discounts/rental-cars', 'http://www.example.com/discounts/hotel-deals', 'http://www.example.com/discounts/flight-deals' ]; $operations = []; // Creates one asset per URL. foreach ($urls as $url) { $pageFeedAsset = new PageFeedAsset([ '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. 'labels' => [$dsaPageUrlLabel] ]); // Wraps the page feed asset in an asset. $asset = new Asset(['page_feed_asset' => $pageFeedAsset]); // Creates an asset operation and adds it to the list of operations. $assetOperation = new AssetOperation(); $assetOperation->setCreate($asset); $operations[] = $assetOperation; } // Issues a mutate request to add the assets and prints its information. $assetServiceClient = $googleAdsClient->getAssetServiceClient(); $response = $assetServiceClient->mutateAssets(MutateAssetsRequest::build( $customerId, $operations )); $assetResourceNames = []; printf("Added %d assets:%s", $response->getResults()->count(), PHP_EOL); foreach ($response->getResults() as $addedAsset) { /** @var Asset $addedAsset */ $assetResourceName = $addedAsset->getResourceName(); printf( "Created an asset with resource name: '%s'.%s", $assetResourceName, PHP_EOL ); $assetResourceNames[] = $assetResourceName; } return $assetResourceNames;