リードの拡張コンバージョンの仕組み
リードの拡張コンバージョンを使用するには、ユーザーがリードフォームを送信すると GCLID を Google 広告に自動的に送信するタグを設定する必要があります。Google タグの設定は、Google 広告、Google タグ マネージャー、Google アナリティクス、キャンペーン マネージャー 360 のいずれかから行えます。ユーザーがリードフォームを送信すると、このタグによってリードフォームの送信データ(ユーザーのメールアドレスなど)と GCLID が Google 広告に送信されます。ユーザーが後でコンバージョンを達成したら、Google 広告の管理画面(ヘルプセンターを参照)からコンバージョンをアップロードするか、Google Ads API を使ってリードフォーム情報を含むコンバージョンをアップロードできます。
Google Ads API のリードの拡張コンバージョンでは、次のフローのステップ 5 が記録されます。
前提条件を実装する
拡張コンバージョンを設定するための前提条件はいくつかあります。実装に進む前に、すべての前提条件を満たしていることを確認してください。
Google 広告のコンバージョンを使用する顧客でコンバージョン トラッキングを有効にします。
顧客データに関する規約に同意し、リードの拡張コンバージョンを有効にします。
タグ設定を構成する。
1. Google 広告のコンバージョンを使用する顧客でコンバージョン トラッキングを有効にする
コンバージョン トラッキングの設定に関する情報を取得する
アカウントのコンバージョン トラッキングの設定をチェックし、コンバージョン トラッキングが有効になっていることを確認するには、Customer
リソースに対して ConversionTrackingSetting
をクエリします。GoogleAdsService.SearchStream
を使用して次のクエリを発行します。
SELECT
customer.conversion_tracking_setting.google_ads_conversion_customer,
customer.conversion_tracking_setting.conversion_tracking_status,
customer.conversion_tracking_setting.conversion_tracking_id,
customer.conversion_tracking_setting.cross_account_conversion_tracking_id
FROM customer
google_ads_conversion_customer
フィールドは、この顧客のコンバージョンを作成、管理する Google 広告アカウントを示します。クロスアカウント コンバージョン トラッキングを使用している場合は、クライアント センター(MCC)アカウントの ID になります。コンバージョンを作成、管理するには、Google Ads API リクエストの customer_id
で Google 広告コンバージョンのお客様 ID を指定する必要があります。このフィールドは、コンバージョン トラッキングが有効になっていない場合でも入力されます。
conversion_tracking_status
フィールドは、コンバージョン トラッキングが有効かどうか、アカウントでクロスアカウント コンバージョン トラッキングが使用されているかどうかを示します。
Google 広告のコンバージョン顧客でコンバージョン アクションを作成する
conversion_tracking_status
の値が NOT_CONVERSION_TRACKED
の場合、コンバージョン トラッキングはアカウントで有効になっていません。Google 広告のコンバージョン アカウントに少なくとも 1 つの ConversionAction
を作成し、コンバージョン トラッキングを有効にします。次に例を示します。また、有効にするコンバージョンの種類に応じて、ヘルプセンターの手順に沿って、管理画面でコンバージョン アクションを作成することもできます。
拡張コンバージョンは、Google Ads API を介して送信されると自動的に有効になりますが、Google 広告の管理画面で無効にできます。
サンプルコード
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.V17.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, customer_id): conversion_action_service = client.get_service("ConversionActionService") # Create the operation. conversion_action_operation = client.get_type("ConversionActionOperation") # Create conversion action. conversion_action = 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 = conversion_action.value_settings value_settings.default_value = 15.0 value_settings.always_use_default_value = True # Add the conversion action. conversion_action_response = ( 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::V17::Resources::ConversionAction->new({ name => $conversion_action_name, category => DEFAULT, type => WEBPAGE, status => ENABLED, viewThroughLookbackWindowDays => 15, valueSettings => Google::Ads::GoogleAds::V17::Resources::ValueSettings->new({ defaultValue => 23.41, alwaysUseDefaultValue => "true" })}); # Create a conversion action operation. my $conversion_action_operation = Google::Ads::GoogleAds::V17::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; }
conversion_action_type
が正しい ConversionActionType
値に設定されていることを確認します。Google Ads API でコンバージョン アクションを作成する方法について詳しくは、コンバージョン アクションを作成するをご覧ください。
既存のコンバージョン アクションを取得する
既存のコンバージョン アクションの詳細を取得するには、次のクエリを実行します。リクエストのお客様 ID が上記で特定した Google 広告コンバージョンの顧客に設定され、コンバージョン アクションの種類が正しい ConversionActionType
値に設定されていることを確認します。
SELECT
conversion_action.resource_name,
conversion_action.name,
conversion_action.status
FROM conversion_action
WHERE conversion_action.type = 'UPLOAD_CLICKS'
2. 顧客データに関する利用規約に同意し、リードの拡張コンバージョンを有効にする
リードの拡張コンバージョンを使用するには、リードの拡張コンバージョンを有効にして、顧客データに関する利用規約に同意する必要があります。これらの前提条件がすでに満たされているかどうかは、Google 広告コンバージョンのお客様に次のクエリを発行することで確認できます。
SELECT
customer.id,
customer.conversion_tracking_setting.accepted_customer_data_terms,
customer.conversion_tracking_setting.enhanced_conversions_for_leads_enabled
FROM customer
accepted_customer_data_terms
または enhanced_conversions_for_leads_enabled
のいずれかが false
の場合は、ヘルプセンターの手順に沿って、これらの前提条件を満たす必要があります。
3. タグ設定を構成する
ヘルプセンターの手順に沿って、Google タグを設定してリードの拡張コンバージョンを有効にできます。Google タグ マネージャーでリードの拡張コンバージョンをセットアップするには、instructionsに沿って操作してください。
次のステップ
前提条件を満たしたら、リードの拡張コンバージョンを実装できます。