آزمایش‌های درون کمپینی

آزمایش‌های درون کمپینی برای آزمایش یک ویژگی خاص در یک کمپین واحد استفاده می‌شوند. برخلاف آزمایش‌های مدیریت‌شده توسط سیستم که در آن‌ها ترافیک بین کمپین‌های کنترل و درمان تقسیم می‌شود، آزمایش‌های درون کمپینی، ترافیک را در داخل کمپین، بر اساس فعال بودن یا نبودن ویژگی، تقسیم می‌کنند.

این گردش کار برای مقادیر ExperimentType زیر پشتیبانی می‌شود:

  • ADOPT_AI_MAX
  • ADOPT_BROAD_MATCH_KEYWORDS

راه‌اندازی

  1. Experiment تعریف کنید و نوع آزمایش، بازوی کنترل (control ExperimentArm ) و بازوی درمان (treatment ExperimentArm را مشخص کنید. هر بازو باید به یک کمپین ارجاع دهد.
  2. با استفاده از یک ماسک فیلد، ویژگی تست را برای آزمایش فعال کنید. این برای ADOPT_BROAD_MATCH_KEYWORDS ضروری نیست ؛ در عوض، تنظیمات کمپین تطابق گسترده به طور خودکار پس از ایجاد آزمایش فعال می‌شود.
  3. یک درخواست GoogleAdsService.Mutate ارسال کنید که شامل عملیات جهش برای ایجاد آزمایش و بازوهای آزمایش و (در صورت وجود) فعال کردن ویژگی آزمایش باشد.

پس از راه‌اندازی، ترافیک درون کمپین به گونه‌ای تقسیم می‌شود که ۵۰٪ از ترافیک در معرض ویژگی فعال‌شده (گروه درمان) و ۵۰٪ در معرض آن نباشد (گروه کنترل).

جاوا

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

سی شارپ

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

پی اچ پی

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

پایتون

# 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,
)
      

روبی

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

پرل

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

حلقه زدن

گزارش آزمایش

از آنجا که ترافیک کنترل و درمان در یک کمپین واحد با هم مخلوط می‌شوند، باید از گزارش‌دهی مستقیم آزمایش برای مقایسه معیارها بین گروه‌های کنترل و درمان استفاده کنید. گزارش‌دهی استاندارد در سطح کمپین فقط معیارهای تجمیع‌شده را برای کل کمپین نشان می‌دهد و نمی‌تواند بین دو گروه تمایز قائل شود.

کوئری GAQL زیر می‌تواند برای بازیابی آمار کلیک برای یک آزمایش درون کمپینی ADOPT_AI_MAX استفاده شود.

SELECT
  experiment.resource_name,
  experiment.name,
  metrics.clicks,
  metrics.control_clicks,
  metrics.clicks_point_estimate,
  metrics.clicks_p_value
FROM experiment
WHERE experiment.type = 'ADOPT_AI_MAX'

آزمایش را ارتقا دهید یا پایان دهید

پس از ارزیابی نتایج، می‌توانید با استفاده از ExperimentService آزمایش را پایان دهید یا آن را ارتقا دهید.

  • پایان : اگر از نتایج راضی نیستید، EndExperiment استفاده کنید. این ویژگی غیرفعال می‌شود و کمپین به ارائه تمام ترافیک بدون ویژگی آزمایشی برمی‌گردد. این یک عملیات همزمان است.
  • Promote : اگر از نتایج راضی هستید، PromoteExperiment استفاده کنید. این تغییر آزمایشی را به عنوان وضعیت دائمی جدید کمپین اعمال می‌کند. این یک عملیات ناهمزمان است؛ برای جزئیات بیشتر به خطاهای ناهمزمان مراجعه کنید.

عملیات فارغ‌التحصیلی برای آزمایش‌های درون کمپینی پشتیبانی نمی‌شود زیرا هیچ کمپین درمانی جداگانه‌ای برای فارغ‌التحصیلی وجود ندارد.