전환을 기록하려면 Google Ads 전환 계정에서 전환 추적을 사용 설정해야 합니다. 이 가이드에서는 전환 추적이 사용 설정되어 있는지 확인하는 방법, 사용 설정되어 있지 않은 경우 사용 설정하는 방법, 기존 전환 액션에 대한 정보를 가져오는 방법을 자세히 설명합니다.
대부분의 전환 액션은 추적을 위해 추가 단계가 필요합니다. 다양한 전환 액션 유형과 요구사항에 대한 자세한 내용은 전환 액션 카테고리 및 전환 액션 만들기를 참고하세요.
동의 제공 준비하기
전환 또는 사용자 데이터를 가져올 때 Google과 전환 데이터를 공유할 권한이 있음을 확인해야 합니다. 두 가지 방법 중 하나로 이를 수행할 수 있습니다.
- 계정 수준 기본 동의 설정을 구성합니다. Google Ads UI에서 도구 > 데이터 관리 도구 > 동의 설정 > 기본 동의 설정을 클릭합니다.
- 가져온 각 전환 또는 사용자 데이터 페이로드 (예:
ClickConversion.consent,CallConversion.consent또는UserData.consent)에서 동의 필드를 설정합니다.
전환을 추적하도록 웹사이트 설정하기
웹사이트 전환을 추적하거나 리드 확보용 향상된 전환을 구현하는 경우 먼저 웹사이트 태그 지정을 구성하세요. 리드 확보용 향상된 전환을 위해 Google 태그 구성의 단계를 따르거나 리드 확보용 향상된 전환을 위해 Google 태그 관리자 구성에 따라 Google 태그 관리자를 사용합니다.
Google Ads 전환 계정에서 전환 추적 사용 설정하기
다음 단계에 따라 계정의 전환 추적 설정을 확인하고 전환 액션을 만들거나 검색하세요.
전환 추적을 사용 설정하는 단계
전환 추적 설정에 관한 정보 가져오기
ConversionTrackingSetting의 Customer 리소스를 쿼리하여 계정의 전환 추적 설정을 확인하고 전환 추적이 사용 설정되어 있는지 확인할 수 있습니다.
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 Ads 계정을 나타냅니다. 교차 계정 전환 추적을 사용하는 고객의 경우 관리자 계정의 ID입니다. Google Ads 전환 고객 ID는 전환을 생성하고 관리하는 Google Ads API 요청에서 customer_id로 제공되어야 합니다. 전환 추적이 사용 설정되지 않은 경우에도 이 필드가 채워집니다.
conversion_tracking_status 필드는 전환 추적이 사용 설정되어 있는지와 계정에서 교차 계정 전환 추적을 사용하고 있는지를 나타냅니다.
Google Ads 전환 고객에서 전환 액션 만들기
conversion_tracking_status 값이 NOT_CONVERSION_TRACKED이면 계정에 전환 추적이 사용 설정되지 않습니다. 다음 예와 같이 Google Ads 전환 계정에서 ConversionAction를 하나 이상 만들어 전환 추적을 사용 설정합니다. 또는 사용 설정하려는 전환 유형에 대한 전환 추적 설정에 관한 Google Ads 고객센터 도움말의 안내에 따라 UI에서 전환 액션을 만들 수 있습니다.
향상된 전환은 Google Ads API를 통해 전송될 때 자동으로 사용 설정되지만 Google Ads UI를 통해 사용 중지할 수 있습니다.
코드 예
자바
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
type가 올바른 ConversionActionType 값으로 설정되어 있는지 확인합니다. Google Ads API에서 전환 액션을 만드는 방법에 대한 자세한 내용은 전환 액션 만들기를 참고하세요.
기존 전환 액션 가져오기
다음 쿼리를 실행하여 기존 전환 액션의 세부정보를 가져올 수 있습니다. 요청의 고객 ID가 이전에 식별한 Google Ads 전환 고객으로 설정되어 있고 전환 액션 유형이 올바른 ConversionActionType 값으로 설정되어 있는지 확인합니다.
SELECT
conversion_action.id,
conversion_action.resource_name,
conversion_action.name,
conversion_action.type,
conversion_action.category,
conversion_action.status
FROM conversion_action
WHERE conversion_action.type = 'INSERT_CONVERSION_ACTION_TYPE'
교차 계정 전환 추적
교차 계정 전환 추적을 사용하면 Google Ads 계정에서 전환을 생성한 광고를 트래피킹했을 수 있는 다른 계정을 대신하여 전환을 가져올 수 있습니다. 이렇게 하면 가져오기 요청을 하는 계정을 통합할 수 있으므로 통합을 간소화할 수 있습니다.
Google Ads API에서 교차 계정 전환 추적 사용 설정
Google Ads API를 사용하여 고객 계정을 만들거나 업데이트할 때 교차 전환 추적을 선택할 수 있습니다.
Customer 리소스에서 conversion_tracking_setting.google_ads_conversion_customer 필드를 고객 계정을 대신하여 전환 액션을 관리해야 하는 관리자 계정의 리소스 이름으로 설정합니다.
고객 계정의 전환 고객을 수정하는 요청은 고객의 새 전환 고객이 되는 관리자 계정에서 전송해야 합니다.
이렇게 하려면 login-customer-id를 관리자 계정 ID로 설정합니다.
교차 계정 전환 추적을 선택하거나 기존 고객 계정의 전환 추적 관리자를 전환하는 경우 UI에서 이 변경사항을 적용하는 것과 동일한 주의사항이 적용됩니다. 구체적인 내용은 다음과 같습니다.
- 고객 계정은 기본 전환 가치 규칙과 새 전환 추적 관리자의 기본 고객 라이프사이클 목표를 채택합니다.
- 특정 전환 액션을 타겟팅하는 캠페인은 전환 관리자 계정의 기본 전환 목표를 사용하도록 전환됩니다. 특정 전환 액션을 계속 타겟팅하면 관리자 계정의 목표가 고객 계정의 목표와 다를 수 있으므로 일관되지 않은 동작이 발생할 수 있습니다. 캠페인이 올바른 목표에 맞게 최적화되어 있는지 확인하세요.
- 계정이 두 개 이상의 관리자 계정에 속하는 경우 하나의 관리자의 전환 액션만 사용할 수 있습니다. 전환 추적 계정이 지정되지 않은 경우 계정은 기본적으로 자신을 전환 추적 계정으로 사용합니다.
여러 계정에서 전환 가져오기
교차 계정 추적을 사용 설정하면 고객 계정과 관리자 계정에서 광고 게재 계정을 대신하여 전환을 가져올 수 있습니다. 이렇게 하면 가져오기 로직을 간소화할 수 있으므로 가져오기 시 각 전환의 광고 게재 계정을 결정할 필요가 없으며 계정 트리에서 하나의 계정을 선택하여 모든 전환을 가져올 수 있습니다.
전환을 업로드하려면 업로드 계정에 전환 액션에 대한 액세스 권한이 있어야 합니다. 교차 계정 추적 계층 구조에서 업로드 계정은 계정 트리의 전환 액션 소유자의 상위 (관리자) 또는 하위 계정인 경우 액션에 액세스할 수 있습니다.
다음 다이어그램은 전환 가져오기를 위한 승인 구조를 보여줍니다. 여기서 C1는 전환을 생성한 광고를 게재한 고객 계정이고, M2는 전환 액션 소유자이자 C1의 전환 추적 상위 요소입니다. 녹색으로 강조표시된 계정은 C1를 대신하여 전환을 가져올 수 있지만 빨간색으로 강조표시된 계정은 가져올 수 없습니다.

