เริ่มต้นใช้งาน Conversion ที่ปรับปรุงแล้วสำหรับเว็บ

การทำงานของ Conversion ที่ปรับปรุงแล้วสำหรับเว็บ

Conversion ที่ปรับปรุงแล้วสำหรับเว็บต้องตั้งค่าแท็กที่ส่งตัวระบุคลิก เช่น GCLID และรหัสคำสั่งซื้อไปยัง Google Ads โดยอัตโนมัติเมื่อผู้ใช้ทำ Conversion คุณจะมีตัวเลือกในการตั้งค่า Conversion ที่ปรับปรุงแล้วผ่าน Google Tag Manager, แท็ก Google หรือ Google Ads API การใช้ Google Ads API ช่วยให้คุณได้รับประโยชน์จากการส่งข้อมูล Conversion จากบุคคลที่หนึ่งภายใน 24 ชั่วโมงหลังจากเกิดเหตุการณ์ Conversion แทนที่จะต้องส่งข้อมูลพร้อมกัน วิธีนี้ช่วยให้คุณค้นหาข้อมูลจากบุคคลที่หนึ่งจากแหล่งที่มาต่างๆ ได้ เช่น ฐานข้อมูลลูกค้าหรือระบบ CRM

Conversion ที่ปรับปรุงแล้วสำหรับเว็บใน Google Ads API จะช่วยเสริมขั้นตอนที่ 3 ในขั้นตอนต่อไปนี้

Conversion ที่ปรับปรุงแล้วสำหรับเว็บ

แทนที่จะส่งข้อมูลผู้ใช้ที่แฮชไปเมื่อผู้ใช้ทำ Conversion แท็กจะส่งเฉพาะ GCLID และรหัสคำสั่งซื้อ แล้วส่งข้อมูลผู้ใช้ที่แฮชในภายหลังโดยอัปโหลดรหัสคำสั่งซื้อพร้อมกับข้อมูลที่แฮช

ใช้ข้อกำหนดเบื้องต้น

การตั้งค่า Conversion ที่ปรับปรุงแล้วที่ใช้งานได้มีข้อกําหนดเบื้องต้น 2-3 อย่าง ตรวจสอบว่าข้อกำหนดเบื้องต้นทั้งหมดเป็นไปตามข้อกำหนดก่อนที่จะดำเนินการติดตั้งใช้งาน

  1. เปิดใช้เครื่องมือวัด Conversion ในกลุ่มลูกค้า Conversion ของ Google Ads

  2. ยอมรับข้อกําหนดสำหรับข้อมูลลูกค้า

  3. กำหนดค่าการติดแท็ก

1. เปิดใช้เครื่องมือวัด Conversion ในกลุ่มลูกค้า Conversion ของ Google Ads

ดึงข้อมูลเกี่ยวกับการตั้งค่าเครื่องมือวัด Conversion ของคุณ

คุณตรวจสอบการตั้งค่าเครื่องมือวัด Conversion ของบัญชีและยืนยันว่าได้เปิดใช้เครื่องมือวัด Conversion แล้วโดยค้นหาแหล่งข้อมูล 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 ที่สร้างและจัดการ Conversion สำหรับลูกค้ารายนี้ สำหรับลูกค้าที่ใช้เครื่องมือวัด Conversion ข้ามบัญชี นี่คือรหัสของบัญชีดูแลจัดการ คุณควรระบุรหัสลูกค้า Conversion ของ Google Ads เป็น customer_id ในคําขอของ Google Ads API เพื่อสร้างและจัดการ Conversion โปรดทราบว่าระบบจะป้อนข้อมูลในช่องนี้ แม้จะไม่ได้เปิดใช้เครื่องมือวัด Conversion ก็ตาม

ช่อง conversion_tracking_status จะระบุว่ามีการเปิดใช้เครื่องมือวัด Conversion หรือไม่และบัญชีใช้เครื่องมือวัด Conversion ข้ามบัญชีหรือไม่

สร้างการกระทําที่ถือเป็น Conversion ในส่วนลูกค้าที่ทำ Conversion ของ Google Ads

