Google 広告では、広告インタラクションに続く価値のあるユーザー アクション(商品の購入、リードフォームの送信、ビジネスへの電話、実店舗への来店など)をコンバージョンと呼びます。コンバージョン トラッキングでは、これらの顧客インタラクションを測定して、キャンペーンのパフォーマンスを評価し、自動入札を最適化できます。
Google Ads API を使用すると、コンバージョン アクションの構成、オフライン コンバージョン イベントのインポート、記録されたコンバージョンの拡張または調整、アクションの入札目標とライフサイクル目標へのグループ化、アップロード診断のモニタリングをプログラムで行うことができます。
コンバージョン ワークフローを選択する
次の表を使用して、ユースケースの ConversionActionType、API サービス、実装ガイドを特定します。
エンドツーエンドのコンバージョン ライフサイクル
Google Ads API でのコンバージョン管理の統合は、次の 4 つの段階に分かれています。
- アカウント設定を確認してコンバージョン アクションを作成する:
Customer.conversion_tracking_settingをクエリして、有効なコンバージョン アカウント(google_ads_conversion_customer)を確認し、コンバージョン トラッキングが有効であることを確認して、ユーザーの同意を設定し、ターゲットConversionActionTypeとConversionActionCategoryを使用してConversionActionを作成します。 - コンバージョン イベントをインポートする:
partial_failureをtrueに設定したConversionUploadServiceを使用してオフラインのクリック コンバージョンまたは通話コンバージョンをストリーミングする、ConversionAdjustmentUploadServiceを使用してENHANCEMENT調整でウェブサイト コンバージョンを補完する、OfflineUserDataJobServiceを使用して店舗販売を一括アップロードする。 - コンバージョンの調整と最適化:
ConversionAdjustmentUploadServiceを使用して、記録されたコンバージョンの取り消しや修正、ConversionCustomVariableメタデータの追加、コンバージョン値のルールの適用、アクションのコンバージョン目標とライフサイクル目標への整理を行い、入札の最適化を管理します。 - 診断をモニタリングしてパフォーマンスをレポートする:
offline_conversion_upload_client_summaryとoffline_conversion_upload_conversion_action_summaryをクエリして、アップロード処理のステータスと部分的な失敗のアラートを検査します。customerリソースまたはcampaignリソース(必要に応じてsegments.conversion_actionでセグメント化)をクエリして、metrics.conversions指標とmetrics.all_conversions指標を比較します。または、conversion_actionリソースをクエリして、metrics.all_conversionsと最後のコンバージョンのタイムスタンプを調べます。
クイックスタート: 設定の確認、アクションの作成、健全性の確認
次の例は、コンバージョン トラッキングの初期化とモニタリングに必要な、最も一般的な 3 つのクエリとミューテーションを示しています。
1. GAQL でコンバージョン トラッキングの設定を確認する
ConversionAction を作成したり、イベントをアップロードしたりする前に、GoogleAdsService.SearchStream を使用して customer リソースをクエリし、コンバージョンを管理するアカウント(google_ads_conversion_customer)、顧客データに関する規約に同意しているかどうか、アカウント単位の拡張コンバージョンが有効になっているかどうか(EnhancedConversionsConfig)を確認します。
SELECT
customer.conversion_tracking_setting.conversion_tracking_id,
customer.conversion_tracking_setting.conversion_tracking_status,
customer.conversion_tracking_setting.cross_account_conversion_tracking_id,
customer.conversion_tracking_setting.google_ads_conversion_customer,
customer.conversion_tracking_setting.accepted_customer_data_terms,
customer.conversion_tracking_setting.enablement_setting,
customer.conversion_tracking_setting.effective_enablement_setting
FROM customer
google_ads_conversion_customer で返された customers/{customer_id} リソース名から {customer_id} を抽出し、そのお客様 ID に対して後続のすべての ConversionActionService リクエストと ConversionUploadService リクエストを発行します。設定とクロスアカウント階層の詳細については、スタートガイドをご覧ください。
2. コンバージョン アクションを作成する
ConversionActionService.MutateConversionActions を使用して ConversionAction を作成します。次の例では、カスタム値とルックバック設定を使用して UPLOAD_CLICKS コンバージョン アクションを作成します。
Java
private void runExample(GoogleAdsClient googleAdsClient, long customerId) { // Creates a ConversionAction. ConversionAction conversionAction = ConversionAction.newBuilder() // Note that conversion action names must be unique. If a conversion action already // exists with the specified conversion_action_name the create operation will fail with // a ConversionActionError.DUPLICATE_NAME error. .setName("Earth to Mars Cruises Conversion #" + getPrintableDateTime()) .setCategory(ConversionActionCategory.DEFAULT) .setType(ConversionActionType.WEBPAGE) .setStatus(ConversionActionStatus.ENABLED) .setViewThroughLookbackWindowDays(15L) .setValueSettings( ValueSettings.newBuilder() .setDefaultValue(23.41) .setAlwaysUseDefaultValue(true) .build()) .build(); // Creates the operation. ConversionActionOperation operation = ConversionActionOperation.newBuilder().setCreate(conversionAction).build(); try (ConversionActionServiceClient conversionActionServiceClient = googleAdsClient.getLatestVersion().createConversionActionServiceClient()) { MutateConversionActionsResponse response = conversionActionServiceClient.mutateConversionActions( Long.toString(customerId), Collections.singletonList(operation)); System.out.printf("Added %d conversion actions:%n", response.getResultsCount()); for (MutateConversionActionResult result : response.getResultsList()) { System.out.printf( "New conversion action added with resource name: '%s'%n", result.getResourceName()); } } }
C#
public void Run(GoogleAdsClient client, long customerId) { // Get the ConversionActionService. ConversionActionServiceClient conversionActionService = client.GetService(Services.V26.ConversionActionService); // Note that conversion action names must be unique. // If a conversion action already exists with the specified name the create operation // will fail with a ConversionAction.DUPLICATE_NAME error. string ConversionActionName = "Earth to Mars Cruises Conversion #" + ExampleUtilities.GetRandomString(); // Add a conversion action. ConversionAction conversionAction = new ConversionAction() { Name = ConversionActionName, Category = ConversionActionCategory.Default, Type = ConversionActionType.Webpage, Status = ConversionActionStatus.Enabled, ViewThroughLookbackWindowDays = 15, ValueSettings = new ConversionAction.Types.ValueSettings() { DefaultValue = 23.41, AlwaysUseDefaultValue = true } }; // Create the operation. ConversionActionOperation operation = new ConversionActionOperation() { Create = conversionAction }; try { // Create the conversion action. MutateConversionActionsResponse response = conversionActionService.MutateConversionActions(customerId.ToString(), new ConversionActionOperation[] { operation }); // Display the results. foreach (MutateConversionActionResult newConversionAction in response.Results) { Console.WriteLine($"New conversion action with resource name = " + $"'{newConversionAction.ResourceName}' was added."); } } catch (GoogleAdsException e) { Console.WriteLine("Failure:"); Console.WriteLine($"Message: {e.Message}"); Console.WriteLine($"Failure: {e.Failure}"); Console.WriteLine($"Request ID: {e.RequestId}"); throw; } }
PHP
public static function runExample(GoogleAdsClient $googleAdsClient, int $customerId) { // Creates a conversion action. $conversionAction = new ConversionAction( [ // Note that conversion action names must be unique. // If a conversion action already exists with the specified conversion_action_name // the create operation will fail with a ConversionActionError.DUPLICATE_NAME error. 'name' => 'Earth to Mars Cruises Conversion #' . Helper::getPrintableDatetime(), 'category' => ConversionActionCategory::PBDEFAULT, 'type' => ConversionActionType::WEBPAGE, 'status' => ConversionActionStatus::ENABLED, 'view_through_lookback_window_days' => 15, 'value_settings' => new ValueSettings( [ 'default_value' => 23.41, 'always_use_default_value' => true ] ) ] ); // Creates a conversion action operation. $conversionActionOperation = new ConversionActionOperation(); $conversionActionOperation->setCreate($conversionAction); // Issues a mutate request to add the conversion action. $conversionActionServiceClient = $googleAdsClient->getConversionActionServiceClient(); $response = $conversionActionServiceClient->mutateConversionActions( MutateConversionActionsRequest::build($customerId, [$conversionActionOperation]) ); printf("Added %d conversion actions:%s", $response->getResults()->count(), PHP_EOL); foreach ($response->getResults() as $addedConversionAction) { /** * @var ConversionAction $addedConversionAction */ printf( "New conversion action added with resource name: '%s'%s", $addedConversionAction->getResourceName(), PHP_EOL ); } }
Python
def main(client: GoogleAdsClient, customer_id: str) -> None: conversion_action_service: ConversionActionServiceClient = ( client.get_service("ConversionActionService") ) # Create the operation. conversion_action_operation: ConversionActionOperation = client.get_type( "ConversionActionOperation" ) # Create conversion action. conversion_action: ConversionAction = conversion_action_operation.create # Note that conversion action names must be unique. If a conversion action # already exists with the specified conversion_action_name, the create # operation will fail with a ConversionActionError.DUPLICATE_NAME error. conversion_action.name = f"Earth to Mars Cruises Conversion {uuid.uuid4()}" conversion_action.type_ = ( client.enums.ConversionActionTypeEnum.UPLOAD_CLICKS ) conversion_action.category = ( client.enums.ConversionActionCategoryEnum.DEFAULT ) conversion_action.status = client.enums.ConversionActionStatusEnum.ENABLED conversion_action.view_through_lookback_window_days = 15 # Create a value settings object. value_settings: ConversionAction.ValueSettings = ( conversion_action.value_settings ) value_settings.default_value = 15.0 value_settings.always_use_default_value = True # Add the conversion action. conversion_action_response: MutateConversionActionsResponse = ( conversion_action_service.mutate_conversion_actions( customer_id=customer_id, operations=[conversion_action_operation], ) ) print( "Created conversion action " f'"{conversion_action_response.results[0].resource_name}".' )
Ruby
def add_conversion_action(customer_id) # GoogleAdsClient will read a config file from # ENV['HOME']/google_ads_config.rb when called without parameters client = Google::Ads::GoogleAds::GoogleAdsClient.new # Add a conversion action. conversion_action = client.resource.conversion_action do |ca| ca.name = "Earth to Mars Cruises Conversion #{(Time.new.to_f * 100).to_i}" ca.type = :UPLOAD_CLICKS ca.category = :DEFAULT ca.status = :ENABLED ca.view_through_lookback_window_days = 15 # Create a value settings object. ca.value_settings = client.resource.value_settings do |vs| vs.default_value = 15 vs.always_use_default_value = true end end # Create the operation. conversion_action_operation = client.operation.create_resource.conversion_action(conversion_action) # Add the ad group ad. response = client.service.conversion_action.mutate_conversion_actions( customer_id: customer_id, operations: [conversion_action_operation], ) puts "New conversion action with resource name = #{response.results.first.resource_name}." end
Perl
sub add_conversion_action { my ($api_client, $customer_id) = @_; # Note that conversion action names must be unique. # If a conversion action already exists with the specified conversion_action_name, # the create operation fails with error ConversionActionError.DUPLICATE_NAME. my $conversion_action_name = "Earth to Mars Cruises Conversion #" . uniqid(); # Create a conversion action. my $conversion_action = Google::Ads::GoogleAds::V26::Resources::ConversionAction->new({ name => $conversion_action_name, category => DEFAULT, type => WEBPAGE, status => ENABLED, viewThroughLookbackWindowDays => 15, valueSettings => Google::Ads::GoogleAds::V26::Resources::ValueSettings->new({ defaultValue => 23.41, alwaysUseDefaultValue => "true" })}); # Create a conversion action operation. my $conversion_action_operation = Google::Ads::GoogleAds::V26::Services::ConversionActionService::ConversionActionOperation ->new({create => $conversion_action}); # Add the conversion action. my $conversion_actions_response = $api_client->ConversionActionService()->mutate({ customerId => $customer_id, operations => [$conversion_action_operation]}); printf "New conversion action added with resource name: '%s'.\n", $conversion_actions_response->{results}[0]{resourceName}; return 1; }
curl
REST リクエスト
REST で同じ ConversionAction を作成するには、POST リクエストを ConversionActionService.MutateConversionActions に送信します。
POST https://googleads.googleapis.com/v26/customers/{customer_id}/conversionActions:mutate
{
"operations": [
{
"create": {
"name": "Earth to Mars Cruise Conversion",
"type": "UPLOAD_CLICKS",
"category": "DEFAULT",
"status": "ENABLED",
"primaryForGoal": true,
"countingType": "ONE_PER_CLICK",
"clickThroughLookbackWindowDays": "60",
"valueSettings": {
"defaultValue": 23.41,
"defaultCurrencyCode": "USD",
"alwaysUseDefaultValue": true
}
}
}
]
}
コンバージョン アクションが ENABLED になったら、コンバージョンの発生元のワークフローを使用して、コンバージョン イベントまたは拡張機能をインポートします(コンバージョン イベントをインポートするをご覧ください)。
3. オフライン コンバージョンのアップロードの健全性をモニタリングする
クリック コンバージョン、通話コンバージョン、コンバージョン調整をアップロードしたら、offline_conversion_upload_client_summary をクエリして、最近のアップロード全体におけるジョブのステータス、成功率、保留率、エラーの内訳を確認します。
SELECT
offline_conversion_upload_client_summary.client,
offline_conversion_upload_client_summary.status,
offline_conversion_upload_client_summary.total_event_count,
offline_conversion_upload_client_summary.successful_event_count,
offline_conversion_upload_client_summary.success_rate,
offline_conversion_upload_client_summary.pending_event_count,
offline_conversion_upload_client_summary.pending_rate,
offline_conversion_upload_client_summary.last_upload_date_time,
offline_conversion_upload_client_summary.alerts
FROM offline_conversion_upload_client_summary
コンバージョン アクション単位の診断については、offline_conversion_upload_conversion_action_summary をクエリします(オフライン データの診断をモニタリングするをご覧ください)。特定のエラーコードを解決するには、コンバージョンのインポートに関するトラブルシューティングをご覧ください。
ライフサイクル ステージ別のガイド ディレクトリ
ライフサイクル ステージ別に整理されたコンバージョン管理ガイドの全セットをご覧ください。
1. アカウント設定とコンバージョン アクション
- コンバージョン アクションのカテゴリ: 適切なコンバージョンの発生元(ウェブサイト(
WEBPAGE)、電話(UPLOAD_CALLS、AD_CALL、WEBSITE_CALL)、モバイルアプリ(GOOGLE_PLAY_DOWNLOAD、GOOGLE_PLAY_IN_APP_PURCHASE、Firebase、SKAdNetwork)、Google アナリティクス 4(GOOGLE_ANALYTICS_4_CUSTOM、GOOGLE_ANALYTICS_4_PURCHASE)、オフライン(UPLOAD_CLICKS)、実店舗(STORE_SALES))を選択し、対応するConversionActionTypeと API ワークフローにマッピングします。 - スタートガイド: クライアント ライブラリまたは REST を使用して、ユーザーの同意を構成し、
ConversionTrackingSettingを確認し、クロスアカウント コンバージョン トラッキングを設定して、コンバージョン アクションを作成します。
2. コンバージョン イベントをインポートする
- オフライン クリック コンバージョンをインポートする: オフライン コンバージョン(
GCLID、GBRAID、WBRAID)とリードの拡張コンバージョン(ハッシュ化された自社メールアドレスと電話番号)をアップロードして、実際の取引を測定します。 - オンライン クリック コンバージョンをインポートする: 拡張コンバージョン(ウェブ向け)(
ENHANCEMENT調整)を使用して、メールアドレス、氏名、自宅の住所、電話番号などのファーストパーティ ユーザー データでウェブサイト コンバージョン タグを補完します。 - 通話コンバージョン データのインポート: Google 広告専用転送電話番号または独自のコール トラッキング システムでトラッキングされた通話のコンバージョン イベントをアップロードします。
- 店舗販売コンバージョンをインポートする:
OfflineUserDataJobServiceを使用して、店舗での取引件数データを一括アップロードします。
3. コンバージョンを調整して最適化する
- インポート後にコンバージョンを調整する:
UPLOAD_CLICKS、WEBPAGE、SALESFORCE(非推奨)のコンバージョン アクションについて、キャンセルされた注文を撤回(RETRACTION)するか、変更されたコンバージョン値を修正(RESTATEMENT)します。 - コンバージョン値のルールを管理する: オーディエンス、デバイス、地理的位置、旅行プランの条件に基づいて、オークション時にコンバージョン値を動的に調整します。
- カスタム コンバージョン変数: カスタム Key-Value タグ(
ConversionCustomVariable)を定義して、クリック、通話、ウェブ コンバージョンに添付し、セグメント化されたレポートを作成します。 - コンバージョン目標: コンバージョン アクションを
category(ConversionActionCategory)フィールドとorigin(ConversionOrigin)フィールドでグループ化し、顧客目標、キャンペーン目標とカスタム目標、顧客ライフサイクル目標(新規顧客の獲得、顧客維持、ロイヤルティ維持)を設定します。また、新規顧客のコンバージョン値の増分に関するOPTIMIZE_FOR_NEW_CUSTOMERS最適化案を取得して適用することもできます。
4. モニタリング、レポート、トラブルシューティング
- オフライン データの診断をモニタリングする: アカウント単位(
offline_conversion_upload_client_summary)とコンバージョン アクション単位(offline_conversion_upload_conversion_action_summary)でオフライン データの診断をクエリして、成功率、保留中のイベント、アップロード アラートをトラッキングします。 - コンバージョン統計情報を取得する: GAQL でコンバージョン パフォーマンス指標をクエリし、Google 広告 UI の列を Google Ads API のフィールドにマッピングします。
- コンバージョンのインポートのトラブルシューティング: 一般的な
ConversionUploadErrorコードとConversionAdjustmentUploadErrorコードを診断して解決します。