전환 액션 만들기
전환을 측정하려면 추적하려는 전환 액션의 type에 대해 ConversionAction를 설정합니다.
예를 들어 온라인 구매와 전화 통화에는 서로 다른 전환 액션이 필요합니다.
API에서 새 전환 액션을 설정하는 가장 좋은 방법은 전환 액션 추가 코드 예를 사용하는 것입니다. 샘플은 모든 백그라운드 인증 작업을 처리하고 ConversionAction 생성을 안내합니다.
대부분의 전환 액션은 추적을 위해 추가 단계가 필요합니다. 예를 들어 웹사이트에서 전환을 추적하려면 웹사이트의 전환 페이지에 태그라는 코드 스니펫을 추가해야 합니다. 다른 전환 액션 유형의 자세한 요구사항은 전환 유형에 관한 Google Ads 고객센터 도움말을 참고하세요.
교차 계정 전환 추적을 사용하는 경우 ConversionActionService는 다음 전환 액션을 반환합니다.
- 계정에서 교차 계정 전환 추적에 사용하는 관리자 계정에서 정의된 모든 전환 액션
- 시스템 정의 액션, 관리자가 소유한 액션(관리자가 이후에 연결을 해제한 경우 포함)을 포함하여 고객이 통계를 누적한 모든 전환 액션
- 고객이 자체 계정에서 정의한 모든 작업
- 연결된 Google 애널리틱스 속성에서 생성된 애널리틱스 전환
여기에는 Google Ads로 가져오지 않은 애널리틱스 전환에 대한 액션이 포함되며,
상태는
HIDDEN입니다.
코드 예
다음 코드 예에서는 새 전환 액션을 만드는 과정을 안내합니다. 구체적으로는 type가 UPLOAD_CLICKS로 설정된 전환 액션을 만듭니다.
또한 category를 DEFAULT로 설정합니다.
다음 기본 설정이 적용됩니다.
Google Ads API는
primary_for_goal필드를 자동으로 설정하지만, 전환 목표와 결합할 때 전환 액션이 계정의 보고 및 입찰에 미치는 영향을 제어하도록 이 필드를 명시적으로 설정할 수 있습니다.Google Ads API는
counting_type를MANY_PER_CLICK로 자동 설정합니다. 자세한 내용은 전환 집계 옵션에 대한 정보를 참고하세요.Google Ads API는
attribution_model_settings필드를AttributionModel의GOOGLE_SEARCH_ATTRIBUTION_DATA_DRIVEN값으로 설정하여 기여 분석 모델을 데이터 기반으로 설정합니다. 기여 분석 모델 정보를 참조하여 기여 분석 모델에 대해 자세히 알아보세요.
자바
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
이 예시는 클라이언트 라이브러리의 리마케팅 폴더와 코드 예시 모음인 전환 액션 추가 코드 예시에서 확인할 수 있습니다.
ConversionActionService.MutateConversionActions 필드 참조
ConversionActionService에서 MutateConversionActions를 사용하여 Google Ads 전환 고객의 전환 액션을 만들거나 업데이트하거나 삭제합니다.
POST https://googleads.googleapis.com/v26/customers/{customer_id}/conversionActions:mutate
다음 표에는 MutateConversionActionsRequest의 최상위 요청 및 작업 필드가 나와 있습니다.
| 필드 | 요구사항 | 설명 |
|---|---|---|
customer_id |
필수 | Google Ads 전환 고객 (google_ads_conversion_customer)의 10자리 ID (string)이며 하이픈은 포함되지 않습니다. |
partial_failure |
선택사항 | true (bool)인 경우 유효한 작업이 실행되고 실패한 작업은 partial_failure_error에서 오류를 반환합니다. 기본값은 false입니다. |
validate_only |
선택사항 | true (bool)인 경우 변형을 실행하지 않고 요청을 검증합니다. |
response_content_type |
선택사항 | ResponseContentType: 응답이 resource_name (RESOURCE_NAME_ONLY, 기본값)만 반환하는지 아니면 변경된 ConversionAction 객체 (MUTABLE_RESOURCE)를 반환하는지 제어합니다. |
operations[].create |
필수 (생성 시) | 만들 ConversionAction 리소스입니다. resource_name가 없을 것으로 예상됩니다. |
operations[].update |
필수 (업데이트 시) | 업데이트할 ConversionAction 리소스입니다 (ConversionActionOperation에 resource_name 및 동위 update_mask가 포함되어야 함). |
operations[].update_mask |
필수 (업데이트 시) | ConversionActionOperation (update의 동위, ConversionAction 내에 중첩되지 않음)의 FieldMask (snake_case에서 수정된 ConversionAction 필드 경로의 쉼표로 구분된 목록, REST JSON updateMask은 snake_case 또는 camelCase를 허용하지만 gRPC 및 클라이언트 라이브러리에는 snake_case가 필요함) |
operations[].remove |
필수 (삭제 시) | 삭제할 전환 액션의 리소스 이름 (customers/{customer_id}/conversionActions/{action_id})입니다. |
operations[].create 또는 operations[].update에서 ConversionAction를 구성할 때는 다음 필드 요구사항 및 변경 가능성 제약조건을 준수하세요 (유형별 오류 규칙은 유효성 검사 참고).
ConversionAction 필드 |
요구사항 및 변경 가능 여부 | 설명 |
|---|---|---|
name |
필수 (변경 가능) | 전환 고객 계정 내의 고유한 표시 이름 (string)입니다. |
type |
create (IMMUTABLE)에 필요 |
ConversionActionType (예: WEBPAGE, UPLOAD_CLICKS, UPLOAD_CALLS, AD_CALL, WEBSITE_CALL) |
category |
선택사항 (변경 가능) | ConversionActionCategory (예: DEFAULT, PURCHASE, SUBMIT_LEAD_FORM, SIGNUP, PHONE_CALL_LEAD). 기본값은 DEFAULT입니다. |
status |
선택사항 (변경 가능) | ConversionActionStatus (ENABLED, REMOVED 또는 HIDDEN). 기본값은 ENABLED입니다. |
primary_for_goal |
선택사항 (변경 가능) | bool: 표준 고객 및 캠페인 전환 목표에서 액션에 입찰할 수 있는지 여부를 제어합니다 (참고: CustomConversionGoal 리소스는 이 설정을 무시함). 기본값은 true입니다. |
counting_type |
선택사항 (변경 가능) | ConversionActionCountingType (MANY_PER_CLICK 기본값 또는 ONE_PER_CLICK) |
value_settings |
선택사항 (변경 가능) | ValueSettings (default_value, default_currency_code, always_use_default_value). |
attribution_model_settings |
선택사항 (변경 가능) | AttributionModelSettings (attribution_model: GOOGLE_SEARCH_ATTRIBUTION_DATA_DRIVEN 기본값 또는 GOOGLE_ADS_LAST_CLICK) |
click_through_lookback_window_days |
선택사항 (변경 가능) | int64 클릭 후 전환 확인 기간(일)(대부분의 유형은 1~90, 통화 유형은 1~60) |
view_through_lookback_window_days |
선택사항 (변경 가능) | int64 조회 완료 전환 확인 기간(일)(대부분의 유형의 경우 1~30, 통화 유형의 경우 설정되지 않음) |
phone_call_duration_seconds |
호출 유형만 (변경 가능) | int64 최소 통화 시간(초)(0~10000) |
app_id |
앱 유형만 (생성 후 변경 불가) | 모바일 앱 식별자 (string)로, 앱 전환 액션의 경우 create에서만 설정할 수 있습니다. |
include_in_conversions_metric |
변이의 읽기 전용 | 직접 수정할 수 없습니다. 대신 primary_for_goal를 구성하세요. |
tag_snippets[] |
OUTPUT_ONLY |
WEBPAGE 전환 액션에 채워진 웹사이트 추적 코드 스니펫 (TagSnippet) |
REST 요청 및 응답 구조
REST를 통해 ConversionAction를 만들거나 업데이트하려면 ConversionActionService.MutateConversionActions에 POST 요청을 보냅니다.
기존 전환 액션을 업데이트할 때는 작업 객체에서 updateMask를 update의 형제로 지정합니다.
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
}
}
},
{
"updateMask": "primary_for_goal,value_settings.default_value",
"update": {
"resourceName": "customers/{customer_id}/conversionActions/6666666666",
"primaryForGoal": false,
"valueSettings": {
"defaultValue": 45.00
}
}
}
]
}
응답에 성공하면 results[]에 MutateConversionActionResult 항목이 반환됩니다.
{
"results": [
{
"resourceName": "customers/{customer_id}/conversionActions/7777777777"
},
{
"resourceName": "customers/{customer_id}/conversionActions/6666666666"
}
]
}
GAQL을 사용하여 전환 액션 설정 및 태그 스니펫 검사
전환 추적을 사용 설정하는 단계에 표시된 기본 쿼리 외에도 GoogleAdsService.SearchStream를 사용하여 conversion_action 리소스를 쿼리하여 primary_for_goal, 기여 분석 모델 상태, 전환 확인 기간, 가치 설정, 웹사이트 tag_snippets를 검사할 수 있습니다.
SELECT
conversion_action.id,
conversion_action.resource_name,
conversion_action.name,
conversion_action.type,
conversion_action.category,
conversion_action.status,
conversion_action.primary_for_goal,
conversion_action.counting_type,
conversion_action.click_through_lookback_window_days,
conversion_action.view_through_lookback_window_days,
conversion_action.value_settings.default_value,
conversion_action.value_settings.default_currency_code,
conversion_action.value_settings.always_use_default_value,
conversion_action.attribution_model_settings.attribution_model,
conversion_action.attribution_model_settings.data_driven_model_status,
conversion_action.tag_snippets
FROM conversion_action
WHERE conversion_action.status = 'ENABLED'
검사
Google Ads 및 Google Ads API는 다양한 전환 액션을 지원하므로 일부 유효성 검사 규칙은 액션의 type에 따라 다릅니다.
전환 액션을 만들 때 가장 흔히 발생하는 오류는 DUPLICATE_NAME입니다. 각 전환 액션에 고유한 이름을 사용해야 합니다.
다음은 ConversionAction 필드를 설정하는 방법에 관한 몇 가지 도움말입니다.
- 모든 enum 필드
- enum 필드를
UNKNOWN로 설정하려고 하면RequestError.INVALID_ENUM_VALUE오류가 발생합니다. app_idapp_id속성은 변경할 수 없으며 새 앱 전환을 만들 때만 설정할 수 있습니다.attribution_model_settings- 이를 지원 중단된 옵션으로 설정하면
CANNOT_SET_RULE_BASED_ATTRIBUTION_MODELS오류가 발생합니다. Google Ads는GOOGLE_ADS_LAST_CLICK및GOOGLE_SEARCH_ATTRIBUTION_DATA_DRIVEN만 지원합니다. click_through_lookback_window_days이 속성을 허용된 범위를 벗어나는 값으로 설정하면
RangeError.TOO_LOW또는RangeError.TOO_HIGH오류가 발생합니다.이 속성은
AD_CALL또는WEBSITE_CALL전환 액션의 경우 1~60일 사이여야 합니다. 기타 대부분의 전환 액션의 경우 허용되는 범위는 1~90일입니다.include_in_conversions_metriccreate또는update작업에서 이 값을 설정하면FieldError.IMMUTABLE_FIELD오류와 함께 실패합니다. 대신 전환 목표 가이드에 설명된 대로primary_for_goal를 설정하세요.phone_call_duration_seconds통화용이 아닌 전환 액션에 이 속성을 설정하려고 하면
FieldError.VALUE_MUST_BE_UNSET오류가 발생합니다.typetype속성은 변경할 수 없으며 새 전환을 만들 때만 설정할 수 있습니다.type이UNKNOWN와 같음으로 전환 액션을 업데이트하면MutateError.MUTATE_NOT_ALLOWED오류가 발생합니다.value_settingsWEBSITE_CALL또는AD_CALL전환 액션의value_settings에는always_use_default_value가true로 설정되어 있어야 합니다. 이 값을 만들거나 업데이트할 때false값을 지정하면INVALID_VALUE오류가 발생합니다.view_through_lookback_window_days이 속성을 허용된 범위를 벗어나는 값으로 설정하면
RangeError.TOO_LOW또는RangeError.TOO_HIGH오류가 발생합니다. 대부분의 전환 액션의 경우 허용되는 범위는 1~30일입니다.이 속성은
AD_CALL또는WEBSITE_CALL전환 액션에 설정할 수 없습니다. 값을 지정하면VALUE_MUST_BE_UNSET오류가 발생합니다.