หากค่า conversion_tracking_status คือ NOT_CONVERSION_TRACKED จะไม่มีการเปิดใช้เครื่องมือวัด Conversion สำหรับบัญชี เปิดใช้เครื่องมือวัด Conversion โดยการสร้าง ConversionAction อย่างน้อย 1 รายการในบัญชี Conversion ของ Google Ads เหมือนในตัวอย่างต่อไปนี้ หรือจะสร้างการกระทำที่ถือเป็น Conversion ใน UI ได้โดยทำตามวิธีการในศูนย์ช่วยเหลือสำหรับประเภท Conversion ที่ต้องการเปิดใช้

โปรดทราบว่าระบบจะเปิดใช้ Conversion ที่ปรับปรุงแล้วโดยอัตโนมัติเมื่อส่งผ่าน Google Ads API แต่คุณสามารถปิดใช้ผ่าน UI ของ Google Ads ได้

ตัวอย่างโค้ด

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.V16.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::V16::Resources::ConversionAction->new({
      name                          => $conversion_action_name,
      category                      => DEFAULT,
      type                          => WEBPAGE,
      status                        => ENABLED,
      viewThroughLookbackWindowDays => 15,
      valueSettings                 =>
        Google::Ads::GoogleAds::V16::Resources::ValueSettings->new({
          defaultValue          => 23.41,
          alwaysUseDefaultValue => "true"
        })});

  # Create a conversion action operation.
  my $conversion_action_operation =
    Google::Ads::GoogleAds::V16::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 ที่ถูกต้อง ดูคำแนะนำเพิ่มเติมเกี่ยวกับการสร้างการกระทำที่ถือเป็น Conversion ใน Google Ads API ได้ที่สร้างการกระทำที่ถือเป็น Conversion

ดึงข้อมูลการกระทำที่ถือเป็น Conversion ที่มีอยู่

คุณสามารถเรียกดูรายละเอียดสำหรับการกระทำที่ถือเป็น Conversion ที่มีอยู่ได้ด้วยการออกคำค้นหาต่อไปนี้ ตรวจสอบว่าได้กำหนดรหัสลูกค้าในคำขอเป็นลูกค้า Conversion ของ Google Ads ที่ระบุไว้ข้างต้น และตั้งค่าประเภทการกระทำที่ถือเป็น Conversion เป็นค่า ConversionActionType ที่ถูกต้องแล้ว

SELECT
  conversion_action.resource_name,
  conversion_action.name,
  conversion_action.status
FROM conversion_action
WHERE conversion_action.type = 'WEBPAGE'

2. ยอมรับข้อกําหนดสำหรับข้อมูลลูกค้า

คุณต้องยอมรับข้อกําหนดสำหรับข้อมูลลูกค้าก่อนจึงจะใช้ Conversion ที่ปรับปรุงแล้วสำหรับเว็บได้ คุณสามารถยืนยันว่าข้อกําหนดสำหรับข้อมูลลูกค้าได้รับการยอมรับหรือไม่ได้โดยส่งคําค้นหาต่อไปนี้ไปให้ลูกค้าที่ทำ Conversion ของ Google Ads

SELECT
  customer.id,
  customer.conversion_tracking_setting.accepted_customer_data_terms
FROM customer

หาก accepted_customer_data_terms คือ false ให้ทำตามวิธีการในศูนย์ช่วยเหลือเพื่อดำเนินการตามข้อกำหนดเบื้องต้นนี้

3. กำหนดค่าการติดแท็ก

คุณกำหนดค่าการติดแท็กสำหรับเว็บไซต์ได้โดยทำตามวิธีการในศูนย์ช่วยเหลือ

นอกจากนี้ คุณต้องเพิ่มรหัสธุรกรรมหรือที่เรียกว่ารหัสคำสั่งซื้อลงในแท็กเครื่องมือวัด Conversion โดยทำตามวิธีการในศูนย์ช่วยเหลือ Google Ads ต้องใช้รายการเหล่านี้ เพื่อให้ค้นหา Conversion ที่จะปรับปรุงได้

ขั้นตอนถัดไป

เมื่อปฏิบัติตามข้อกำหนดเบื้องต้นแล้ว คุณก็พร้อมที่จะใช้ Conversion ที่ปรับปรุงแล้วสำหรับเว็บใน Google Ads API