Thử nghiệm trong chiến dịch

Thử nghiệm trong chiến dịch được dùng để thử nghiệm một tính năng cụ thể trong một chiến dịch. Không giống như các thử nghiệm do hệ thống quản lý (trong đó lưu lượng truy cập được phân chia giữa chiến dịch đối chứng và chiến dịch thử nghiệm), thử nghiệm trong chiến dịch phân chia lưu lượng truy cập trong chiến dịch, dựa trên việc tính năng có được bật hay không.

Quy trình này được hỗ trợ cho các giá trị ExperimentType sau:

ADOPT_AI_MAX
Thử nghiệm tác động của các tính năng trong bộ tính năng Tối đa hoá AI đối với chiến dịch Tìm kiếm.
ADOPT_BROAD_MATCH_KEYWORDS
Thử nghiệm tác động của từ khoá khớp mở rộng đối với chiến dịch Tìm kiếm.
PMAX_TEXT_CUSTOMIZATION_FINAL_URL_EXPANSION
Được dùng riêng để thử nghiệm các tính năng của chiến dịch Tối đa hoá hiệu suất: tuỳ chỉnh văn bản và mở rộng URL cuối cùng. Cho phép AI của Google gửi lưu lượng truy cập đến các trang đích phù hợp và tạo thành phần văn bản để phù hợp hơn với cụm từ tìm kiếm.

Thiết lập

  1. Xác định Experiment (với status được đặt thành ENABLED), cung cấp một loại thử nghiệm, một ExperimentArm đối chứng và một ExperimentArm thử nghiệm:
    • Đối với ADOPT_AI_MAX và ADOPT_BROAD_MATCH_KEYWORDS, cả nhóm đối chứng và nhóm thử nghiệm đều phải tham chiếu đến cùng một chiến dịch trong campaigns.
    • Đối với PMAX_TEXT_CUSTOMIZATION_FINAL_URL_EXPANSION, chỉ nhóm thử nghiệm chỉ định chiến dịch Tối đa hoá hiệu suất trong campaigns (để trống campaigns trên nhóm đối chứng).
  2. Đối với ADOPT_AI_MAX, hãy tạo một bản cập nhật CampaignOperation có mặt nạ trường để bật ai_max_setting.enable_ai_max và định cấu hình asset_automation_settings.

  3. Gửi yêu cầu GoogleAdsService.Mutate bao gồm các thao tác thay đổi để tạo thử nghiệm và nhóm thử nghiệm, đồng thời (đối với ADOPT_AI_MAX) để bật tính năng thử nghiệm trên chiến dịch.

Đối với ADOPT_AI_MAX và ADOPT_BROAD_MATCH_KEYWORDS, lưu lượng truy cập phải được phân chia đồng đều (50/50) trong chiến dịch để 50% lưu lượng truy cập được tiếp xúc với tính năng đã bật (nhóm thử nghiệm) và 50% thì không (nhóm đối chứng). PMAX_TEXT_CUSTOMIZATION_FINAL_URL_EXPANSION hỗ trợ mức phân tách lưu lượng truy cập tuỳ chỉnh có tổng bằng 100.

Java

// Create the experiment resource name using a temporary ID.
String experimentResourceName = ResourceNames.experiment(customerId, -1L);

// Create the experiment.
Experiment experiment =
    Experiment.newBuilder()
        .setResourceName(experimentResourceName)
        .setName("ADOPT_AI_MAX Experiment #" + UUID.randomUUID())
        .setType(ExperimentType.ADOPT_AI_MAX)
        .build();
MutateOperation experimentOperation =
    MutateOperation.newBuilder()
        .setExperimentOperation(ExperimentOperation.newBuilder().setCreate(experiment).build())
        .build();

// Create the control arm. Both arms in an intra-campaign experiment reference the same base
// campaign.
ExperimentArm controlArm =
    ExperimentArm.newBuilder()
        .setExperiment(experimentResourceName)
        .setName("Control Arm")
        .setControl(true)
        .setTrafficSplit(50)
        .addCampaigns(ResourceNames.campaign(customerId, campaignId))
        .build();
MutateOperation controlArmOperation =
    MutateOperation.newBuilder()
        .setExperimentArmOperation(
            ExperimentArmOperation.newBuilder().setCreate(controlArm).build())
        .build();

// Create the treatment arm.
ExperimentArm treatmentArm =
    ExperimentArm.newBuilder()
        .setExperiment(experimentResourceName)
        .setName("Treatment Arm")
        .setControl(false)
        .setTrafficSplit(50)
        .addCampaigns(ResourceNames.campaign(customerId, campaignId))
        .build();
