웹사이트 방문자

가장 간단한 유형의 잠재고객 세그먼트는 웹사이트 방문자로 구성됩니다.

기본 요건

잠재고객 세그먼트를 만들고 타겟팅하려면 먼저 다음을 수행해야 합니다.

  1. 검토: 관심 및 위치 기반 광고 정책을 준수해야 합니다. 사용자에 관한 민감한 정보는 잠재고객을 구축하는 데 사용할 수 없습니다.

  2. Google 태그를 설정합니다.

    모바일 앱 행동을 기반으로 사용자 목록을 만들려는 광고주는 Firebase SDK를 구현하거나 서드 파티 SDK와 협력하여 측정할 수 있습니다

Google 태그 가져오기

모든 Google Ads 계정에는 정확히 하나의 계정 수준 Google 태그는 자동으로 생성됩니다. .

Google 태그를 검색하려면 Google Ads UI에서 고객센터의 안내를 따르세요. 안내 또는 RemarketingAction를 만든 다음 Google 태그를 가져와서 Google Ads API kubectl 명령어 GoogleAdsService.searchStream remarketing_action를 사용한 요청 리소스:

SELECT
  remarketing_action.id,
  remarketing_action.name,
  remarketing_action.tag_snippets
FROM remarketing_action
WHERE remarketing_action.resource_name = 'REMARKETING_ACTION_RESOURCE_NAME'

웹사이트 또는 앱에 Google 태그 설치하기

다음 단계는 사이트의 모든 페이지에 Google 태그를 설치하는 것입니다. 알아보기 사이트나 모바일에 Google 태그를 추가하는 방법에 대해 자세히 알아보기 앱을 엽니다.

방문한 페이지 URL만을 기반으로 잠재고객 세그먼트를 만들려는 경우 Google 태그를 수정할 필요가 없습니다. 커스텀 매개변수의 경우 이러한 매개변수를 포함하도록 태그를 수정해야 합니다. 자세한 내용은 고급 설정 태그 추가 및 리마케팅 작성 전략 목록을 참조하세요.

Google Tag Assistant를 사용하여 이를 확인할 수 있습니다. 확인할 수 있습니다

기본 제공 Google 태그 매개변수

기본 리마케팅 매개변수 url__을(를) 사용하여 사용자 목록을 타겟팅할 수 있습니다. 웹사이트에서 방문한 URL을 바탕으로 결정됩니다 웹사이트 방문자 예시를 참조하세요.

맞춤 Google 태그 매개변수

맞춤 Google 태그를 추가할 수 있습니다. 매개변수 를 Google 태그에 추가하여 맞춤 사용자 목록을 만들 수 있습니다.

맞춤 매개변수를 직접 만들기 전에 먼저 사전 정의된 매개변수를 사용해 확인할 수 있습니다 이미 사용 사례에 적합한 제품이 있는지 확인하세요 사전 정의된 매개변수 사용 다른 Google Ads 리마케팅 기능과 쉽게 통합할 수 있습니다.

사용자 목록 만들기

이 문제를 트리거한 사용자가 포함된 사용자 목록을 만들어야 합니다. 웹사이트에 설정된 리마케팅 태그를 확인할 수 있습니다 다음을 사용하여 사용자 목록 생성 및 관리 UserListService

웹사이트의 페이지를 방문한 모든 사용자를 포착하는 목록을 만들려면 rule_based_user_list 필드를 설정하세요. RuleBasedUserListInfo 객체가 있는 UserList

다음으로 FlexibleRuleUserListInfo 필드 사용 다음과 같은 사용자를 타겟팅하는 규칙이 포함된 RuleBasedUserListInfo 객체 웹사이트를 방문했습니다.

규칙 기반 사용자 목록을 만드는 코드 예시

자바

private String createUserList(GoogleAdsClient googleAdsClient, long customerId) {
  // Creates a rule targeting any user that visited a url containing 'example.com'.
  UserListRuleItemInfo rule =
      UserListRuleItemInfo.newBuilder()
          // Uses a built-in parameter to create a domain URL rule.
          .setName("url__")
          .setStringRuleItem(
              UserListStringRuleItemInfo.newBuilder()
                  .setOperator(UserListStringRuleItemOperator.CONTAINS)
                  .setValue("example.com")
                  .build())
          .build();

  // Specifies that the user list targets visitors of a page based on the provided rule.
  FlexibleRuleUserListInfo flexibleRuleUserListInfo =
      FlexibleRuleUserListInfo.newBuilder()
          .setInclusiveRuleOperator(UserListFlexibleRuleOperator.AND)
          // Inclusive operands are joined together with the specified inclusiveRuleOperator.
          .addInclusiveOperands(
              FlexibleRuleOperandInfo.newBuilder()
                  .setRule(
                      UserListRuleInfo.newBuilder()
                          .addRuleItemGroups(
                              UserListRuleItemGroupInfo.newBuilder().addRuleItems(rule)))
                  // Optional: adds a lookback window for this rule, in days.
                  .setLookbackWindowDays(7L))
          .build();

  // Defines a representation of a user list that is generated by a rule.
  RuleBasedUserListInfo ruleBasedUserListInfo =
      RuleBasedUserListInfo.newBuilder()
          // Optional: To include past users in the user list, set the prepopulation_status to
          // REQUESTED.
          .setPrepopulationStatus(UserListPrepopulationStatus.REQUESTED)
          .setFlexibleRuleUserList(flexibleRuleUserListInfo)
          .build();

  // Creates the user list.
  UserList userList =
      UserList.newBuilder()
          .setName("All visitors to example.com" + getPrintableDateTime())
          .setDescription("Any visitor to any page of example.com")
          .setMembershipStatus(UserListMembershipStatus.OPEN)
          .setMembershipLifeSpan(365)
          .setRuleBasedUserList(ruleBasedUserListInfo)
          .build();

  // Creates the operation.
  UserListOperation operation = UserListOperation.newBuilder().setCreate(userList).build();

  // Creates the user list service client.
  try (UserListServiceClient userListServiceClient =
      googleAdsClient.getLatestVersion().createUserListServiceClient()) {
    // Adds the user list.
    MutateUserListsResponse response =
        userListServiceClient.mutateUserLists(
            Long.toString(customerId), ImmutableList.of(operation));
    String userListResourceName = response.getResults(0).getResourceName();
    // Prints the result.
    System.out.printf("Created user list with resource name '%s'.%n", userListResourceName);
    return userListResourceName;
  }
}

      

C#

