전환 액션 만들기

이 가이드에서는 광고주가 실행할 수 있는 다양한 유형의 전환 액션 목록을 Google Ads API를 이용해 만들 수 있으며, 이러한 정보가 Google Ads 웹에 매핑되는 방식에 대한 정보 인터페이스 및 UI 콘텐츠를 실행하는 방법을 보여주는 자세한 코드 예제 새 전환 액션 만들기

전환을 측정하려면 ConversionAction: type/ 추적할 전환 액션을 선택하세요. 예: 온라인 구매 및 휴대전화 통화에 필요한 전환 액션은 다릅니다.

API에서 새 전환 액션을 설정하는 가장 좋은 방법은 아래에 전환 액션 코드 예를 추가하세요. 샘플 핸들 백그라운드 인증 작업을 자동으로 수행하고, ConversionAction

대부분의 전환 액션은 추적을 위해 추가 단계도 필요로 합니다. 있습니다. 예를 들어 웹사이트에서 전환을 추적하려면 코드를 추가해야 합니다. 태그라고 하는 스니펫 웹사이트의 전환 페이지로 이동합니다 기타 전환 액션 자세한 내용은 고객센터 도움말

웹사이트 전환

웹사이트 전환을 사용하면 온라인 판매, 조회, 가입 등 링크 클릭

웹사이트에서 전환을 추적하려면 ConversionAction 다음 코드로 교체합니다. ConversionActionType WEBPAGE로 설정하고, 태그라는 코드 스니펫을 전환에 추가합니다. 페이지에 삽입해야 합니다.

ConversionAction는 여러 요소를 포함합니다. 웹사이트 전환 유형으로는 API 내에서 type 입력란 TagSnippettag_snippets 필드 ConversionAction입니다.

