전환을 기록하려면 Google Ads 전환 계정에서 전환 추적을 사용 설정해야 합니다. 이 가이드에서는 전환 추적이 사용 설정되어 있는지 확인하고, 아직 사용 설정되어 있지 않은 경우 사용 설정하며, 기존 전환 액션에 대한 정보를 가져오는 방법을 자세히 설명합니다.
대부분의 전환 액션을 추적하려면 추가 단계를 거쳐야 합니다. 다양한 전환 액션 유형과 요구사항에 대한 자세한 내용은 전환 액션 카테고리 및 전환 액션 만들기를 참고하세요.
동의 제공 준비
전환 또는 사용자 데이터를 가져올 때는 전환 데이터를 Google과 공유할 권한이 있는지 확인해야 합니다. 두 가지 방법 중 하나로 이를 수행할 수 있습니다.
- 계정 수준 기본 동의 설정을 구성합니다. Google Ads UI에서 **도구** > **데이터 관리 도구** > **동의 설정** > **기본 동의 설정**을 클릭합니다.
- 가져온 각 전환 또는 사용자 데이터 페이로드에서 동의 필드를 설정합니다 (예:
ClickConversion.consent,CallConversion.consent, 또는UserData.consent).
전환을 추적하도록 웹사이트 설정
웹사이트 전환을 추적하거나 리드 확보용 향상된 전환을 구현하는 경우 먼저 웹사이트 태그를 구성합니다. 리드 확보용 향상된 전환을 위한 Google 태그 구성의 단계를 따르거나 리드 확보용 향상된 전환을 위한 Google 태그 관리자 구성에 따라 Google 태그 관리자를 사용합니다.
Google Ads 전환 계정에서 전환 추적 사용 설정
다음 단계에 따라 계정의 전환 추적 설정을 확인하고 전환 액션을 만들거나 가져옵니다.
전환 추적을 사용 설정하는 단계
전환 추적 설정에 대한 정보 가져오기
`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 Ads 계정을 나타냅니다.
교차 계정 전환
추적을 사용하는 고객의 경우 관리자 계정의
ID입니다. 전환을 만들고 관리하려면 Google Ads API 요청에서 Google Ads 전환 고객 ID를 customer_id로 제공해야 합니다. 전환 추적이 사용 설정되어 있지 않은 경우에도 이 필드가 채워집니다.
The
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.V25.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::V25::Resources::ConversionAction->new({ name => $conversion_action_name, category => DEFAULT, type => WEBPAGE, status => ENABLED, viewThroughLookbackWindowDays => 15, valueSettings => Google::Ads::GoogleAds::V25::Resources::ValueSettings->new({ defaultValue => 23.41, alwaysUseDefaultValue => "true" })}); # Create a conversion action operation. my $conversion_action_operation = Google::Ads::GoogleAds::V25::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는 데이터 기반으로 기여 분석 모델을 설정합니다. 필드를
GOOGLE_SEARCH_ATTRIBUTION_DATA_DRIVEN값으로 설정합니다.attribution_model_settingsAttributionModel기여 분석 모델에 대해 자세히 알아보려면 기여 분석 모델에 대한 정보를 참고하세요.
자바
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.V25.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::V25::Resources::ConversionAction->new({ name => $conversion_action_name, category => DEFAULT, type => WEBPAGE, status => ENABLED, viewThroughLookbackWindowDays => 15, valueSettings => Google::Ads::GoogleAds::V25::Resources::ValueSettings->new({ defaultValue => 23.41, alwaysUseDefaultValue => "true" })}); # Create a conversion action operation. my $conversion_action_operation = Google::Ads::GoogleAds::V25::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
이 예시는 클라이언트 라이브러리의 리마케팅 폴더 와 코드 예시 모음에서 확인할 수 있습니다. 전환 액션 추가 코드 예시
검사
Google Ads 및 Google Ads API는 다양한 전환 액션을 지원하므로 일부
검사 규칙은 type에
따라 다릅니다.
전환 액션을 만들 때 가장 흔한 오류는
DUPLICATE_NAME입니다. 각 전환 액션에 고유한 이름을 사용해야 합니다.
ConversionAction 필드를 설정하는 몇 가지 도움말은 다음과 같습니다.
- 모든 enum 필드
- enum 필드를
UNKNOWN으로 설정하려고 하면RequestError.INVALID_ENUM_VALUE오류가 발생합니다. app_id-
app_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오류가 발생합니다.