廣告活動內實驗用於測試單一廣告活動「內」的特定功能。系統管理的實驗會將流量分配給控制組和實驗組廣告活動,而廣告活動內實驗則會根據功能是否啟用,在廣告活動內分配流量。
這項工作流程支援下列 ExperimentType 值:
ADOPT_AI_MAX- 測試 AI Max 功能對搜尋廣告活動的影響。
ADOPT_BROAD_MATCH_KEYWORDS- 測試廣泛比對關鍵字對搜尋廣告活動的影響。
PMAX_TEXT_CUSTOMIZATION_FINAL_URL_EXPANSION- 專門用於測試最高成效廣告活動功能:文字自訂和最終到達網址擴展。啟用後,Google AI 會將流量帶往相關到達網頁,並生成文字素材資源,進一步提升搜尋查詢比對成效。
設定
- 定義
Experiment(status設為ENABLED),並提供實驗類型、控制組ExperimentArm和實驗組ExperimentArm:- 如果是
ADOPT_AI_MAX和ADOPT_BROAD_MATCH_KEYWORDS,控制組和實驗組都必須參照campaigns中的同一個廣告活動。 - 如果是
PMAX_TEXT_CUSTOMIZATION_FINAL_URL_EXPANSION,只有實驗組會指定campaigns中的最高成效廣告活動 (控制組的campaigns則不設定)。
- 如果是
針對
ADOPT_AI_MAX,請使用欄位遮罩建立CampaignOperation更新,以啟用ai_max_setting.enable_ai_max並設定asset_automation_settings。傳送
GoogleAdsService.Mutate要求,其中包含建立實驗和實驗組的變動操作,以及 (針對ADOPT_AI_MAX) 啟用廣告活動的測試功能。
如果是ADOPT_AI_MAX和ADOPT_BROAD_MATCH_KEYWORDS,廣告活動內的流量必須平均分配 (50/50),讓 50% 的流量接觸到啟用的功能 (實驗組),另外 50% 則不會 (控制組)。PMAX_TEXT_CUSTOMIZATION_FINAL_URL_EXPANSION 支援自訂流量分配,總和須為 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, )
小茹
# 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
實驗報表
由於控制組和實驗組流量會混在同一個廣告活動中,因此您必須使用直接實驗報表,比較控制組和實驗組的指標。標準廣告活動層級報表只會顯示整個廣告活動的匯總指標,無法區分這兩個群組。
下列 GAQL 查詢會擷取ADOPT_AI_MAX廣告活動內實驗過去 30 天的點擊統計資料:
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'
套用、結束或終止實驗
評估結果後,您可以使用 ExperimentService 完成實驗:
- 結束:如果對結果不滿意,請使用
EndExperiment。這項功能會停用,廣告活動會恢復放送所有流量,不使用實驗功能。這項作業會同步執行。 - Promote (
ADOPT_AI_MAX和ADOPT_BROAD_MATCH_KEYWORDS):如果您對搜尋廣告活動內實驗的結果感到滿意,請使用PromoteExperiment。這樣一來,實驗變更就會成為廣告活動的新永久狀態。這項作業為非同步作業,詳情請參閱「非同步錯誤」。 - Graduate (
PMAX_TEXT_CUSTOMIZATION_FINAL_URL_EXPANSION):PromoteExperiment不支援PMAX_TEXT_CUSTOMIZATION_FINAL_URL_EXPANSION;請改用GraduateExperiment,將實驗組的文字自訂和最終到達網址擴展設定,直接套用至現有的最高成效廣告活動。在campaign_budget_mappings中加入CampaignBudgetMapping項目,指定實驗組的廣告活動 (experiment_campaign) 和預算 (campaign_budget)。這項作業會同步執行。(ADOPT_AI_MAX或ADOPT_BROAD_MATCH_KEYWORDS不支援GraduateExperiment,因為沒有獨立的實驗廣告活動可升級)。