فیدهای صفحه تبلیغات جستجوی پویا

به‌طور پیش‌فرض، تبلیغات جستجوی پویا (DSA) به گونه‌ای تنظیم می‌شوند که کل وب‌سایت‌ها یا بخش‌هایی از آن‌ها را بدون تمرکز بر URLهای صفحه خاصی هدف قرار دهند. اگر به کنترل بهتر بر روی URL ها نیاز دارید، می توانید از فیدهای صفحه DSA برای تعیین دقیق آدرس هایی که با DSA های خود استفاده کنید استفاده کنید. هنگامی که یک فید صفحه از محصولات خود و صفحات فرود آنها ارائه می دهید، به Google Ads کمک می کند تا تعیین کند چه زمانی تبلیغات شما را نشان دهد و افراد را به کجا هدایت کند.

این راهنما به شما نحوه ایجاد فیدهای صفحه DSA مبتنی بر دارایی را نشان می دهد.

برای هر صفحه در وب سایت خود دارایی ایجاد کنید

ابتدا برای هر URL در وب سایت خود یک Asset ایجاد کنید.

جاوا

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;
}
      

سی شارپ

/// <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;