如要評估廣告活動變更和廣告曝光時間對成效的影響,請在 Google Ads API 中查詢實驗和提升評估報表資源。
Google Ads API 支援兩種製作標準 A/B 實驗報表的方式:
- 直接實驗報表:查詢
experiment資源,取得指標。這個選項會在單一回應中提供控制組和實驗組的指標,以及升幅和 p 值等統計比較資料。直接實驗報表是唯一能產生廣告活動內實驗報表的方式。 - 廣告活動報表:使用
campaign.experiment_type欄位區分基礎和實驗廣告活動,查詢campaign資源的指標。這個選項僅適用於使用獨立控制組和實驗組廣告活動的實驗,例如系統管理實驗。
對於標準實驗,本指南主要著重於直接實驗報表,這類報表支援所有可產生報表的實驗類型。如要瞭解升幅評估研究,請參閱升幅報表指南,或本頁的品牌提升、轉換提升 (包括 A/B + 轉換提升) 和搜尋提升摘要部分。
直接實驗報表
如要擷取成效指標,以及所有支援的 Google Ads API 版本 (v23 以上) 中控制組和實驗組之間的統計比較,請直接查詢 experiment 資源。
指標和統計顯著程度
對於點擊、曝光、費用、轉換和轉換價值等核心指標,experiment 資源會在同一列中提供實驗組指標 (例如 metrics.clicks) 和控制組指標 (例如 metrics.control_clicks)。
experiment 資源也提供欄位,協助您評估實驗組之間差異的統計顯著程度:
metrics.*_p_value:如果實驗對指標沒有實際影響,觀察到的結果至少與測得差異一樣極端的機率。p 值越低,統計顯著程度越高。metrics.*_point_estimate:實驗組與控制組相比,指定指標的預估升幅百分比 (正值或負值)。這個值與metrics.*_margin_of_error欄位搭配使用,可定義預估差異的信賴區間,並指定信賴水準。預估數量為(treatment / control) - 1,點估計值是信賴區間的中心。metrics.*_margin_of_error:信賴區間的半徑,以metrics.*_point_estimate值為中心。API 會根據實驗類型,計算指定信賴水準的誤差範圍。
experiment 資源支援下列核心指標欄位,包括實驗組值、控制組值,以及先前列出的統計資料欄位:
clicksimpressionscost_microsconversionscost_per_conversionconversion_valueconversion_value_per_cost
具體來說,轉換的統計欄位可透過下列 absolute_change 欄位取得,而非相對值:
metrics.conversions_absolute_change_p_value:虛無假設的 p 值,假設實驗對轉換絕對變化沒有影響。範圍介於 0 到 1。metrics.conversions_absolute_change_point_estimate:預估實驗對轉換絕對變化量的影響時,所採用的點估計值。metrics.conversions_absolute_change_margin_of_error:估算實驗對轉換絕對變化量的影響時,所產生的誤差範圍。
如需協助建構 experiment 資源的有效查詢,請使用 Google Ads 查詢建立工具。
查詢示例
下列 Google Ads 查詢語言 (GAQL) 查詢會擷取實驗的主要指標:
SELECT
experiment.experiment_id,
experiment.name,
experiment.type,
metrics.clicks,
metrics.control_clicks,
metrics.clicks_point_estimate,
metrics.clicks_margin_of_error,
metrics.clicks_p_value,
metrics.conversions,
metrics.control_conversions,
metrics.conversions_absolute_change_point_estimate,
metrics.conversions_absolute_change_margin_of_error,
metrics.conversions_absolute_change_p_value
FROM experiment
WHERE experiment.experiment_id = EXPERIMENT_ID
更改下列內容:
EXPERIMENT_ID:實驗的整數 ID (experiment.experiment_id)。
解讀結果
請使用 p 值、點估計值和誤差範圍欄位,判斷實驗是否產生具統計顯著性的結果。舉例來說,如果 metrics.conversions_absolute_change_p_value 指標小於您選擇的門檻 (例如 0.05 代表 95% 信賴水準),且 metrics.conversions_absolute_change_point_estimate 指標減去 metrics.conversions_absolute_change_margin_of_error 指標大於零,則實驗組的轉換成效明顯優於控制組。
以下程式碼範例說明如何根據 p 值和升幅預估值評估結果:
Java
private void evaluateExperiment( GoogleAdsClient googleAdsClient, long customerId, GoogleAdsRow row) { Metrics metrics = row.getMetrics(); String experimentResourceName = row.getExperiment().getResourceName(); // 1. Evaluate conversion success as a primary success signal if available. // - Point Estimate: Represents the estimated average lift or difference in conversions. // - Margin of Error: Outlines the confidence interval bounds. Note that the margin_of_error // provided by the API is calculated for a preset confidence level which is set based on the // experiment type. // - Lower Bound: (Point Estimate - Margin of Error). If this value is above 0, // we have statistical significance that performance has improved. double convPValue = metrics.getConversionsAbsoluteChangePValue(); double convLift = metrics.getConversionsAbsoluteChangePointEstimate(); double convError = metrics.getConversionsAbsoluteChangeMarginOfError(); double convLowerBound = convLift - convError; if (convPValue <= P_VALUE_THRESHOLD) { if (convLowerBound > 0) { System.out.printf( "Significant Success: Conversions increased. Even at the lower bound, the lift is %.2f." + " Promoting changes.%n", convLowerBound); promoteExperiment(googleAdsClient, customerId, experimentResourceName); return; } else if ((convLift + convError) < 0) { System.out.printf( "Significant Decline: Even the upper bound (%.2f) is below zero. Ending experiment.%n", convLift + convError); endExperiment(googleAdsClient, customerId, experimentResourceName); return; } } // 2. Fall back to evaluating click metrics if conversions are inconclusive. double clickPValue = metrics.getClicksPValue(); double clickLift = metrics.getClicksPointEstimate(); double clickError = metrics.getClicksMarginOfError(); double clickLowerBound = clickLift - clickError; if (clickPValue <= P_VALUE_THRESHOLD && clickLowerBound > 0) { System.out.printf("Click volume is significantly up (+%.1f%%).%n", clickLift * 100); // Graduation is only supported for separate campaign experiments, not // intra-campaign experiments where there is no separate treatment campaign. ExperimentType experimentType = row.getExperiment().getType(); if (experimentType != ExperimentType.ADOPT_BROAD_MATCH_KEYWORDS && experimentType != ExperimentType.ADOPT_AI_MAX) { System.out.println("Graduating treatment campaign for further manual analysis."); graduateExperiment(googleAdsClient, customerId, experimentResourceName); } else { System.out.println( "Intra-campaign trial detected: graduation is not supported. Continuing to run the" + " experiment to gather more conversion data."); } } else { // 3. Print status if no action was taken. System.out.printf( "Inconclusive: No significant lift in Conversions (p=%.2f) or Clicks (p=%.2f). Current" + " estimated lift: %.2f +/- %.2f. Allowing the experiment to continue running.%n", convPValue, clickPValue, convLift, convError); } }
C#
private static void EvaluateExperiment(GoogleAdsClient client, long customerId, GoogleAdsRow row) { // This function evaluates performance metrics and immediately takes action // to update the experiment's status (promote, end, or graduate) if // statistical significance thresholds are met. var metrics = row.Metrics; string experimentResourceName = row.Experiment.ResourceName; bool hasConvMetrics = metrics.HasConversionsAbsoluteChangePValue && metrics.HasConversionsAbsoluteChangePointEstimate && metrics.HasConversionsAbsoluteChangeMarginOfError; bool hasClickMetrics = metrics.HasClicksPValue && metrics.HasClicksPointEstimate && metrics.HasClicksMarginOfError; // 1. Evaluate conversion success as a primary success signal if available. // - Point Estimate: Represents the estimated average lift or difference in conversions. // - Margin of Error: Outlines the confidence interval bounds. Note that the margin_of_error // provided by the API is calculated for a preset confidence level which is set based on // the experiment type. // - Lower Bound: (Point Estimate - Margin of Error). If this value is above 0, // we have statistical significance that performance has improved. if (hasConvMetrics) { double convPValue = metrics.ConversionsAbsoluteChangePValue; double convLift = metrics.ConversionsAbsoluteChangePointEstimate; double convError = metrics.ConversionsAbsoluteChangeMarginOfError; double convLowerBound = convLift - convError; if (convPValue <= P_VALUE_THRESHOLD) { if (convLowerBound > 0) { Console.WriteLine( $"Significant Success: Conversions increased. Even at the lower" + $" bound, the lift is {convLowerBound:F2}. Promoting changes."); PromoteExperiment(client, customerId, experimentResourceName); return; } else if ((convLift + convError) < 0) { Console.WriteLine( $"Significant Decline: Even the upper bound ({convLift + convError:F2}) " + $"is below zero. Ending experiment."); EndExperiment(client, customerId, experimentResourceName); return; } } } // 2. Evaluate click volume as a secondary signal. // This is helpful as an early indicator or for lower-volume accounts. if (hasClickMetrics) { double clickPValue = metrics.ClicksPValue; double clickLift = metrics.ClicksPointEstimate; double clickError = metrics.ClicksMarginOfError; double clickLowerBound = clickLift - clickError; if (clickPValue <= P_VALUE_THRESHOLD && clickLowerBound > 0) { // We have a directional winner: high confidence in more traffic, // but not enough data to confirm conversion impact yet. Console.WriteLine( $"Click volume is significantly up (+{clickLift * 100:F1}%)."); // Graduation is only supported for separate campaign experiments, not // intra-campaign experiments where there is no separate treatment campaign. if (row.Experiment.Type != ExperimentType.AdoptBroadMatchKeywords && row.Experiment.Type != ExperimentType.AdoptAiMax) { Console.WriteLine("Graduating treatment campaign for further manual analysis."); GraduateExperiment(client, customerId, experimentResourceName); } else { Console.WriteLine( "Intra-campaign trial detected: graduation is not supported. " + "Continuing to run the experiment to gather more conversion data."); } return; } } // 3. Print status if no action was taken. if (hasConvMetrics || hasClickMetrics) { string convStatus = hasConvMetrics ? $"Conversions (p={metrics.ConversionsAbsoluteChangePValue:F2}, " + $"lift={metrics.ConversionsAbsoluteChangePointEstimate:F2} +/- " + $"{metrics.ConversionsAbsoluteChangeMarginOfError:F2})" : "Conversions (not populated)"; string clickStatus = hasClickMetrics ? $"Clicks (p={metrics.ClicksPValue:F2}, " + $"lift={metrics.ClicksPointEstimate:F2} +/- " + $"{metrics.ClicksMarginOfError:F2})" : "Clicks (not populated)"; Console.WriteLine( $"Inconclusive: No significant action taken. {convStatus}, {clickStatus}. " + "Allowing the experiment to continue running."); } else { Console.WriteLine( "Conversion and click performance metrics are not yet populated. " + "Allowing the experiment to continue running."); } }
PHP
This example is not yet available in PHP; you can take a look at the other languages.
Python
def evaluate_experiment( client: GoogleAdsClient, customer_id: str, row: GoogleAdsRow ) -> None: """Evaluates the performance of the experiment and updates it accordingly (for example, promotes, ends, or graduates). Checks conversion and click metrics against statistical significance thresholds to determine the appropriate action to take on the experiment. Args: client: an initialized GoogleAdsClient instance. customer_id: a client customer ID. row: a GoogleAdsRow containing the experiment and metrics. """ # This function evaluates performance metrics and immediately takes action # to update the experiment's status (promote, end, or graduate) if # statistical significance thresholds are met. metrics = row.metrics experiment_resource_name = row.experiment.resource_name has_conv_metrics = ( "conversions_absolute_change_p_value" in metrics and "conversions_absolute_change_point_estimate" in metrics and "conversions_absolute_change_margin_of_error" in metrics ) has_click_metrics = ( "clicks_p_value" in metrics and "clicks_point_estimate" in metrics and "clicks_margin_of_error" in metrics ) # 1. Evaluate conversion success as a primary success signal if available. # - Point Estimate: Represents the estimated average lift or difference in conversions. # - Margin of Error: Outlines the confidence interval bounds. Note that the margin_of_error provided by the API is calculated for a preset confidence level which is set based on the experiment type. # - Lower Bound: (Point Estimate - Margin of Error). If this value is above 0, # we have statistical significance that performance has improved. if has_conv_metrics: conv_p_value = metrics.conversions_absolute_change_p_value conv_lift = metrics.conversions_absolute_change_point_estimate conv_error = metrics.conversions_absolute_change_margin_of_error conv_lower_bound = conv_lift - conv_error if conv_p_value <= P_VALUE_THRESHOLD: if conv_lower_bound > 0: print( "Significant Success: Conversions increased. Even at the lower" f" bound, the lift is {conv_lower_bound:.2f}. Promoting" " changes." ) promote_experiment( client, customer_id, experiment_resource_name ) return elif (conv_lift + conv_error) < 0: print( "Significant Decline: Even the upper bound" f" ({conv_lift + conv_error:.2f}) is below zero. Ending" " experiment." ) end_experiment(client, customer_id, experiment_resource_name) return # 2. Evaluate click volume as a secondary signal. # This is helpful as an early indicator or for lower-volume accounts. click_p_value = metrics.clicks_p_value click_lift = metrics.clicks_point_estimate click_error = metrics.clicks_margin_of_error click_lower_bound = click_lift - click_error if click_p_value <= P_VALUE_THRESHOLD and click_lower_bound > 0: # We have a directional winner: high confidence in more traffic, # but not enough data to confirm conversion impact yet. print(f"Click volume is significantly up (+{click_lift*100:.1f}%).") # Graduation is only supported for separate campaign experiments, not # intra-campaign experiments where there is no separate treatment campaign. experiment_type_name = row.experiment.type_.name if ( experiment_type_name != "ADOPT_BROAD_MATCH_KEYWORDS" and experiment_type_name != "ADOPT_AI_MAX" ): print( "Graduating treatment campaign for further manual analysis." ) graduate_experiment( client, customer_id, experiment_resource_name ) else: print( "Intra-campaign trial detected: graduation is not supported. " "Continuing to run the experiment to gather more conversion data." ) return # 3. Print status if no action was taken. if has_conv_metrics or has_click_metrics: conv_status = ( f"Conversions (p={metrics.conversions_absolute_change_p_value:.2f}, " f"lift={metrics.conversions_absolute_change_point_estimate:.2f} +/- " f"{metrics.conversions_absolute_change_margin_of_error:.2f})" if has_conv_metrics else "Conversions (not populated)" ) click_status = ( f"Clicks (p={metrics.clicks_p_value:.2f}, " f"lift={metrics.clicks_point_estimate:.2f} +/- " f"{metrics.clicks_margin_of_error:.2f})" if has_click_metrics else "Clicks (not populated)" ) print( f"Inconclusive: No significant action taken. {conv_status}, {click_status}." " Allowing the experiment to continue running." ) else: print( "Conversion and click performance metrics are not yet populated. " "Allowing the experiment to continue running." )
小茹
def evaluate_experiment(client, customer_id, row) # This function evaluates performance metrics and immediately takes action # to update the experiment's status (promote, end, or graduate) if # statistical significance thresholds are met. metrics = row.metrics experiment_resource_name = row.experiment.resource_name has_conv_metrics = !metrics.nil? && metrics.has_conversions_absolute_change_p_value? && metrics.has_conversions_absolute_change_point_estimate? && metrics.has_conversions_absolute_change_margin_of_error? has_click_metrics = !metrics.nil? && metrics.has_clicks_p_value? && metrics.has_clicks_point_estimate? && metrics.has_clicks_margin_of_error? # 1. Evaluate conversion success as a primary success signal if available. # - Point Estimate: Represents the estimated average lift or difference in conversions. # - Margin of Error: Outlines the confidence interval bounds. Note that the margin_of_error # provided by the API is calculated for a preset confidence level which is set based on the experiment type. # - Lower Bound: (Point Estimate - Margin of Error). If this value is above 0, # we have statistical significance that performance has improved. if has_conv_metrics conv_p_value = metrics.conversions_absolute_change_p_value conv_lift = metrics.conversions_absolute_change_point_estimate conv_error = metrics.conversions_absolute_change_margin_of_error conv_lower_bound = conv_lift - conv_error if conv_p_value <= P_VALUE_THRESHOLD if conv_lower_bound > 0 puts sprintf( "Significant Success: Conversions increased. Even at the lower " \ "bound, the lift is %.2f. Promoting changes.", conv_lower_bound, ) promote_experiment(client, customer_id, experiment_resource_name) return elsif (conv_lift + conv_error) < 0 puts sprintf( "Significant Decline: Even the upper bound (%.2f) is below zero. " \ "Ending experiment.", conv_lift + conv_error, ) end_experiment(client, customer_id, experiment_resource_name) return end end end # 2. Evaluate click volume as a secondary signal. # This is helpful as an early indicator or for lower-volume accounts. if has_click_metrics click_p_value = metrics.clicks_p_value click_lift = metrics.clicks_point_estimate click_error = metrics.clicks_margin_of_error click_lower_bound = click_lift - click_error if click_p_value <= P_VALUE_THRESHOLD && click_lower_bound > 0 # We have a directional winner: high confidence in more traffic, # but not enough data to confirm conversion impact yet. puts sprintf("Click volume is significantly up (+%.1f%%).", click_lift * 100) # Graduation is only supported for separate campaign experiments, not # intra-campaign experiments where there is no separate treatment campaign. experiment_type = row.experiment.type if experiment_type != :ADOPT_BROAD_MATCH_KEYWORDS && experiment_type != :ADOPT_AI_MAX puts "Graduating treatment campaign for further manual analysis." graduate_experiment(client, customer_id, experiment_resource_name) else puts "Intra-campaign trial detected: graduation is not supported. " \ "Continuing to run the experiment to gather more conversion data." end return end end # 3. Print status if no action was taken. if has_conv_metrics || has_click_metrics conv_status = if has_conv_metrics sprintf( "Conversions (p=%.2f, lift=%.2f +/- %.2f)", metrics.conversions_absolute_change_p_value, metrics.conversions_absolute_change_point_estimate, metrics.conversions_absolute_change_margin_of_error, ) else "Conversions (not populated)" end click_status = if has_click_metrics sprintf( "Clicks (p=%.2f, lift=%.2f +/- %.2f)", metrics.clicks_p_value, metrics.clicks_point_estimate, metrics.clicks_margin_of_error, ) else "Clicks (not populated)" end puts "Inconclusive: No significant action taken. #{conv_status}, #{click_status}. " \ "Allowing the experiment to continue running." else puts "Conversion and click performance metrics are not yet populated. " \ "Allowing the experiment to continue running." end end
Perl
This example is not yet available in Perl; you can take a look at the other languages.
curl
相較於廣告活動報表的優點
與分別查詢廣告活動報表相比,直接實驗報表有幾項優點:
- 集中式指標:在單一資料列中擷取控制組和實驗組的指標。
- 統計信賴資料:提供計算出的 p 值、點估計值和誤差範圍。
- 效率:不必手動彙整或比較多份報表的結果。
- 廣告活動內支援:支援廣告活動內實驗的控制組與實驗組比較,其中流量會在單一廣告活動內拆分。
廣告活動報表
在所有支援的 Google Ads API 版本 (v23 以上版本) 中,如果實驗會建立獨立的實驗組廣告活動 (例如 SEARCH_CUSTOM),您可以查詢 campaign 資源,並使用 campaign.experiment_type 欄位來識別 BASE (控制組) 和 EXPERIMENT (實驗組) 廣告活動。如需更精細地劃分指標 (例如依廣告群組或關鍵字),或查看 experiment 資源未提供的廣告活動中繼資料,這種做法會很有幫助。不過,廣告活動報表需要您手動進行成效比較和統計計算。
您無法使用廣告活動層級報表,比較廣告活動內實驗的分組,因為流量拆分是在單一廣告活動內部進行。查詢廣告活動內實驗的 campaign 資源時,只會傳回匯總總計。
品牌提升報表
在 Google Ads API v25 以上版本中,您可以查詢唯讀 (OUTPUT_ONLY) LiftMeasurementFlight、LiftMeasurementConfig 和品牌提升細目資源 (LiftMeasurementAgeRange、LiftMeasurementCampaign、LiftMeasurementDevice、LiftMeasurementGender 和 LiftMeasurementVideo),評估廣告活動對品牌觀感的影響。在 Google Ads API v27 以上版本中,您也可以選取 lift_guidance 欄位 (lift_guidance.outcome 和 lift_guidance.guidance_message),進行資料列層級的統計解讀。
如要瞭解問卷調查回覆可記錄門檻、空回覆 (results: []) 診斷、結果解讀和 GAQL 查詢範例,請參閱「提升」報表指南中的「品牌提升報表」一節。
轉換提升報表
在 Google Ads API v25 以上版本中,轉換提升報表會比較每日累積評估數據匯報 (segments.conversion_lift_start_date 和 segments.conversion_lift_end_date) 中,LiftMeasurementConfig 資源的曝光組和未曝光控制組,評估廣告對轉換、轉換價值、單次轉換增量費用 (iCPA) 和廣告投資報酬率增幅 (iROAS) 的增量影響。在 Google Ads API 26 以上版本中,您也可以透過 campaign.lift_measurement_config 和 lift_measurement_config.campaigns 欄位,找出連結的設定和廣告活動。在 Google Ads API 27 以上版本中,則可選取 lift_measurement_config.lift_guidance,進行資料列層級的統計資料解讀。
如要瞭解研究和檔期探索、累計數據匯報日期範圍、轉換動作範圍 (SELECTED 與 ALL)、維度細目、可製作報表門檻,以及 GAQL 查詢範例,請參閱「提升」報表指南中的「轉換提升報表」一節。
A/B + 轉換提升報表
在 Google Ads API v25 以上版本中,A/B + 轉換提升研究會結合雙組experiment (透過 ExperimentArm 資源和 experiment.lift_measurement_config 欄位發現),以及 LiftMeasurementConfig 資源的控制組評估。納入 segments.experiment_arm 區隔和貝氏勝出分數指標 (metrics.*_winner_score),評估各實驗組的因果提升和勝出機率。
如要瞭解實驗組探索、各組和合併組查詢、勝出分數解讀,以及多項研究批次查詢,請參閱提升報表指南中的「A/B + 轉換提升報表」一節。
搜尋提升報表
在 Google Ads API v26 以上版本中,搜尋提升報表會評估廣告活動在 Google 搜尋和 YouTube 上,促成的自然搜尋查詢量增幅。查詢 SearchLiftKeywordBundle 資源,取得已設定的關鍵字組合,並查詢 LiftMeasurementConfig 資源 (在 Google Ads API v27 以上版本中為 lift_measurement_config.lift_guidance),取得相對和標準化的搜尋次數增幅指標。
如需搜尋提升區隔規則、指標定義和 GAQL 查詢範例,請參閱提升報表指南中的「搜尋提升報表」一節。
最佳做法
下列最佳做法適用於標準 A/B 實驗 (例如廣告活動和廣告活動內實驗)。提升評估研究 (品牌提升、轉換提升和搜尋提升) 採用研究專屬設定,並回報 90% 單邊信賴界限 (*_p90_lower_bound 和 *_p90_upper_bound,兩者與 p_value <= 0.10 共同構成 80% 雙邊信賴區間),而非 95% 信賴門檻。如要瞭解提升研究門檻和解讀方式,請參閱提升報表指南。
- 選取適當的信賴水準:設定較低的 p 值門檻,可更快取得方向指引,尤其是在預算或轉換量較低的情況下。95% 信賴水準 (
p_value <= 0.05) 是學術標準,可在較長的時間範圍內提供更高的精確度。 - 實驗時間應足夠:實驗應執行至少 4 週,才能考量到每週成效週期、轉換延遲和學習期。
- 預留適應期:如果廣告活動採用自動出價或測試新功能,請忽略前 1 到 2 週的資料,讓出價模式和流量等級能根據分配比例重新校準。
- 採用 50/50 的分配比例:採用 50/50 的流量分配比例,通常最快能取得具統計顯著性的結果。
- 提前安排:將實驗開始日期設在 3 到 7 天後,預留廣告審查和核准程序所需的時間。