private string CreateUserList(GoogleAdsClient client, long customerId)
{
    // Get the UserListService client.
    UserListServiceClient userListServiceClient =
        client.GetService(Services.V17.UserListService);

    // Create a rule targeting any user that visited a url containing 'example.com'.
    UserListRuleItemInfo rule = new UserListRuleItemInfo
    {
        // Use a built-in parameter to create a domain URL rule.
        Name = "url__",
        StringRuleItem = new UserListStringRuleItemInfo
        {
            Operator = UserListStringRuleItemOperator.Contains,
            Value = "example.com"
        }
    };

    // Specify that the user list targets visitors of a page based on the provided rule.
    FlexibleRuleUserListInfo flexibleRuleUserListInfo = new FlexibleRuleUserListInfo();
    FlexibleRuleOperandInfo flexibleRuleOperandInfo = new FlexibleRuleOperandInfo() {
        Rule = new UserListRuleInfo()
    };
    UserListRuleItemGroupInfo userListRuleItemGroupInfo = new UserListRuleItemGroupInfo();
    userListRuleItemGroupInfo.RuleItems.Add(rule);
    flexibleRuleOperandInfo.Rule.RuleItemGroups.Add(userListRuleItemGroupInfo);
    flexibleRuleUserListInfo.InclusiveOperands.Add(flexibleRuleOperandInfo);

    // Define a representation of a user list that is generated by a rule.
    RuleBasedUserListInfo ruleBasedUserListInfo = new RuleBasedUserListInfo
    {
        // Optional: To include past users in the user list, set the prepopulation_status to
        // REQUESTED.
        PrepopulationStatus = UserListPrepopulationStatus.Requested,
        FlexibleRuleUserList = flexibleRuleUserListInfo
    };

    // Create the user list.
    UserList userList = new UserList
    {
        Name = $"All visitors to example.com #{ExampleUtilities.GetRandomString()}",
        Description = "Any visitor to any page of example.com",
        MembershipStatus = UserListMembershipStatus.Open,
        MembershipLifeSpan = 365L,
        RuleBasedUserList = ruleBasedUserListInfo
    };

    // Create the operation.
    UserListOperation userListOperation = new UserListOperation
    {
        Create = userList
    };

    // Add the user list, then print and return the new list's resource name.
    MutateUserListsResponse mutateUserListsResponse = userListServiceClient
        .MutateUserLists(customerId.ToString(), new[] { userListOperation });
    string userListResourceName = mutateUserListsResponse.Results.First().ResourceName;
    Console.WriteLine($"Created user list with resource name '{userListResourceName}'.");

    return userListResourceName;
}
      

PHP

private static function createUserList(
    GoogleAdsClient $googleAdsClient,
    int $customerId
): string {
    // Creates a rule targeting any user that visited a URL containing 'example.com'.
    $rule = new UserListRuleItemInfo([
        // Uses a built-in parameter to create a domain URL rule.
        'name' => 'url__',
        'string_rule_item' => new UserListStringRuleItemInfo([
            'operator' => UserListStringRuleItemOperator::CONTAINS,
            'value' => 'example.com'
        ])
    ]);

    // Specifies that the user list targets visitors of a page based on the provided rule.
    $flexibleRuleUserListInfo = new FlexibleRuleUserListInfo([
        'inclusive_rule_operator' => UserListFlexibleRuleOperator::PBAND,
        // Inclusive operands are joined together with the specified inclusive rule operator.
        'inclusive_operands' => [
            new FlexibleRuleOperandInfo([
                'rule' => new UserListRuleInfo([
                    'rule_item_groups' =>
                        [new UserListRuleItemGroupInfo(['rule_items' => [$rule]])]
                ]),
                // Optionally add a lookback window for this rule, in days.
                'lookback_window_days' => 7
            ])
        ],
        'exclusive_operands' => []
    ]);

    // Defines a representation of a user list that is generated by a rule.
    $ruleBasedUserListInfo = new RuleBasedUserListInfo([
        'flexible_rule_user_list' => $flexibleRuleUserListInfo,
        // Optional: To include past users in the user list, set the prepopulation_status to
        // REQUESTED.
        'prepopulation_status' => UserListPrepopulationStatus::REQUESTED
    ]);

    // Creates the user list.
    $userList = new UserList([
        'name' => "All visitors to example.com #" . Helper::getPrintableDatetime(),
        'description' => "Any visitor to any page of example.com",
        'membership_status' => UserListMembershipStatus::OPEN,
        'membership_life_span' => 365,
        'rule_based_user_list' => $ruleBasedUserListInfo
    ]);

    // Creates the operation.
    $operation = new UserListOperation();
    $operation->setCreate($userList);

    // Issues a mutate request to add a user list.
    $userListServiceClient = $googleAdsClient->getUserListServiceClient();
    /** @var MutateUserListsResponse $userListResponse */
    $userListResponse = $userListServiceClient->mutateUserLists(
        MutateUserListsRequest::build($customerId, [$operation])
    );

    $userListResourceName = $userListResponse->getResults()[0]->getResourceName();
    printf("Created user list with resource name '%s'.%s", $userListResourceName, PHP_EOL);

    return $userListResourceName;
}
      

Python

def create_user_list(client, customer_id):
    """Creates a user list targeting users that have visited a given URL.

    Args:
        client: an initialized GoogleAdsClient instance.
        customer_id: a str client customer ID used to create a user list.

    Returns:
        a str resource name for the newly created user list.
    """
    # Creates a UserListOperation.
    user_list_operation = client.get_type("UserListOperation")
    # Creates a UserList.
    user_list = user_list_operation.create
    user_list.name = f"All visitors to example.com #{uuid4()}"
    user_list.description = "Any visitor to any page of example.com"
    user_list.membership_status = client.enums.UserListMembershipStatusEnum.OPEN
    user_list.membership_life_span = 365
    # Optional: To include past users in the user list, set the
    # prepopulation_status to REQUESTED.
    user_list.rule_based_user_list.prepopulation_status = (
        client.enums.UserListPrepopulationStatusEnum.REQUESTED
    )
    # Specifies that the user list targets visitors of a page with a URL that
    # contains 'example.com'.
    user_list_rule_item_group_info = client.get_type(
        "UserListRuleItemGroupInfo"
    )
    user_list_rule_item_info = client.get_type("UserListRuleItemInfo")
    # Uses a built-in parameter to create a domain URL rule.
    user_list_rule_item_info.name = "url__"
    user_list_rule_item_info.string_rule_item.operator = (
        client.enums.UserListStringRuleItemOperatorEnum.CONTAINS
    )
    user_list_rule_item_info.string_rule_item.value = "example.com"
    user_list_rule_item_group_info.rule_items.append(user_list_rule_item_info)

    # Specify that the user list targets visitors of a page based on the
    # provided rule.
    flexible_rule_user_list_info = (
        user_list.rule_based_user_list.flexible_rule_user_list
    )
    flexible_rule_user_list_info.inclusive_rule_operator = (
        client.enums.UserListFlexibleRuleOperatorEnum.AND
    )
    # Inclusive operands are joined together with the specified
    # inclusive rule operator.
    rule_operand = client.get_type("FlexibleRuleOperandInfo")
    rule_operand.rule.rule_item_groups.extend([user_list_rule_item_group_info])
    rule_operand.lookback_window_days = 7
    flexible_rule_user_list_info.inclusive_operands.append(rule_operand)

    user_list_service = client.get_service("UserListService")
    response = user_list_service.mutate_user_lists(
        customer_id=customer_id, operations=[user_list_operation]
    )
    resource_name = response.results[0].resource_name
    print(f"Created user list with resource name: '{resource_name}'")
    return resource_name
      