MutateOperation treatmentArmOperation =
    MutateOperation.newBuilder()
        .setExperimentArmOperation(
            ExperimentArmOperation.newBuilder().setCreate(treatmentArm).build())
        .build();

// Create a campaign operation with an update mask to enable AI Max and configure asset
// automation settings.
// Note: For intra-campaign experiments, these settings are applied to the base campaign but are
// only active for the treatment traffic split.
Campaign campaign =
    Campaign.newBuilder()
        .setResourceName(ResourceNames.campaign(customerId, campaignId))
        .setAiMaxSetting(AiMaxSetting.newBuilder().setEnableAiMax(true).build())
        .addAssetAutomationSettings(
            AssetAutomationSetting.newBuilder()
                .setAssetAutomationType(AssetAutomationType.TEXT_ASSET_AUTOMATION)
                .setAssetAutomationStatus(AssetAutomationStatus.OPTED_IN)
                .build())
        .addAssetAutomationSettings(
            AssetAutomationSetting.newBuilder()
                .setAssetAutomationType(
                    AssetAutomationType.FINAL_URL_EXPANSION_TEXT_ASSET_AUTOMATION)
                .setAssetAutomationStatus(AssetAutomationStatus.OPTED_IN)
                .build())
        .build();

CampaignOperation campaignOp =
    CampaignOperation.newBuilder()
        .setUpdate(campaign)
        .setUpdateMask(FieldMasks.allSetFieldsOf(campaign))
        .build();
MutateOperation campaignMutateOperation =
    MutateOperation.newBuilder().setCampaignOperation(campaignOp).build();

// Send all mutate operations in a single Mutate request.
List<MutateOperation> mutateOperations =
    ImmutableList.of(
        experimentOperation,
        controlArmOperation,
        treatmentArmOperation,
        campaignMutateOperation);

