Làm quen với tính năng Lượt chuyển đổi nâng cao cho web

Cách hoạt động của tính năng lượt chuyển đổi nâng cao cho web

Tính năng lượt chuyển đổi nâng cao cho web yêu cầu thiết lập một thẻ tự động gửi giá trị nhận dạng lượt nhấp (như GCLID) và mã đơn hàng đến Google Ads khi người dùng chuyển đổi. Bạn có thể thiết lập tính năng lượt chuyển đổi nâng cao thông qua Trình quản lý thẻ của Google, thẻ Google hoặc API Google Ads. Việc sử dụng API Google Ads sẽ giúp bạn gửi dữ liệu chuyển đổi của bên thứ nhất trong vòng 24 giờ kể từ khi sự kiện chuyển đổi xảy ra, thay vì gửi cùng một lúc. Nhờ đó, bạn có thể xác định vị trí của dữ liệu của bên thứ nhất từ nhiều nguồn, chẳng hạn như cơ sở dữ liệu khách hàng hoặc hệ thống CRM.

Tính năng lượt chuyển đổi nâng cao cho web trong API Google Ads bổ sung cho bước 3 trong quy trình sau đây.

Tính năng lượt chuyển đổi nâng cao cho
web

Thay vì gửi thông tin người dùng đã băm khi người dùng chuyển đổi, thẻ này chỉ gửi GCLID và mã đơn hàng. Sau đó, bạn sẽ gửi thông tin người dùng đã băm bằng cách tải mã đơn hàng lên cùng với dữ liệu đã băm.

Triển khai các điều kiện tiên quyết

Để thiết lập tính năng lượt chuyển đổi nâng cao hoạt động, bạn cần đáp ứng một số điều kiện tiên quyết. Hãy đảm bảo bạn đáp ứng tất cả điều kiện tiên quyết trước khi tiến hành triển khai:

  1. Bật tính năng theo dõi lượt chuyển đổi cho khách hàng chuyển đổi Google Ads.

  2. Chấp nhận các điều khoản về dữ liệu khách hàng.

  3. Định cấu hình tính năng gắn thẻ.

1. Bật tính năng theo dõi lượt chuyển đổi cho khách hàng chuyển đổi Google Ads

Truy xuất thông tin về chế độ theo dõi lượt chuyển đổi

Bạn có thể kiểm tra chế độ theo dõi lượt chuyển đổi của tài khoản và xác nhận rằng tính năng theo dõi lượt chuyển đổi đã bật bằng cách truy vấn tài nguyên Customer cho ConversionTrackingSetting. Đưa ra truy vấn sau bằng 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

Trường google_ads_conversion_customer cho biết tài khoản Google Ads có chức năng tạo và quản lý lượt chuyển đổi cho khách hàng này. Đối với những khách hàng sử dụng tính năng theo dõi lượt chuyển đổi trên nhiều tài khoản, đây là mã nhận dạng của tài khoản người quản lý. Mã khách hàng chuyển đổi trên Google Ads phải được cung cấp dưới dạng customer_id trong các yêu cầu của API Google Ads để tạo và quản lý lượt chuyển đổi. Xin lưu ý rằng trường này được điền sẵn ngay cả khi tính năng theo dõi lượt chuyển đổi không được bật.

Trường conversion_tracking_status cho biết liệu tính năng theo dõi lượt chuyển đổi đã được bật hay chưa và liệu tài khoản có đang sử dụng tính năng theo dõi lượt chuyển đổi trên nhiều tài khoản hay không.

Tạo một hành động chuyển đổi trong mục khách hàng chuyển đổi Google Ads

Nếu giá trị conversion_tracking_statusNOT_CONVERSION_TRACKED, thì tính năng theo dõi lượt chuyển đổi chưa được bật cho tài khoản đó. Bật tính năng theo dõi lượt chuyển đổi bằng cách tạo ít nhất một ConversionAction trong tài khoản chuyển đổi Google Ads, như trong ví dụ sau. Ngoài ra, bạn có thể tạo một hành động chuyển đổi trong giao diện người dùng bằng cách làm theo hướng dẫn trong Trung tâm trợ giúp cho loại chuyển đổi mà bạn muốn bật.

Xin lưu ý rằng tính năng lượt chuyển đổi nâng cao sẽ tự động được bật khi được gửi thông qua API Google Ads, nhưng bạn có thể tắt tính năng này thông qua giao diện người dùng Google Ads.

Ví dụ về mã

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

1.199

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

Hãy đảm bảo bạn đặt conversion_action_type thành giá trị ConversionActionType chính xác. Để biết thêm hướng dẫn về cách tạo hành động chuyển đổi trong API Google Ads, hãy xem bài viết Tạo hành động chuyển đổi.

Truy xuất hành động chuyển đổi hiện tại

Bạn có thể truy xuất thông tin chi tiết về một hành động chuyển đổi hiện có bằng cách tạo truy vấn sau. Hãy nhớ đặt mã khách hàng trong yêu cầu thành khách hàng chuyển đổi Google Ads mà bạn đã xác định ở trên và bạn đã đặt loại hành động chuyển đổi thành giá trị ConversionActionType chính xác.

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

2. Chấp nhận các điều khoản về dữ liệu khách hàng

Bạn phải chấp nhận các điều khoản về dữ liệu khách hàng thì mới có thể sử dụng tính năng lượt chuyển đổi nâng cao cho web. Bạn có thể xác minh xem các điều khoản dữ liệu khách hàng đã được chấp nhận hay chưa bằng cách gửi truy vấn sau cho khách hàng chuyển đổi Google Ads:

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

Nếu accepted_customer_data_termsfalse, hãy làm theo hướng dẫn trong Trung tâm trợ giúp để hoàn tất điều kiện tiên quyết này.

3. Định cấu hình tính năng gắn thẻ

Bạn có thể định cấu hình tính năng gắn thẻ cho trang web của mình bằng cách làm theo hướng dẫn trong Trung tâm trợ giúp.

Bạn cũng phải thêm mã giao dịch (còn gọi là mã đơn hàng) vào thẻ theo dõi lượt chuyển đổi bằng cách làm theo hướng dẫn trong Trung tâm trợ giúp. Google Ads yêu cầu những người dùng này có thể tìm thấy lượt chuyển đổi cần cải thiện.

Các bước tiếp theo

Khi đã đáp ứng các điều kiện tiên quyết, bạn đã sẵn sàng triển khai lượt chuyển đổi nâng cao cho web trong API Google Ads.