Ruby

def create_user_list(client, customer_id)
  # Creates the user list operation.
  operation = client.operation.create_resource.user_list do |ul|
    ul.name = "All visitors to example.com ##{(Time.new.to_f * 1000).to_i}"
    ul.description = "Any visitor to any page of example.com"
    ul.membership_status = :OPEN
    ul.membership_life_span = 365
    # Defines a representation of a user list that is generated by a rule.
    ul.rule_based_user_list = client.resource.rule_based_user_list_info do |r|
      # To include past users in the user list, set the prepopulation_status
      # to REQUESTED.
      r.prepopulation_status = :REQUESTED
      # Specifies that the user list targets visitors of a page based on
      # the provided rule.
      r.flexible_rule_user_list = client.resource.flexible_rule_user_list_info do |frul|
        frul.inclusive_rule_operator = :AND
        frul.inclusive_operands << client.resource.flexible_rule_operand_info do |froi|
          froi.rule = client.resource.user_list_rule_info do |u|
            u.rule_item_groups << client.resource.user_list_rule_item_group_info do |group|
              group.rule_items << client.resource.user_list_rule_item_info do |item|
                # Uses a built-in parameter to create a domain URL rule.
                item.name = "url__"
                item.string_rule_item = client.resource.user_list_string_rule_item_info do |s|
                  s.operator = :CONTAINS
                  s.value = "example.com"
                end
              end
            end
          end
          # Optionally add a lookback window for this rule, in days.
          froi.lookback_window_days = 7
        end
      end
    end
  end

  # Issues a mutate request to add the user list.
  response = client.service.user_list.mutate_user_lists(
    customer_id: customer_id,
    operations: [operation],
  )
  user_list_resource_name = response.results.first.resource_name
  puts "Created user list with resource name '#{user_list_resource_name}'"

  user_list_resource_name
end
      

Perl

sub create_user_list {
  my ($api_client, $customer_id) = @_;

  # Create a rule targeting any user that visited a url containing 'example.com'.
  my $rule = Google::Ads::GoogleAds::V17::Common::UserListRuleItemInfo->new({
      # Use a built-in parameter to create a domain URL rule.
      name           => "url__",
      stringRuleItem =>
        Google::Ads::GoogleAds::V17::Common::UserListStringRuleItemInfo->new({
          operator => CONTAINS,
          value    => "example.com"
        })});

  # Specify that the user list targets visitors of a page based on the provided rule.
  my $user_list_rule_item_group_info =
    Google::Ads::GoogleAds::V17::Common::UserListRuleItemGroupInfo->new(
    {ruleItems => [$rule]});
  my $flexible_rule_user_list_info =
    Google::Ads::GoogleAds::V17::Common::FlexibleRuleUserListInfo->new({
      inclusiveRuleOperator => AND,
      # Inclusive operands are joined together with the specified inclusiveRuleOperator.
      inclusiveOperands => [
        Google::Ads::GoogleAds::V17::Common::FlexibleRuleOperandInfo->new({
            rule => Google::Ads::GoogleAds::V17::Common::UserListRuleInfo->new({
                ruleItemGroups => [$user_list_rule_item_group_info]}
            ),
            # Optionally add a lookback window for this rule, in days.
            lookbackWindowDays => 7
          })
      ],
      exclusiveOperands => []});

  # Define a representation of a user list that is generated by a rule.
  my $rule_based_user_list_info =
    Google::Ads::GoogleAds::V17::Common::RuleBasedUserListInfo->new({
      # Optional: To include past users in the user list, set the
      # prepopulationStatus to REQUESTED.
      prepopulationStatus  => REQUESTED,
      flexibleRuleUserList => $flexible_rule_user_list_info
    });

  # Create the user list.
  my $user_list = Google::Ads::GoogleAds::V17::Resources::UserList->new({
    name               => "All visitors to example.com #" . uniqid(),
    description        => "Any visitor to any page of example.com",
    membershipLifespan => 365,
    membershipStatus   => OPEN,
    ruleBasedUserList  => $rule_based_user_list_info
  });

  # Create the operation.
  my $user_list_operation =
    Google::Ads::GoogleAds::V17::Services::UserListService::UserListOperation->
    new({
      create => $user_list
    });

  # Add the user list, then print and return the new list's resource name.
  my $user_lists_response = $api_client->UserListService()->mutate({
      customerId => $customer_id,
      operations => [$user_list_operation]});

  my $user_list_resource_name =
    $user_lists_response->{results}[0]{resourceName};
  printf "Created user list with resource name '%s'.\n",
    $user_list_resource_name;

  return $user_list_resource_name;
}
      

목록 가져오기

사용자 목록을 가져오려면 Google Ads 쿼리 언어를 user_list 리소스

SELECT
  user_list.name,
  user_list.membership_status,
  user_list.membership_life_span
FROM user_list
WHERE
  user_list.resource_name = 'USER_LIST_RESOURCE_NAME'

목록 타겟팅

잠재고객 세그먼트를 만들었다면 다음 단계는 해당 세그먼트를 타겟팅하는 것입니다.

잠재고객 세그먼트 타겟팅 규칙

  1. 입찰 가능한 포함 사용자 목록은 캠페인 수준에서 설정할 수 없으며 동시에 사용할 수 있습니다. 포함 사용자 목록 기준을 삭제해야 합니다. 1개여야 합니다.

  2. 사용자 목록별 포함 타겟팅은 검색 캠페인에서만 지원됩니다. 대상 디스플레이 캠페인, CampaignCriterion user_list를 설정하는 값은 다음과 같아야 합니다. 제외되었습니다.

  3. 검색 및 쇼핑 캠페인에서 사용자 목록 타겟이 설정을 지원하지 않음 다음 필드를 포함해야 합니다.

