ชิ้นงานในแคมเปญ Performance Max

แคมเปญ Performance Max มีลักษณะเฉพาะบางอย่างเกี่ยวกับชิ้นงาน

  1. มีจำนวนชิ้นงานขั้นต่ำที่จำเป็นสำหรับชิ้นงานประเภทต่างๆ
  2. ชิ้นงานจะจัดกลุ่มไว้ด้วยกันในคอลเล็กชันที่เรียกว่าAssetGroup ซึ่งเป็นเอกลักษณ์เฉพาะของแคมเปญ Performance Max
  3. โดยแมชชีนเลิร์นนิงสามารถสร้างชิ้นงานบางรายการได้โดยอัตโนมัติ

หลักเกณฑ์การใช้แบรนด์: การเชื่อมโยงชื่อและโลโก้ธุรกิจ

แม้ว่าชิ้นงานส่วนใหญ่ในแคมเปญ Performance Max จะจัดระเบียบอยู่ภายใน กลุ่มชิ้นงาน แต่ชิ้นงานสําคัญที่แสดงถึงเอกลักษณ์ของแบรนด์ โดยเฉพาะชื่อธุรกิจและโลโก้ธุรกิจ จะได้รับการจัดการแตกต่างออกไปหากเปิดใช้หลักเกณฑ์การใช้แบรนด์ สําหรับแคมเปญ

ชิ้นงานหลักเกณฑ์การใช้แบรนด์เหล่านี้ลิงก์โดยตรงที่ระดับแคมเปญ ไม่ใช่ที่ระดับกลุ่มชิ้นงาน ซึ่งทำได้โดยใช้ทรัพยากร CampaignAsset คุณ ลิงก์ชิ้นงานกับแคมเปญ โดยระบุAssetFieldTypeที่เหมาะสม ดังนี้

*   `BUSINESS_NAME` for the Business Name asset (which is a Text Asset).
*   `LOGO` for the Business Logo asset (which is an Image Asset).

การลิงก์ระดับแคมเปญนี้ช่วยให้มั่นใจได้ว่าแบรนด์จะได้รับการนำเสนออย่างสอดคล้องกันในกลุ่มชิ้นงานทั้งหมดภายในแคมเปญ Performance Max

ตัวอย่างโค้ด

ข้อมูลโค้ดต่อไปนี้แสดงการสร้างชิ้นงานที่ซ้ำกันที่จำเป็น ในคำขอใหม่

Java

/** Creates multiple text assets and returns the list of resource names. */
private List<String> createMultipleTextAssets(
    GoogleAdsClient googleAdsClient, long customerId, List<String> texts) {
  List<MutateOperation> mutateOperations = new ArrayList<>();
  for (String text : texts) {
    Asset asset = Asset.newBuilder().setTextAsset(TextAsset.newBuilder().setText(text)).build();
    AssetOperation assetOperation = AssetOperation.newBuilder().setCreate(asset).build();
    mutateOperations.add(MutateOperation.newBuilder().setAssetOperation(assetOperation).build());
  }

  List<String> assetResourceNames = new ArrayList<>();
  // Creates the service client.
  try (GoogleAdsServiceClient googleAdsServiceClient =
      googleAdsClient.getLatestVersion().createGoogleAdsServiceClient()) {
    // Sends the operations in a single Mutate request.
    MutateGoogleAdsResponse response =
        googleAdsServiceClient.mutate(Long.toString(customerId), mutateOperations);
    for (MutateOperationResponse result : response.getMutateOperationResponsesList()) {
      if (result.hasAssetResult()) {
        assetResourceNames.add(result.getAssetResult().getResourceName());
      }
    }
    printResponseDetails(response);
  }
  return assetResourceNames;
}

      

C#

/// <summary>
/// Creates multiple text assets and returns the list of resource names.
/// </summary>
/// <param name="client">The Google Ads Client.</param>
/// <param name="customerId">The customer's ID.</param>
/// <param name="texts">The texts to add.</param>
/// <returns>A list of asset resource names.</returns>
private List<string> CreateMultipleTextAssets(
    GoogleAdsClient client,
    long customerId,
    string[] texts)
{
    // Get the GoogleAdsService.
    GoogleAdsServiceClient googleAdsServiceClient =
        client.GetService(Services.V22.GoogleAdsService);

    MutateGoogleAdsRequest request = new MutateGoogleAdsRequest()
    {
        CustomerId = customerId.ToString()
    };

    foreach (string text in texts)
    {
        request.MutateOperations.Add(
            new MutateOperation()
            {
                AssetOperation = new AssetOperation()
                {
                    Create = new Asset()
                    {
                        TextAsset = new TextAsset()
                        {
                            Text = text
                        }
                    }
                }
            }
        );
    }

    // Send the operations in a single Mutate request.
    MutateGoogleAdsResponse response = googleAdsServiceClient.Mutate(request);

    List<string> assetResourceNames = new List<string>();

    foreach (MutateOperationResponse operationResponse in response.MutateOperationResponses)
    {
        MutateAssetResult assetResult = operationResponse.AssetResult;
        assetResourceNames.Add(assetResult.ResourceName);
    }

    PrintResponseDetails(response);

    return assetResourceNames;
}

      

PHP

private static function createMultipleTextAssets(
    GoogleAdsClient $googleAdsClient,
    int $customerId,
    array $texts
): array {
    // Here again, we use the GoogleAdService to create multiple text assets in a single
    // request.
    $operations = [];
    foreach ($texts as $text) {
        // Creates a mutate operation for a text asset.
        $operations[] = new MutateOperation([
            'asset_operation' => new AssetOperation([
                'create' => new Asset(['text_asset' => new TextAsset(['text' => $text])])
            ])
        ]);
    }

    // Issues a mutate request to add all assets.
    $googleAdsService = $googleAdsClient->getGoogleAdsServiceClient();
    /** @var MutateGoogleAdsResponse $mutateGoogleAdsResponse */
    $mutateGoogleAdsResponse =
        $googleAdsService->mutate(MutateGoogleAdsRequest::build($customerId, $operations));

    $assetResourceNames = [];
    foreach ($mutateGoogleAdsResponse->getMutateOperationResponses() as $response) {
        /** @var MutateOperationResponse $response */
        $assetResourceNames[] = $response->getAssetResult()->getResourceName();
    }
    self::printResponseDetails($mutateGoogleAdsResponse);

    return $assetResourceNames;
}