try (GoogleAdsServiceClient googleAdsServiceClient =
    googleAdsClient.getLatestVersion().createGoogleAdsServiceClient()) {

  MutateGoogleAdsRequest request =
      MutateGoogleAdsRequest.newBuilder()
          .setCustomerId(Long.toString(customerId))
          .addAllMutateOperations(mutateOperations)
          .build();

  MutateGoogleAdsResponse response = googleAdsServiceClient.mutate(request);
      

C#

// Create the experiment resource name using a temporary ID.
string experimentResourceName = ResourceNames.Experiment(customerId, -1);

// Create the experiment.
MutateOperation experimentOperation = new MutateOperation()
{
    ExperimentOperation = new ExperimentOperation()
    {
        Create = new Experiment()
        {
            ResourceName = experimentResourceName,
            Name = $"ADOPT_AI_MAX Experiment #{ExampleUtilities.GetRandomString()}",
            Type = ExperimentType.AdoptAiMax
        }
    }
};

// Create the control arm. Both arms in an intra-campaign experiment
// reference the same base campaign.
MutateOperation controlArmOperation = new MutateOperation()
{
    ExperimentArmOperation = new ExperimentArmOperation()
    {
        Create = new ExperimentArm()
        {
            Experiment = experimentResourceName,
            Name = "Control Arm",
            Control = true,
            TrafficSplit = 50,
            Campaigns = { ResourceNames.Campaign(customerId, campaignId) }
        }
    }
};

// Create the treatment arm.
MutateOperation treatmentArmOperation = new MutateOperation()
{
    ExperimentArmOperation = new ExperimentArmOperation()
    {
        Create = new ExperimentArm()
        {
            Experiment = experimentResourceName,
            Name = "Treatment Arm",
            Control = false,
            TrafficSplit = 50,
            Campaigns = { ResourceNames.Campaign(customerId, campaignId) }
        }
    }
};

// Create a campaign operation with an update mask to enable AI Max and
// configure asset automation settings.
// Note: For intra-campaign experiments, these settings are applied to the
// base campaign but are only active for the treatment traffic split.
Campaign campaign = new Campaign()
{
    ResourceName = ResourceNames.Campaign(customerId, campaignId),
    AiMaxSetting = new Campaign.Types.AiMaxSetting { EnableAiMax = true }
};

campaign.AssetAutomationSettings.Add(new Campaign.Types.AssetAutomationSetting
{
    AssetAutomationType = AssetAutomationType.TextAssetAutomation,
    AssetAutomationStatus = AssetAutomationStatus.OptedIn
});

campaign.AssetAutomationSettings.Add(new Campaign.Types.AssetAutomationSetting
{
    AssetAutomationType = AssetAutomationType.FinalUrlExpansionTextAssetAutomation,
    AssetAutomationStatus = AssetAutomationStatus.OptedIn
});

MutateOperation campaignOperation = new MutateOperation()
{
    CampaignOperation = new CampaignOperation()
    {
        Update = campaign,
        UpdateMask = FieldMasks.AllSetFieldsOf(campaign)
    }
};

// Send all mutate operations in a single Mutate request.
List<MutateOperation> mutateOperations = new List<MutateOperation>
{
    experimentOperation,
    controlArmOperation,
    treatmentArmOperation,
    campaignOperation
};

MutateGoogleAdsResponse response = googleAdsService.Mutate(
    customerId.ToString(), mutateOperations);
      

PHP

This example is not yet available in PHP; you can take a look at the other languages.
    

Python

# Create the experiment resource name using a temporary ID.
experiment_resource_name = googleads_service.experiment_path(
    customer_id, "-1"
)

# Create the experiment.
experiment_operation = client.get_type("MutateOperation")
experiment = experiment_operation.experiment_operation.create
experiment.resource_name = experiment_resource_name
experiment.name = f"ADOPT_AI_MAX Experiment #{uuid4()}"
experiment.type_ = client.enums.ExperimentTypeEnum.ADOPT_AI_MAX

# Create the control arm. Both arms in an intra-campaign experiment
# reference the same base campaign.
control_arm_operation = client.get_type("MutateOperation")
control_arm = control_arm_operation.experiment_arm_operation.create
control_arm.experiment = experiment_resource_name
control_arm.name = "Control Arm"
control_arm.control = True
control_arm.traffic_split = 50
control_arm.campaigns.append(
    googleads_service.campaign_path(customer_id, campaign_id)
)

# Create the treatment arm.
treatment_arm_operation = client.get_type("MutateOperation")
treatment_arm = treatment_arm_operation.experiment_arm_operation.create
treatment_arm.experiment = experiment_resource_name
treatment_arm.name = "Treatment Arm"
treatment_arm.control = False
treatment_arm.traffic_split = 50
treatment_arm.campaigns.append(
    googleads_service.campaign_path(customer_id, campaign_id)
)

# Create a campaign operation with an update mask to enable AI Max and
# configure asset automation settings.
# Note: For intra-campaign experiments, these settings are applied to the
# base campaign but are only active for the treatment traffic split.
campaign_operation = client.get_type("MutateOperation")
campaign = campaign_operation.campaign_operation.update
campaign.resource_name = googleads_service.campaign_path(
    customer_id, campaign_id
)
campaign.ai_max_setting.enable_ai_max = True

for asset_automation_type_enum in [
    client.enums.AssetAutomationTypeEnum.TEXT_ASSET_AUTOMATION,
    client.enums.AssetAutomationTypeEnum.FINAL_URL_EXPANSION_TEXT_ASSET_AUTOMATION,
]:
    asset_automation_setting = client.get_type(
        "Campaign"
    ).AssetAutomationSetting()
    asset_automation_setting.asset_automation_type = (
        asset_automation_type_enum
    )
    asset_automation_setting.asset_automation_status = (
        client.enums.AssetAutomationStatusEnum.OPTED_IN
    )
    campaign.asset_automation_settings.append(asset_automation_setting)

client.copy_from(
    campaign_operation.campaign_operation.update_mask,
    protobuf_helpers.field_mask(None, campaign._pb),
)

# Send all mutate operations in a single Mutate request.
mutate_operations = [
    experiment_operation,
    control_arm_operation,
    treatment_arm_operation,
    campaign_operation,
]

response = googleads_service.mutate(
    customer_id=customer_id,
    mutate_operations=mutate_operations,
)
      

Ruby

# Create the experiment resource name using a temporary ID.
experiment_resource_name = client.path.experiment(customer_id, "-1")

# Create the experiment.
experiment_operation = client.operation.mutate do |m|
  m.experiment_operation = client.operation.create_resource.experiment do |e|
    e.resource_name = experiment_resource_name
    e.name = "ADOPT_AI_MAX Experiment #{(Time.new.to_f * 1000).to_i}"
    e.type = :ADOPT_AI_MAX
  end
end

# Create the control arm. Both arms in an intra-campaign experiment
# reference the same base campaign.
campaign_resource_name = client.path.campaign(customer_id, campaign_id)
control_arm_operation = client.operation.mutate do |m|
  m.experiment_arm_operation = client.operation.create_resource.experiment_arm do |arm|
    arm.experiment = experiment_resource_name
    arm.name = "Control Arm"
    arm.control = true
    arm.traffic_split = 50
    arm.campaigns << campaign_resource_name
  end
end

# Create the treatment arm.
treatment_arm_operation = client.operation.mutate do |m|
  m.experiment_arm_operation = client.operation.create_resource.experiment_arm do |arm|
    arm.experiment = experiment_resource_name
    arm.name = "Treatment Arm"
    arm.control = false
    arm.traffic_split = 50
    arm.campaigns << campaign_resource_name
  end
end

# Create a campaign operation with an update mask to enable AI Max and
# configure asset automation settings.
# Note: For intra-campaign experiments, these settings are applied to the
# base campaign but are only active for the treatment traffic split.
campaign_operation = client.operation.mutate do |m|
  m.campaign_operation = client.operation.update_resource.campaign(campaign_resource_name) do |c|
    c.ai_max_setting = client.resource.ai_max_setting do |aims|
      aims.enable_ai_max = true
    end

    [:TEXT_ASSET_AUTOMATION, :FINAL_URL_EXPANSION_TEXT_ASSET_AUTOMATION].each do |type|
      c.asset_automation_settings << client.resource.asset_automation_setting do |setting|
        setting.asset_automation_type = type
        setting.asset_automation_status = :OPTED_IN
      end
    end
  end
end

# Send all mutate operations in a single Mutate request.
mutate_operations = [
  experiment_operation,
  control_arm_operation,
  treatment_arm_operation,
  campaign_operation,
]

response = client.service.google_ads.mutate(
  customer_id: customer_id,
  mutate_operations: mutate_operations,
)
      

Perl

This example is not yet available in Perl; you can take a look at the other languages.
    

curl

Báo cáo về thử nghiệm

Vì lưu lượng truy cập của nhóm đối chứng và nhóm thử nghiệm được kết hợp trong một chiến dịch, nên bạn phải sử dụng báo cáo thử nghiệm trực tiếp để so sánh các chỉ số giữa nhóm đối chứng và nhóm thử nghiệm. Báo cáo chuẩn ở cấp chiến dịch chỉ cho thấy các chỉ số tổng hợp cho toàn bộ chiến dịch và không thể phân biệt giữa hai nhóm.

Truy vấn GAQL sau đây truy xuất số liệu thống kê về lượt nhấp cho một ADOPT_AI_MAX thử nghiệm trong chiến dịch trong 30 ngày qua:

SELECT
  experiment.resource_name,
  experiment.name,
  metrics.clicks,
  metrics.control_clicks,
  metrics.clicks_point_estimate,
  metrics.clicks_p_value
FROM experiment
WHERE segments.date DURING LAST_30_DAYS
  AND experiment.type = 'ADOPT_AI_MAX'

Quảng bá, hoàn tất hoặc kết thúc thử nghiệm

Sau khi đánh giá kết quả, bạn có thể hoàn tất thử nghiệm bằng cách sử dụng ExperimentService:

  • Kết thúc: Nếu bạn không hài lòng với kết quả, hãy sử dụng EndExperiment. Tính năng này bị tắt và chiến dịch quay lại phân phát tất cả lưu lượng truy cập mà không có tính năng thử nghiệm. Đây là một thao tác đồng bộ.
  • Quảng bá (ADOPT_AI_MAX và ADOPT_BROAD_MATCH_KEYWORDS): Nếu bạn hài lòng với kết quả của một thử nghiệm trong chiến dịch Tìm kiếm, hãy sử dụng PromoteExperiment. Thao tác này sẽ áp dụng thay đổi thử nghiệm làm trạng thái cố định mới của chiến dịch. Đây là một thao tác không đồng bộ; hãy xem phần Lỗi không đồng bộ để biết thông tin chi tiết.
  • Graduate (PMAX_TEXT_CUSTOMIZATION_FINAL_URL_EXPANSION): PromoteExperiment không được hỗ trợ cho PMAX_TEXT_CUSTOMIZATION_FINAL_URL_EXPANSION; thay vào đó, hãy sử dụng GraduateExperiment để áp dụng chế độ cài đặt tuỳ chỉnh văn bản và mở rộng URL cuối cùng của nhóm can thiệp cho chiến dịch Tối đa hoá hiệu suất hiện có. Thêm một mục CampaignBudgetMapping vào campaign_budget_mappings để chỉ định chiến dịch của nhóm can thiệp (experiment_campaign) và ngân sách của nhóm đó (campaign_budget). Đây là một thao tác đồng bộ. (GraduateExperiment không được hỗ trợ cho ADOPT_AI_MAX hoặc ADOPT_BROAD_MATCH_KEYWORDS vì không có chiến dịch thử nghiệm riêng biệt để chuyển sang giai đoạn chính thức.)