사용자 목록에 광고 타겟팅

이 프로세스는 API의 다른 타겟팅 기준 유형과 유사합니다. 이 다음 코드는 AdGroupCriterion를 사용하여 광고그룹의 광고를 사용자 목록에 타겟팅하는 방법을 보여줍니다.

자바

private String targetAdsInAdGroupToUserList(
    GoogleAdsClient googleAdsClient, long customerId, long adGroupId, String userList) {
  // Creates the ad group criterion targeting members of the user list.
  AdGroupCriterion adGroupCriterion =
      AdGroupCriterion.newBuilder()
          .setAdGroup(ResourceNames.adGroup(customerId, adGroupId))
          .setUserList(UserListInfo.newBuilder().setUserList(userList).build())
          .build();

  // Creates the operation.
  AdGroupCriterionOperation operation =
      AdGroupCriterionOperation.newBuilder().setCreate(adGroupCriterion).build();

  // Creates the ad group criterion service.
  try (AdGroupCriterionServiceClient adGroupCriterionServiceClient =
      googleAdsClient.getLatestVersion().createAdGroupCriterionServiceClient()) {
    // Adds the ad group criterion.
    MutateAdGroupCriteriaResponse response =
        adGroupCriterionServiceClient.mutateAdGroupCriteria(
            Long.toString(customerId), ImmutableList.of(operation));
    // Gets and prints the results.
    String adGroupCriterionResourceName = response.getResults(0).getResourceName();
    System.out.printf(
        "Successfully created ad group criterion with resource name '%s' "
            + "targeting user list with resource name '%s' with ad group with ID %d.%n",
        adGroupCriterionResourceName, userList, adGroupId);
    return adGroupCriterionResourceName;
  }
}

      

C#

private string TargetAdsInAdGroupToUserList(
    GoogleAdsClient client, long customerId, long adGroupId, string userListResourceName)
{
    // Get the AdGroupCriterionService client.
    AdGroupCriterionServiceClient adGroupCriterionServiceClient = client.GetService
        (Services.V17.AdGroupCriterionService);

    // Create the ad group criterion targeting members of the user list.
    AdGroupCriterion adGroupCriterion = new AdGroupCriterion
    {
        AdGroup = ResourceNames.AdGroup(customerId, adGroupId),
        UserList = new UserListInfo
        {
            UserList = userListResourceName
        }
    };

    // Create the operation.
    AdGroupCriterionOperation adGroupCriterionOperation = new AdGroupCriterionOperation
    {
        Create = adGroupCriterion
    };

    // Add the ad group criterion, then print and return the new criterion's resource name.
    MutateAdGroupCriteriaResponse mutateAdGroupCriteriaResponse =
        adGroupCriterionServiceClient.MutateAdGroupCriteria(customerId.ToString(),
            new[] { adGroupCriterionOperation });

    string adGroupCriterionResourceName =
        mutateAdGroupCriteriaResponse.Results.First().ResourceName;
    Console.WriteLine("Successfully created ad group criterion with resource name " +
        $"'{adGroupCriterionResourceName}' targeting user list with resource name " +
        $"'{userListResourceName}' with ad group with ID {adGroupId}.");
    return adGroupCriterionResourceName;
}
      

PHP

private static function targetAdsInAdGroupToUserList(
    GoogleAdsClient $googleAdsClient,
    int $customerId,
    int $adGroupId,
    string $userListResourceName
): string {
    // Creates the ad group criterion targeting members of the user list.
    $adGroupCriterion = new AdGroupCriterion([
        'ad_group' => ResourceNames::forAdGroup($customerId, $adGroupId),
        'user_list' => new UserListInfo(['user_list' => $userListResourceName])
    ]);

    // Creates the operation.
    $operation = new AdGroupCriterionOperation();
    $operation->setCreate($adGroupCriterion);

    // Issues a mutate request to add an ad group criterion.
    $adGroupCriterionServiceClient = $googleAdsClient->getAdGroupCriterionServiceClient();
    /** @var MutateAdGroupCriteriaResponse $adGroupCriterionResponse */
    $adGroupCriterionResponse = $adGroupCriterionServiceClient->mutateAdGroupCriteria(
        MutateAdGroupCriteriaRequest::build($customerId, [$operation])
    );

    $adGroupCriterionResourceName =
        $adGroupCriterionResponse->getResults()[0]->getResourceName();
    printf(
        "Successfully created ad group criterion with resource name '%s' " .
        "targeting user list with resource name '%s' with ad group with ID %d.%s",
        $adGroupCriterionResourceName,
        $userListResourceName,
        $adGroupId,
        PHP_EOL
    );

    return $adGroupCriterionResourceName;
}
      

Python

def target_ads_in_ad_group_to_user_list(
    client, customer_id, ad_group_id, user_list_resource_name
):
    """Creates an ad group criterion that targets a user list with an ad group.

    Args:
        client: an initialized GoogleAdsClient instance.
        customer_id: a str client customer ID used to create an ad group
            criterion.
        ad_group_id: a str ID for an ad group used to create an ad group
            criterion that targets members of a user list.
        user_list_resource_name: a str resource name for a user list.

    Returns:
        a str resource name for an ad group criterion.
    """
    ad_group_criterion_operation = client.get_type("AdGroupCriterionOperation")
    # Creates the ad group criterion targeting members of the user list.
    ad_group_criterion = ad_group_criterion_operation.create
    ad_group_criterion.ad_group = client.get_service(
        "AdGroupService"
    ).ad_group_path(customer_id, ad_group_id)
    ad_group_criterion.user_list.user_list = user_list_resource_name

    ad_group_criterion_service = client.get_service("AdGroupCriterionService")
    response = ad_group_criterion_service.mutate_ad_group_criteria(
        customer_id=customer_id, operations=[ad_group_criterion_operation]
    )
    resource_name = response.results[0].resource_name
    print(
        "Successfully created ad group criterion with resource name: "
        f"'{resource_name}' targeting user list with resource name: "
        f"'{user_list_resource_name}' and with ad group with ID "
        f"{ad_group_id}."
    )
    return resource_name
      

Ruby