TagSnippet는 추적 코드를 제공해야 합니다. 웹사이트에 포함해야 합니다 웹사이트전화번호 클릭 전환의 경우 event_snippet, 전환 액션을 나타내는 웹페이지에 게재해야 함(예: 결제 확인 또는 리드 양식 제출 페이지 global_site_tag, 웹사이트의 모든 페이지에 설치해야 합니다. 다음 두 가지를 모두 가져올 수 있습니다. 이러한 속성을 ConversionActionService 결제 고객센터에서 자세히 알아볼 수 있습니다.

다음 표는 각각에 사용할 동등한 API 매개변수를 보여줍니다. Google Ads 웹 인터페이스의 소스:

추적 코드 유형 Google Ads 소스
WEBPAGE 웹사이트, 웹사이트 (Google 애널리틱스 (GA4))
WEBPAGE_ONCLICK 웹사이트, 웹사이트 (Google 애널리틱스 (GA4))
CLICK_TO_CALL 전화번호 클릭
--- 웹사이트 (Google 애널리틱스 (UA))

앱 전환

앱 전환을 사용하면 Google Play 스토어

다음 표에서는 이와 동등한 ConversionActionType Google Ads 웹 인터페이스의 각 소스에 사용할 API 매개변수:

전환 액션 유형 Google Ads 소스
GOOGLE_PLAY_DOWNLOAD Google Play > 설치
GOOGLE_PLAY_IN_APP_PURCHASE Google Play > 인앱 구매

Google 애널리틱스 4를 사용하여 다른 모바일 앱 액션을 추적하려는 경우 속성 또는 서드 파티 앱 애널리틱스를 사용할 수도 있습니다. 추가 전환 액션 유형을 참고하세요.

전화 통화 전환

전화 통화 전환 추적 광고에서 연결된 통화, 웹사이트에 표시된 전화번호로 걸려오는 전화, 모바일 사이트의 숫자 클릭수

다음 표에서는 이와 동등한 ConversionActionType Google Ads 웹 인터페이스의 각 소스에 사용할 API 매개변수:

전환 액션 유형 Google Ads 소스
AD_CALL 전화번호 광고 확장이 사용된 광고 또는 통화 전용 광고에서 연결된 통화
WEBSITE_CALL 웹사이트의 전화번호로 걸려온 통화수
CLICK_TO_CALL 모바일 웹사이트 전화번호 클릭수

CLICK_TO_CALL 유형은 AD_CALL 유형과 다릅니다. 실제 전화 통화를 추적하지 않습니다. 대신 CLICK_TO_CALL에서는 휴대기기의 전화번호입니다. 이것은 전화 통화를 추적하기 위한 Google 착신 전화번호입니다.

AD_CALL

AD_CALL 전환 액션이 통화를 통해 Google Ads 전환을 측정할 수 있습니다. 있습니다. AD_CALL 전환 액션을 만든 후 다음 항목을 지정하세요. 리소스 이름을 call_conversion_action 필드에 입력합니다. CallAsset 전화 확장 소재를 사용하면 광고에 직접 전화번호를 넣을 수 있습니다.

통화가 지정된 시간보다 오래 지속될 경우 전환으로 보고됩니다. 기본값은 60초입니다.

WEBSITE_CALL

WEBSITE_CALL 전환 액션이 '통화수'로 표시됩니다. 웹사이트 전환수를 Google Ads 웹 인터페이스

좋아요 취소 AD_CALL, 이 위치 추적기에는 event_snippet이(가) 필요합니다. 및 global_site_tag을(를) 추가할 예정 통화 추적을 위해 동적 Google 착신 전화번호를 가져오기 위한 웹사이트 (웹사이트에 기재된 수치) 또한 통화를 설정해야 하며 저작물을 빌드하고 확인할 수 있습니다.

오프라인 전환 가져오기

다음 표에서는 이와 동등한 ConversionActionType Google Ads 웹 인터페이스의 각 소스에 사용할 API 매개변수입니다. 및 각 특정 전환 액션 유형에 대한 문서 링크:

전환 액션 유형 Google Ads 소스 API 설정 가이드
UPLOAD_CLICKS 클릭 및 향상된 전환에서 발생한 전환 추적 리드 업로드 클릭 가이드 <ph type="x-smartling-placeholder">
</ph> 향상된 입찰기능 리드 확보용 전환 가이드
UPLOAD_CALLS 통화에서 전환 추적 API 설정 가이드
STORE_SALES 매장 판매 전환 추적 API 설정 가이드

웹용 향상된 전환

향상된 전환: 웹을 사용하면 전환 액션 WEBPAGE개에 대한 퍼스트 파티 전환 데이터 동시에 발생해야 합니다 이렇게 하면 고객 데이터베이스나 CRM과 같은 다양한 소스의 퍼스트 파티 데이터 있습니다.

추가 전환 액션 유형

Google Ads API를 사용하면 보고서에서 더 많은 전환 액션을 사용할 수 있습니다 이러한 행위의 생성 또는 수정을 제한하거나 금지할 수 있습니다.

SKAdNetwork 전환수

iOS 앱 캠페인을 운영하는 경우 다양한 기술을 SKAdNetwork는 다음을 사용하여 CustomerCampaign 수준에서 Google에 제공된 SKAdNetwork 데이터 다음 리소스를 참고하세요.

보고서 필드 설명
metrics.sk_ad_network_installs Apple에서 보고한 설치 수입니다. 이 측정항목은 segments.sk_ad_network_conversion_value 및 세그먼트를 만들 수 있습니다.
metrics.sk_ad_network_total_conversions 설치 및 기타 사용자 유형을 포함한 총 전환수는 Apple에서 보고한 전환수 이 측정항목은 SKAdNetwork 관련 세그먼트 및 날짜 관련 세그먼트입니다.
segments.sk_ad_network_ad_event_type 특정 전환에 대해 발생한 이벤트의 유형입니다.
segments.sk_ad_network_attribution_credit 특정 전환에 대한 기여도 부여 방식입니다.
segments.sk_ad_network_fine_conversion_value

Apple에서 보고한 전환 가치입니다. 이 세그먼트를 적용할 수 없습니다. metrics.sk_ad_network_installs 외의 측정항목을 사용하여 metrics.sk_ad_network_total_conversions, 날짜 관련 세그먼트와만 결합할 수 있습니다.

Apple에서 값을 보고하는 경우 값 0이 반환됩니다. 0이고 나머지 경우에는 값이 없습니다. 필드 존재를 사용하여 두 케이스를 구별합니다.

segments.sk_ad_network_coarse_conversion_value 개별 전환의 대략적인 가치입니다.
segments.sk_ad_network_postback_sequence_index 특정 전환에 대한 포스트백의 연속 위치입니다.
segments.sk_ad_network_source_app.sk_ad_network_source_app_id iOS 스토어 키트 광고 네트워크 설치를 유도한 광고가 있는 앱 ID입니다. 표시됩니다.
segments.sk_ad_network_source_domain iOS 스토어 키트 광고 네트워크 설치를 유도한 광고가 있던 웹사이트 표시됩니다. null 값은 이 세그먼트를 적용할 수 없음을 의미합니다. 예를 들어 Apple에서 보낸 포스트백에 없었습니다.
segments.sk_ad_network_source_type iOS 스토어 키트 광고 네트워크 설치를 유도한 광고가 위치한 소스 유형입니다. 표시됩니다. null 값은 이 세그먼트를 적용할 수 없음을 의미합니다. 예를 들어 iOS 캠페인이 아닌지, 아니면 소스 도메인과 소스 앱이 모두 Apple에서 보낸 모든 포스트백을 전송할 수 없습니다.
segments.sk_ad_network_user_type 특정 전환을 생성한 사용자 유형입니다.
segments.sk_ad_network_redistributed_fine_conversion_value 이 세그먼트의 전환 가치에 전환 가치에 재분배됩니다. 이 세그먼트는 Apple에서 반환한 상세한 전환 가치와 모델링된 null 값을 관찰 확인하세요.
segments.sk_ad_network_version 사용된 iOS 스토어 키트 Ad Network API 버전입니다.

또한 연결된 특정 광고 유형에 대해 SKAdNetwork 전환 가치 매핑을 저장할 수 CustomerSkAdNetworkConversionValueSchema를 통해 iOS 앱을 사용하는 고객

샘플 Python 코드

#!/usr/bin/env python
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import argparse
import sys

from google.ads.googleads.client import GoogleAdsClient
from google.ads.googleads.errors import GoogleAdsException

def main(client, customer_id):
    """Adds a keyword plan, campaign, ad group, etc. to the customer account.

    Also handles errors from the API and prints them.

    Args:
        client: An initialized instance of GoogleAdsClient
        customer_id: A str of the customer_id to use in requests.
    """

    res = update_skan_cv_schema(
        client, customer_id, "my_app_id", "account_link_id"
    )
    print(res)

def update_skan_cv_schema(client, customer_id, app_id, account_link_id):
    skan_service = client.get_service(
        "CustomerSkAdNetworkConversionValueSchemaService"
    )

    req = client.get_type(
        "MutateCustomerSkAdNetworkConversionValueSchemaRequest"
    )
    operation = client.get_type(
        "CustomerSkAdNetworkConversionValueSchemaOperation"
    )
    schema_instance = client.get_type(
        "CustomerSkAdNetworkConversionValueSchema"
    )

    new_schema = operation.update
    new_schema.resource_name = (
        skan_service.customer_sk_ad_network_conversion_value_schema_path(
            "customer_id", "account_link_id"
        )
    )
    new_schema.schema.app_id = app_id
    new_schema.schema.measurement_window_hours = 48

    skan_cv_mapping = (
        schema_instance.SkAdNetworkConversionValueSchema.FineGrainedConversionValueMappings()
    )
    skan_cv_mapping.fine_grained_conversion_value = 0  # 0 - 63
    skan_cv_mapping.conversion_value_mapping.min_time_post_install_hours = 0
    skan_cv_mapping.conversion_value_mapping.max_time_post_install_hours = 48

    skan_cv_event = schema_instance.SkAdNetworkConversionValueSchema.Event()
    skan_cv_event.mapped_event_name = "TEST"
    skan_cv_event.event_revenue_value = 10

    skan_cv_mapping.conversion_value_mapping.mapped_events.append(skan_cv_event)
    new_schema.schema.fine_grained_conversion_value_mappings.append(
        skan_cv_mapping
    )

    req.operation = operation
    req.customer_id = customer_id

    res = skan_service.mutate_customer_sk_ad_network_conversion_value_schema(
        req
    )
    return res

if __name__ == "__main__":
    # GoogleAdsClient will read the google-ads.yaml configuration file in the
    # home directory if none is specified.
    googleads_client = GoogleAdsClient.load_from_storage(
        version="v17"
    )

    parser = argparse.ArgumentParser(
        description="Creates a keyword plan for specified customer."
    )
    # The following argument(s) should be provided to run the example.
    parser.add_argument(
        "-c",
        "--customer_id",
        type=str,
        required=True,
        help="The Google Ads customer ID.",
    )
    args = parser.parse_args()

    try:
        main(googleads_client, args.customer_id)
    except GoogleAdsException as ex:
        print(
            f'Request with ID "{ex.request_id}" failed with status '
            f'"{ex.error.code().name}" and includes the following errors:'
        )
        for error in ex.failure.errors:
            print(f'\tError with message "{error.message}".')
            if error.location:
                for field_path_element in error.location.field_path_elements:
                    print(f"\t\tOn field: {field_path_element.field_name}")
        sys.exit(1)
  

Google 애널리틱스

연결된 Google 애널리틱스 속성의 전환에는 다음 중 하나가 포함됩니다. type 값:

  • GA4 속성 전환:

    • GOOGLE_ANALYTICS_4_CUSTOM
    • GOOGLE_ANALYTICS_4_PURCHASE

    또한 다음 위치에서 GA4 속성 ID, 속성 이름, 이벤트 이름을 가져올 수도 있습니다. google_analytics_4_settings 필드를 확인합니다.

  • 유니버설 애널리틱스 속성 변환:

    • UNIVERSAL_ANALYTICS_GOAL
    • UNIVERSAL_ANALYTICS_TRANSACTION

GA4 속성 전환을 다음과 같이 변경할 수 있습니다.

가져온 GA4 전환의 다른 속성 또는 모든 가져온 유니버설 애널리틱스 전환 속성이 있으면 MUTATE_NOT_ALLOWED 오류 이러한 변경은 Google Ads UI를 통해서만 가능합니다.

Firebase 및 서드 파티 앱 애널리틱스

가져오기 서드 파티 앱 애널리틱스 Firebase 전환 또는 포드의 statusmutate 메서드를 사용하여 HIDDEN에서 ENABLEDConversionAction ConversionActionService 이 경우 app_id에서 지원되지 않습니다. 전환 액션

  • FIREBASE_ANDROID_FIRST_OPEN
  • FIREBASE_ANDROID_IN_APP_PURCHASE
  • FIREBASE_ANDROID_CUSTOM
  • FIREBASE_IOS_FIRST_OPEN
  • FIREBASE_IOS_IN_APP_PURCHASE
  • FIREBASE_IOS_CUSTOM
  • THIRD_PARTY_APP_ANALYTICS_ANDROID_FIRST_OPEN
  • THIRD_PARTY_APP_ANALYTICS_ANDROID_IN_APP_PURCHASE
  • THIRD_PARTY_APP_ANALYTICS_ANDROID_CUSTOM
  • THIRD_PARTY_APP_ANALYTICS_IOS_FIRST_OPEN
  • THIRD_PARTY_APP_ANALYTICS_IOS_IN_APP_PURCHASE
  • THIRD_PARTY_APP_ANALYTICS_IOS_CUSTOM

스토어 판매

STORE_SALES 또는 STORE_SALES_DIRECT_UPLOAD을(를) 만들 수 없음 Google Ads API를 사용한 전환 액션의 경우, API는 매장을 업로드하는 것을 지원합니다. 판매 거래와 관련이 있습니다.

  • STORE_SALES
  • STORE_SALES_DIRECT_UPLOAD

기타

다음 전환 액션 유형은 Google Ads API에서 읽기 전용으로 제공되며 보고 목적으로 사용합니다.

  • ANDROID_APP_PRE_REGISTRATION
  • ANDROID_INSTALLS_ALL_OTHER_APPS
  • FLOODLIGHT_ACTION
  • FLOODLIGHT_TRANSACTION
  • GOOGLE_HOSTED
  • LEAD_FORM_SUBMIT
  • SALESFORCE
  • SEARCH_ADS_360
  • SMART_CAMPAIGN_AD_CLICKS_TO_CALL
  • SMART_CAMPAIGN_MAP_CLICKS_TO_CALL
  • SMART_CAMPAIGN_MAP_DIRECTIONS
  • SMART_CAMPAIGN_TRACKED_CALLS
  • STORE_VISITS
  • WEBPAGE_CODELESS

알 수 없음

Google Ads 계정에 다른 유형의 전환 액션이 포함되어 있는 경우 다음과 같은 결과가 표시될 수 있습니다. 전환 액션을 반환한다고 가정하겠습니다 ConversionAction.type이(가) UNKNOWN입니다. API는 이러한 전환 액션 관리를 지원하지 않지만 보고서, 캠페인 등의 주요 전환 측정항목에 대한 metrics.conversionsmetrics.conversions_value

코드 예

다음 코드 예에서는 새 포드를 만드는 과정을 전환 액션 구체적으로는 type이(가) 다음으로 설정됨 UPLOAD_CLICKS 위의 Google Ads UI 흐름은 가져오기 > API 또는 업로드를 사용하여 수동으로 가져오기 > 다음에서 발생한 전환 추적 클릭수 등이 있습니다. 또한 category (으)로 DEFAULT.

다음과 같은 기본 설정이 적용됩니다.

자바

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;
}
      