def target_ads_in_ad_group_to_user_list(
  client,
  customer_id,
  ad_group_id,
  user_list
)
  # Creates the ad group criterion targeting members of the user list.
  operation = client.operation.create_resource.ad_group_criterion do |agc|
    agc.ad_group = client.path.ad_group(customer_id, ad_group_id)
    agc.user_list = client.resource.user_list_info do |info|
      info.user_list = user_list
    end
  end

  # Issues a mutate request to create the ad group criterion.
  response = client.service.ad_group_criterion.mutate_ad_group_criteria(
    customer_id: customer_id,
    operations: [operation],
  )
  ad_group_criterion_resource_name = response.results.first.resource_name
  puts "Successfully created ad group criterion with resource name " \
    "'#{ad_group_criterion_resource_name}' targeting user list with resource name " \
    "'#{user_list}' with ad group with ID #{ad_group_id}"

  ad_group_criterion_resource_name
end
      

Perl

sub target_ads_in_ad_group_to_user_list {
  my ($api_client, $customer_id, $ad_group_id, $user_list_resource_name) = @_;

  # Create the ad group criterion targeting members of the user list.
  my $ad_group_criterion =
    Google::Ads::GoogleAds::V17::Resources::AdGroupCriterion->new({
      adGroup => Google::Ads::GoogleAds::V17::Utils::ResourceNames::ad_group(
        $customer_id, $ad_group_id
      ),
      userList => Google::Ads::GoogleAds::V17::Common::UserListInfo->new({
          userList => $user_list_resource_name
        })});

  # Create the operation.
  my $ad_group_criterion_operation =
    Google::Ads::GoogleAds::V17::Services::AdGroupCriterionService::AdGroupCriterionOperation
    ->new({
      create => $ad_group_criterion
    });

  # Add the ad group criterion, then print and return the new criterion's resource name.
  my $ad_group_criteria_response =
    $api_client->AdGroupCriterionService()->mutate({
      customerId => $customer_id,
      operations => [$ad_group_criterion_operation]});

  my $ad_group_criterion_resource_name =
    $ad_group_criteria_response->{results}[0]{resourceName};
  printf "Successfully created ad group criterion with resource name '%s' " .
    "targeting user list with resource name '%s' with ad group with ID %d.\n",
    $ad_group_criterion_resource_name, $user_list_resource_name, $ad_group_id;

  return $ad_group_criterion_resource_name;
}
      

다른 유형의 기준과 마찬가지로 AdGroupCriterion 객체(예: 입찰가 재정의)

타겟팅 수준 전환

광고그룹 수준의 사용자 목록 기준에서 캠페인 수준으로 전환하는 경우 먼저 사용 중인 각 광고 항목에서 기존 사용자 목록 기준을 광고그룹을 일시중지했습니다. 확장형 요소를 클릭하여 보기 예시 코드를 살펴보겠습니다.

먼저 특정 캠페인에 속한 모든 AdGroupCriteria를 검색합니다.

자바

private List<String> getUserListAdGroupCriterion(
    GoogleAdsClient googleAdsClient, long customerId, long campaignId) {
  List<String> userListCriteria = new ArrayList<>();
  // Creates the Google Ads service client.
  try (GoogleAdsServiceClient googleAdsServiceClient =
      googleAdsClient.getLatestVersion().createGoogleAdsServiceClient()) {
    // Creates a request that will retrieve all of the ad group criteria under a campaign.
    SearchGoogleAdsRequest request =
        SearchGoogleAdsRequest.newBuilder()
            .setCustomerId(Long.toString(customerId))
            .setQuery(
                "SELECT ad_group_criterion.criterion_id"
                    + " FROM ad_group_criterion"
                    + " WHERE campaign.id = "
                    + campaignId
                    + " AND ad_group_criterion.type = 'USER_LIST'")
            .build();
    // Issues the search request.
    SearchPagedResponse searchPagedResponse = googleAdsServiceClient.search(request);
    // Iterates over all rows in all pages. Prints the results and adds the ad group criteria
    // resource names to the list.
    for (GoogleAdsRow googleAdsRow : searchPagedResponse.iterateAll()) {
      String adGroupCriterionResourceName = googleAdsRow.getAdGroupCriterion().getResourceName();
      System.out.printf(
          "Ad group criterion with resource name '%s' was found.%n",
          adGroupCriterionResourceName);
      userListCriteria.add(adGroupCriterionResourceName);
    }
  }
  return userListCriteria;
}

      

C#

private List<string> GetUserListAdGroupCriteria(
    GoogleAdsClient client, long customerId, long campaignId)
{
    // Get the GoogleAdsService client.
    GoogleAdsServiceClient googleAdsServiceClient =
        client.GetService(Services.V17.GoogleAdsService);

    List<string> userListCriteriaResourceNames = new List<string>();

    // Create a query that will retrieve all of the ad group criteria under a campaign.
    string query = $@"
        SELECT ad_group_criterion.criterion_id
        FROM ad_group_criterion
        WHERE
          campaign.id = {campaignId}
          AND ad_group_criterion.type = 'USER_LIST'";

    // Issue the search request.
    googleAdsServiceClient.SearchStream(customerId.ToString(), query,
        delegate (SearchGoogleAdsStreamResponse resp)
        {
            // Display the results and add the resource names to the list.
            foreach (GoogleAdsRow googleAdsRow in resp.Results)
            {
                string adGroupCriterionResourceName =
                    googleAdsRow.AdGroupCriterion.ResourceName;
                Console.WriteLine("Ad group criterion with resource name " +
                    $"{adGroupCriterionResourceName} was found.");
                userListCriteriaResourceNames.Add(adGroupCriterionResourceName);
            }
        });

    return userListCriteriaResourceNames;
}
      

PHP

private static function getUserListAdGroupCriteria(
    GoogleAdsClient $googleAdsClient,
    int $customerId,
    int $campaignId
): array {
    // Creates a query that retrieves all of the ad group criteria under a campaign.
    $query = sprintf(
        "SELECT ad_group_criterion.criterion_id " .
        "FROM ad_group_criterion " .
        "WHERE campaign.id = %d " .
        "AND ad_group_criterion.type = 'USER_LIST'",
        $campaignId
    );

    // Creates the Google Ads service client.
    $googleAdsServiceClient = $googleAdsClient->getGoogleAdsServiceClient();

    // Issues the search request.
    $response =
        $googleAdsServiceClient->search(SearchGoogleAdsRequest::build($customerId, $query));

    $userListCriteria = [];
    // Iterates over all rows in all pages. Prints the user list criteria and adds the ad group
    // criteria resource names to the list.
    foreach ($response->iterateAllElements() as $googleAdsRow) {
        /** @var GoogleAdsRow $googleAdsRow */
        $adGroupCriterionResourceName = $googleAdsRow->getAdGroupCriterion()->getResourceName();

        printf(
            "Ad group criterion with resource name '%s' was found.%s",
            $adGroupCriterionResourceName,
            PHP_EOL
        );

        $userListCriteria[] = $adGroupCriterionResourceName;
    }

    return $userListCriteria;
}
      

Python

def get_user_list_ad_group_criteria(client, customer_id, campaign_id):
    """Finds all of user list ad group criteria under a campaign.

    Args:
        client: an initialized GoogleAdsClient instance.
        customer_id: a str client customer ID.
        campaign_id: a str campaign ID.

    Returns:
        a list of ad group criterion resource names.
    """
    # Creates a query that retrieves all of the ad group criteria under a
    # campaign.
    query = f"""
        SELECT
          ad_group_criterion.criterion_id
        FROM ad_group_criterion
        WHERE campaign.id = {campaign_id}
        AND ad_group_criterion.type = USER_LIST"""

    googleads_service = client.get_service("GoogleAdsService")
    search_request = client.get_type("SearchGoogleAdsRequest")
    search_request.customer_id = customer_id
    search_request.query = query
    response = googleads_service.search(request=search_request)

    # Iterates over all rows in all pages. Prints the user list criteria and
    # adds the ad group criteria resource names to the list.
    user_list_criteria = []
    for row in response:
        resource_name = row.ad_group_criterion.resource_name
        print(
            "Ad group criterion with resource name '{resource_name}' was "
            "found."
        )
        user_list_criteria.append(resource_name)

    return user_list_criteria
      

Ruby

def get_user_list_ad_group_criterion(
  client,
  customer_id,
  campaign_id
)
  user_list_criteria = []

  # Creates a query that will retrieve all of the ad group criteria 
  # under a campaign.
  query = <<~QUERY
    SELECT ad_group_criterion.criterion_id
    FROM ad_group_criterion
    WHERE campaign.id = #{campaign_id}
    AND ad_group_criterion.type = 'USER_LIST'
  QUERY

  # Issues the search request.
  response = client.service.google_ads.search(
    customer_id: customer_id,
    query: query,
    page_size: PAGE_SIZE,
  )

  # Iterates over all rows in all pages. Prints the results and adds the ad
  # group criteria resource names to the list.
  response.each do |row|
    ad_group_criterion_resource_name = row.ad_group_criterion.resource_name
    puts "Ad group criterion with resource name " \
      "'#{ad_group_criterion_resource_name}' was found"
    user_list_criteria << ad_group_criterion_resource_name
  end

  user_list_criteria
end
      

Perl

sub get_user_list_ad_group_criteria {
  my ($api_client, $customer_id, $campaign_id) = @_;

  my $user_list_criterion_resource_names = [];

  # Create a search stream request that will retrieve all of the user list ad
  # group criteria under a campaign.
  my $search_stream_request =
    Google::Ads::GoogleAds::V17::Services::GoogleAdsService::SearchGoogleAdsStreamRequest
    ->new({
      customerId => $customer_id,
      query      => sprintf(
        "SELECT ad_group_criterion.criterion_id " .
          "FROM ad_group_criterion " .
          "WHERE campaign.id = %d AND ad_group_criterion.type = 'USER_LIST'",
        $campaign_id
      )});

  my $search_stream_handler =
    Google::Ads::GoogleAds::Utils::SearchStreamHandler->new({
      service => $api_client->GoogleAdsService(),
      request => $search_stream_request
    });

  # Issue a search request and process the stream response.
  $search_stream_handler->process_contents(
    sub {
      # Display the results and add the resource names to the list.
      my $google_ads_row = shift;

      my $ad_group_criterion_resource_name =
        $google_ads_row->{adGroupCriterion}{resourceName};
      printf "Ad group criterion with resource name '%s' was found.\n",
        $ad_group_criterion_resource_name;
      push(@$user_list_criterion_resource_names,
        $ad_group_criterion_resource_name);
    });

  return $user_list_criterion_resource_names;
}
      

그런 다음 반환된 광고그룹 기준 타겟을 모두 삭제합니다.

자바

private void removeExistingListCriteriaFromAdGroup(
    GoogleAdsClient googleAdsClient, long customerId, long campaignId) {
  // Retrieves all of the ad group criteria under a campaign.
  List<String> adGroupCriteria =
      getUserListAdGroupCriterion(googleAdsClient, customerId, campaignId);

  List<AdGroupCriterionOperation> operations = new ArrayList<>();

  // Creates a list of remove operations.
  for (String adGroupCriterion : adGroupCriteria) {
    operations.add(AdGroupCriterionOperation.newBuilder().setRemove(adGroupCriterion).build());
  }

  // Creates the ad group criterion service.
  try (AdGroupCriterionServiceClient adGroupCriterionServiceClient =
      googleAdsClient.getLatestVersion().createAdGroupCriterionServiceClient()) {
    // Removes the ad group criterion.
    MutateAdGroupCriteriaResponse response =
        adGroupCriterionServiceClient.mutateAdGroupCriteria(
            Long.toString(customerId), operations);
    // Gets and prints the results.
    System.out.printf("Removed %d ad group criteria.%n", response.getResultsCount());
    for (MutateAdGroupCriterionResult result : response.getResultsList()) {
      System.out.printf(
          "Successfully removed ad group criterion with resource name '%s'.%n",
          result.getResourceName());
    }
  }
}

      

C#

private void RemoveExistingListCriteriaFromAdGroup(GoogleAdsClient client, long customerId,
    long campaignId)
{
    // Get the AdGroupCriterionService client.
    AdGroupCriterionServiceClient adGroupCriterionServiceClient =
        client.GetService(Services.V17.AdGroupCriterionService);

    // Retrieve all of the ad group criteria under a campaign.
    List<string> adGroupCriteria =
        GetUserListAdGroupCriteria(client, customerId, campaignId);

    // Create a list of remove operations.
    List<AdGroupCriterionOperation> operations = adGroupCriteria.Select(adGroupCriterion =>
        new AdGroupCriterionOperation { Remove = adGroupCriterion }).ToList();

    // Remove the ad group criteria and print the resource names of the removed criteria.
    MutateAdGroupCriteriaResponse mutateAdGroupCriteriaResponse =
        adGroupCriterionServiceClient.MutateAdGroupCriteria(customerId.ToString(),
            operations);

    Console.WriteLine($"Removed {mutateAdGroupCriteriaResponse.Results.Count} ad group " +
        "criteria.");
    foreach (MutateAdGroupCriterionResult result in mutateAdGroupCriteriaResponse.Results)
    {
        Console.WriteLine("Successfully removed ad group criterion with resource name " +
            $"'{result.ResourceName}'.");
    }
}
      

PHP