이 예는 클라이언트 라이브러리의 리마케팅 폴더에서도 찾을 수 있습니다. 코드 예제 모음에서 전환 액션 코드 추가 예시를 참조하세요.

확인

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_CLICKGOOGLE_SEARCH_ATTRIBUTION_DATA_DRIVEN
click_through_lookback_window_days

이 속성을 허용 범위를 벗어나는 값으로 설정하면 RangeError.TOO_LOW 또는 RangeError.TOO_HIGH 오류

이 속성은 AD_CALL의 경우 [1,60] 범위 내에 있어야 합니다. 또는 전환 액션이 WEBSITE_CALL회 발생했습니다. 대부분의 다른 전환 액션에서는 허용되는 범위는 [1,30]입니다.

include_in_conversions_metric

create 또는 update 작업에서 이 값을 설정하면 FieldError.IMMUTABLE_FIELD 오류 대신 primary_for_goal를 다음과 같이 설정하세요. 전환 목표 가이드에 설명되어 있습니다.

phone_call_duration_seconds

통화용이 아닌 전환 액션에 이 속성을 설정하려고 시도함 FieldError.VALUE_MUST_BE_UNSET 오류가 발생합니다.

type

type 속성은 변경할 수 없으며 새 속성을 만들 때만 설정할 수 있습니다. 알 수 있습니다.

type(으)로 전환 액션을 업데이트합니다. UNKNOWNMutateError.MUTATE_NOT_ALLOWED 오류

value_settings

WEBSITE_CALL 또는 AD_CALL 전환 액션의 value_settingsalways_use_default_valuetrue로 설정되어 있어야 합니다. false의 값 지정 이 값을 만들거나 업데이트하면 INVALID_VALUE 오류가 발생합니다.

view_through_lookback_window_days

이 속성을 허용 범위를 벗어나는 값으로 설정하면 RangeError.TOO_LOW 또는 RangeError.TOO_HIGH 오류 대부분의 전환 발생 허용되는 범위는 [1,30]입니다.

AD_CALL 또는 WEBSITE_CALL 전환에는 이 속성을 설정할 수 없습니다. 있습니다. 값을 지정하면 VALUE_MUST_BE_UNSET 오류가 발생합니다.