private static function removeExistingListCriteriaFromAdGroup(
    GoogleAdsClient $googleAdsClient,
    int $customerId,
    int $campaignId
) {
    // Retrieves all of the ad group criteria under a campaign.
    $allAdGroupCriteria = self::getUserListAdGroupCriteria(
        $googleAdsClient,
        $customerId,
        $campaignId
    );

    $removeOperations = [];
    // Creates a list of remove operations.
    foreach ($allAdGroupCriteria as $adGroupCriterionResourceName) {
        $operation = new AdGroupCriterionOperation();
        $operation->setRemove($adGroupCriterionResourceName);
        $removeOperations[] = $operation;
    }

    // Issues a mutate request to remove the ad group criteria.
    $adGroupCriterionServiceClient = $googleAdsClient->getAdGroupCriterionServiceClient();
    /** @var MutateAdGroupCriteriaResponse $adGroupCriteriaResponse */
    $adGroupCriteriaResponse = $adGroupCriterionServiceClient->mutateAdGroupCriteria(
        MutateAdGroupCriteriaRequest::build($customerId, $removeOperations)
    );

    foreach ($adGroupCriteriaResponse->getResults() as $adGroupCriteriaResult) {
        printf(
            "Successfully removed ad group criterion with resource name '%s'.%s",
            $adGroupCriteriaResult->getResourceName(),
            PHP_EOL
        );
    }
}
      

Python

def remove_existing_criteria_from_ad_group(client, customer_id, campaign_id):
    """Removes all ad group criteria targeting a user list under a campaign.

    This is a necessary step before targeting a user list at the campaign level.

    Args:
        client: an initialized GoogleAdsClient instance.
        customer_id: a str client customer ID.
        campaign_id: a str ID for a campaign that will have all ad group
            criteria that targets user lists removed.
    """
    # Retrieves all of the ad group criteria under a campaign.
    all_ad_group_criteria = get_user_list_ad_group_criteria(
        client, customer_id, campaign_id
    )

    # Creates a list of remove operations.
    remove_operations = []
    for ad_group_criterion_resource_name in all_ad_group_criteria:
        remove_operation = client.get_type("AdGroupCriterionOperation")
        remove_operation.remove = ad_group_criterion_resource_name
        remove_operations.append(remove_operation)

    ad_group_criterion_service = client.get_service("AdGroupCriterionService")
    response = ad_group_criterion_service.mutate_ad_group_criteria(
        customer_id=customer_id, operations=remove_operations
    )
    print(
        "Successfully removed ad group criterion with resource name: "
        f"'{response.results[0].resource_name}'"
    )
      

Ruby

def remove_existing_list_criteria_from_ad_group(
  client,
  customer_id,
  campaign_id
)
  # Retrieves all of the ad group criteria under a campaign.
  ad_group_criteria = get_user_list_ad_group_criterion(
    client, customer_id, campaign_id)

  # Creates a list of remove operations.
  operations = []
  ad_group_criteria.each do |agc|
    operations << client.operation.remove_resource.ad_group_criterion(agc)
  end

  # Issues a mutate request to remove all ad group criteria.
  response = client.service.ad_group_criterion.mutate_ad_group_criteria(
    customer_id: customer_id,
    operations: operations,
  )
  puts "Removed #{response.results.size} ad group criteria."
  response.results.each do |result|
    puts "Successfully removed ad group criterion with resource name " \
      "'#{result.resource_name}'"
  end
end
      

Perl

sub remove_existing_list_criteria_from_ad_group {
  my ($api_client, $customer_id, $campaign_id) = @_;

  # Retrieve all of the ad group criteria under a campaign.
  my $ad_group_criteria =
    get_user_list_ad_group_criteria($api_client, $customer_id, $campaign_id);

  # Create a list of remove operations.
  my $operations = [];
  foreach my $ad_group_criterion (@$ad_group_criteria) {
    push(
      @$operations,
      Google::Ads::GoogleAds::V17::Services::AdGroupCriterionService::AdGroupCriterionOperation
        ->new({
          remove => $ad_group_criterion
        }));
  }

  # Remove the ad group criteria and print the resource names of the removed criteria.
  my $ad_group_criteria_response =
    $api_client->AdGroupCriterionService()->mutate({
      customerId => $customer_id,
      operations => $operations
    });

  printf "Removed %d ad group criteria.\n",
    scalar @{$ad_group_criteria_response->{results}};
  foreach my $result (@{$ad_group_criteria_response->{results}}) {
    printf "Successfully removed ad group criterion with resource name '%s'.\n",
      $result->{resourceName};
  }
}
      

전환 시 기존 캠페인 수준 사용자 목록 기준도 삭제해야 합니다. 광고그룹 수준의 사용자 목록에 추가하고 프로세스는 이전 예와 같습니다.

Campaignguidelines를 사용하여 캠페인의 광고를 사용자 목록에 타겟팅합니다.

자바

private String targetAdsInCampaignToUserList(
    GoogleAdsClient googleAdsClient, long customerId, long campaignId, String userList) {
  // Creates the campaign criterion.
  CampaignCriterion campaignCriterion =
      CampaignCriterion.newBuilder()
          .setCampaign(ResourceNames.campaign(customerId, campaignId))
          .setUserList(UserListInfo.newBuilder().setUserList(userList).build())
          .build();

  // Creates the operation.
  CampaignCriterionOperation operation =
      CampaignCriterionOperation.newBuilder().setCreate(campaignCriterion).build();

  // Creates the campaign criterion service client.
  try (CampaignCriterionServiceClient campaignCriterionServiceClient =
      googleAdsClient.getLatestVersion().createCampaignCriterionServiceClient()) {
    // Adds the campaign criterion.
    MutateCampaignCriteriaResponse response =
        campaignCriterionServiceClient.mutateCampaignCriteria(
            Long.toString(customerId), ImmutableList.of(operation));
    // Gets and prints the campaign criterion resource name.
    String campaignCriterionResourceName = response.getResults(0).getResourceName();
    System.out.printf(
        "Successfully created campaign criterion with resource name '%s' "
            + "targeting user list with resource name '%s' with campaign with ID %d.%n",
        campaignCriterionResourceName, userList, campaignId);
    return campaignCriterionResourceName;
  }
}

      

C#

private string TargetAdsInCampaignToUserList(
    GoogleAdsClient client, long customerId, long campaignId, string userListResourceName)
{
    // Get the CampaignCriterionService client.
    CampaignCriterionServiceClient campaignCriterionServiceClient =
        client.GetService(Services.V17.CampaignCriterionService);

    // Create the campaign criterion.
    CampaignCriterion campaignCriterion = new CampaignCriterion
    {
        Campaign = ResourceNames.Campaign(customerId, campaignId),
        UserList = new UserListInfo
        {
            UserList = userListResourceName
        }
    };

    // Create the operation.
    CampaignCriterionOperation campaignCriterionOperation = new CampaignCriterionOperation
    {
        Create = campaignCriterion
    };

    // Add the campaign criterion and print the resulting criterion's resource name.
    MutateCampaignCriteriaResponse mutateCampaignCriteriaResponse =
        campaignCriterionServiceClient.MutateCampaignCriteria(customerId.ToString(),
            new[] { campaignCriterionOperation });

    string campaignCriterionResourceName =
        mutateCampaignCriteriaResponse.Results.First().ResourceName;
    Console.WriteLine("Successfully created campaign criterion with resource name " +
        $"'{campaignCriterionResourceName}' targeting user list with resource name " +
        $"'{userListResourceName}' with campaign with ID {campaignId}.");

    return campaignCriterionResourceName;
}
      

PHP

private static function targetAdsInCampaignToUserList(
    GoogleAdsClient $googleAdsClient,
    int $customerId,
    int $campaignId,
    string $userListResourceName
): string {
    // Creates the campaign criterion.
    $campaignCriterion = new CampaignCriterion([
        'campaign' => ResourceNames::forCampaign($customerId, $campaignId),
        'user_list' => new UserListInfo(['user_list' => $userListResourceName])
    ]);

    // Creates the operation.
    $operation = new CampaignCriterionOperation();
    $operation->setCreate($campaignCriterion);

    // Issues a mutate request to create a campaign criterion.
    $campaignCriterionServiceClient = $googleAdsClient->getCampaignCriterionServiceClient();
    /** @var MutateCampaignCriteriaResponse $campaignCriteriaResponse */
    $campaignCriteriaResponse = $campaignCriterionServiceClient->mutateCampaignCriteria(
        MutateCampaignCriteriaRequest::build($customerId, [$operation])
    );

    $campaignCriterionResourceName =
        $campaignCriteriaResponse->getResults()[0]->getResourceName();
    printf(
        "Successfully created campaign criterion with resource name '%s' " .
        "targeting user list with resource name '%s' with campaign with ID %d.%s",
        $campaignCriterionResourceName,
        $userListResourceName,
        $campaignId,
        PHP_EOL
    );

    return $campaignCriterionResourceName;
}
      

Python

def target_ads_in_campaign_to_user_list(
    client, customer_id, campaign_id, user_list_resource_name
):
    """Creates a campaign criterion that targets a user list with a campaign.

    Args:
        client: an initialized GoogleAdsClient instance.
        customer_id: a str client customer ID used to create an campaign
            criterion.
        campaign_id: a str ID for a campaign used to create a campaign
            criterion that targets members of a user list.
        user_list_resource_name: a str resource name for a user list.

    Returns:
        a str resource name for a campaign criterion.
    """
    campaign_criterion_operation = client.get_type("CampaignCriterionOperation")
    campaign_criterion = campaign_criterion_operation.create
    campaign_criterion.campaign = client.get_service(
        "CampaignService"
    ).campaign_path(customer_id, campaign_id)
    campaign_criterion.user_list.user_list = user_list_resource_name

    campaign_criterion_service = client.get_service("CampaignCriterionService")
    response = campaign_criterion_service.mutate_campaign_criteria(
        customer_id=customer_id, operations=[campaign_criterion_operation]
    )
    resource_name = response.results[0].resource_name
    print(
        "Successfully created campaign criterion with resource name "
        f"'{resource_name}' targeting user list with resource name "
        f"'{user_list_resource_name}' with campaign with ID {campaign_id}"
    )
    return resource_name
      

Ruby

def target_ads_in_campaign_to_user_list(
  client,
  customer_id,
  campaign_id,
  user_list
)
  # Creates the campaign criterion targeting members of the user list.
  operation = client.operation.create_resource.campaign_criterion do |cc|
    cc.campaign = client.path.campaign(customer_id, campaign_id)
    cc.user_list = client.resource.user_list_info do |info|
      info.user_list = user_list
    end
  end

  # Issues a mutate request to create the campaign criterion.
  response = client.service.campaign_criterion.mutate_campaign_criteria(
    customer_id: customer_id,
    operations: [operation],
  )
  campaign_criterion_resource_name = response.results.first.resource_name
  puts "Successfully created campaign criterion with resource name " \
    "'#{campaign_criterion_resource_name}' targeting user list with resource name " \
    "'#{user_list}' with campaign with ID #{campaign_id}"

  campaign_criterion_resource_name
end
      

Perl

sub target_ads_in_campaign_to_user_list {
  my ($api_client, $customer_id, $campaign_id, $user_list_resource_name) = @_;

  # Create the campaign criterion.
  my $campaign_criterion =
    Google::Ads::GoogleAds::V17::Resources::CampaignCriterion->new({
      campaign => Google::Ads::GoogleAds::V17::Utils::ResourceNames::campaign(
        $customer_id, $campaign_id
      ),
      userList => Google::Ads::GoogleAds::V17::Common::UserListInfo->new({
          userList => $user_list_resource_name
        })});

  # Create the operation.
  my $campaign_criterion_operation =
    Google::Ads::GoogleAds::V17::Services::CampaignCriterionService::CampaignCriterionOperation
    ->new({
      create => $campaign_criterion
    });

  # Add the campaign criterion and print the resulting criterion's resource name.
  my $campaign_criteria_response =
    $api_client->CampaignCriterionService()->mutate({
      customerId => $customer_id,
      operations => [$campaign_criterion_operation]});

  my $campaign_criterion_resource_name =
    $campaign_criteria_response->{results}[0]{resourceName};
  printf "Successfully created campaign criterion with resource name '%s' " .
    "targeting user list with resource name '%s' with campaign with ID %d.\n",
    $campaign_criterion_resource_name, $user_list_resource_name, $campaign_id;

  return $campaign_criterion_resource_name;
}
      

목록 실적 검토

잠재고객 세그먼트에 대한 실적 데이터를 수집하려면 검색을 실행하세요. ad_group_audience_view에 대한 요청 또는 campaign_audience_view 리소스. 예를 들어 conversions 또는 cost_per_conversion를 확인하여 잠재고객 세그먼트 타겟팅이 실제로 그에 따라 입찰가 조정을 조정하세요.

SELECT
  ad_group_criterion.criterion_id,
  metrics.conversions,
  metrics.cost_per_conversion
FROM ad_group_audience_view