스마트 캠페인 및 스마트 캠페인 설정 만들기

스마트 캠페인은 SmartCampaignSetting이라는 리소스에 의존합니다. 이 리소스에는 기본 Campaign 리소스에서는 사용할 수 없는 추가 구성 옵션이 포함되어 있습니다.

스마트 캠페인 설정은 캠페인에 연결되지 않고는 존재할 수 없으므로 두 작업을 동일한 mutate 요청에 포함하는 것이 가장 좋습니다.

캠페인 만들기

스마트 캠페인은 주로 Google의 광고 기술에 의해 자동으로 관리되므로 많은 필드를 설정할 필요가 없습니다.

스마트 캠페인의 주요 요구사항:

이 예시에서는 임시 리소스 이름을 사용하여 이 캠페인의 리소스 이름 값을 설정합니다. 이를 통해 캠페인이 백엔드에 존재하기 전에 변이 요청의 다른 객체에서 캠페인을 참조할 수 있습니다.

자바

private MutateOperation createSmartCampaignOperation(long customerId) {
  MutateOperation.Builder builder = MutateOperation.newBuilder();
  builder
      .getCampaignOperationBuilder()
      .getCreateBuilder()
      .setName("Smart campaign " + CodeSampleHelper.getShortPrintableDateTime())
      .setStatus(CampaignStatus.PAUSED)
      .setAdvertisingChannelType(AdvertisingChannelType.SMART)
      .setAdvertisingChannelSubType(AdvertisingChannelSubType.SMART_CAMPAIGN)
      // Assigns the resource name with a temporary ID.
      .setResourceName(ResourceNames.campaign(customerId, SMART_CAMPAIGN_TEMPORARY_ID))
      .setCampaignBudget(ResourceNames.campaignBudget(customerId, BUDGET_TEMPORARY_ID))
      // Declares whether this campaign serves political ads targeting the EU.
      .setContainsEuPoliticalAdvertising(DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING);
  return builder.build();
}
      

C#

/// <summary>
/// Creates a MutateOperation that creates a new Smart campaign.
/// A temporary ID will be assigned to this campaign so that it can be referenced by other
/// objects being created in the same Mutate request.
/// </summary>
/// <param name="customerId">The Google Ads customer ID.</param>
/// <returns>A MutateOperation that creates a campaign.</returns>
private MutateOperation CreateSmartCampaignOperation(long customerId)
{
    return new MutateOperation
    {
        CampaignOperation = new CampaignOperation
        {
            Create = new Campaign
            {
                Name = $"Smart campaign #{ExampleUtilities.GetRandomString()}",
                // Set the campaign status as PAUSED. The campaign is the only entity in
                // the mutate request that should have its status set.
                Status = CampaignStatus.Paused,
                // AdvertisingChannelType must be SMART.
                AdvertisingChannelType = AdvertisingChannelType.Smart,
                // AdvertisingChannelSubType must be SMART_CAMPAIGN.
                AdvertisingChannelSubType = AdvertisingChannelSubType.SmartCampaign,
                // Assign the resource name with a temporary ID.
                ResourceName =
                    ResourceNames.Campaign(customerId, SMART_CAMPAIGN_TEMPORARY_ID),
                // Set the budget using the given budget resource name.
                CampaignBudget =
                    ResourceNames.CampaignBudget(customerId, BUDGET_TEMPORARY_ID),

                // Declare whether or not this campaign contains political ads targeting the EU.
                ContainsEuPoliticalAdvertising = EuPoliticalAdvertisingStatus.DoesNotContainEuPoliticalAdvertising,
            }
        }
    };
}
      

PHP

private static function createSmartCampaignOperation(int $customerId): MutateOperation
{
    // Creates the campaign object.
    $campaign = new Campaign(
        [
        'name' => "Smart campaign #" . Helper::getPrintableDatetime(),
        // Sets the campaign status as PAUSED. The campaign is the only entity in the mutate
        // request that should have its' status set.
        'status' => CampaignStatus::PAUSED,
        // The advertising channel type is required to be SMART.
        'advertising_channel_type' => AdvertisingChannelType::SMART,
        // The advertising channel sub type is required to be SMART_CAMPAIGN.
        'advertising_channel_sub_type' => AdvertisingChannelSubType::SMART_CAMPAIGN,
        // Assigns the resource name with a temporary ID.
        'resource_name' =>
            ResourceNames::forCampaign($customerId, self::SMART_CAMPAIGN_TEMPORARY_ID),
        // Sets the budget using the given budget resource name.
        'campaign_budget' =>
            ResourceNames::forCampaignBudget($customerId, self::BUDGET_TEMPORARY_ID),
        // Declare whether or not this campaign serves political ads targeting the EU.
        'contains_eu_political_advertising' =>
            EuPoliticalAdvertisingStatus::DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING
        ]
    );

    // Creates the MutateOperation that creates the campaign.
    return new MutateOperation(
        [
        'campaign_operation' => new CampaignOperation(['create' => $campaign])
        ]
    );
}
      

Python

def create_smart_campaign_operation(
    client: GoogleAdsClient, customer_id: str
) -> MutateOperation:
    """Creates a MutateOperation that creates a new Smart campaign.

    A temporary ID will be assigned to this campaign so that it can
    be referenced by other objects being created in the same Mutate request.

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

    Returns:
        a MutateOperation that creates a campaign.
    """
    mutate_operation: MutateOperation = client.get_type("MutateOperation")
    campaign_operation: CampaignOperation = mutate_operation.campaign_operation
    campaign: Campaign = campaign_operation.create
    campaign.name = f"Smart campaign #{uuid4()}"
    # Set the campaign status as PAUSED. The campaign is the only entity in
    # the mutate request that should have its' status set.
    campaign.status = client.enums.CampaignStatusEnum.PAUSED
    # Campaign.AdvertisingChannelType is required to be SMART.
    campaign.advertising_channel_type = (
        client.enums.AdvertisingChannelTypeEnum.SMART
    )
    # Campaign.AdvertisingChannelSubType is required to be SMART_CAMPAIGN.
    campaign.advertising_channel_sub_type = (
        client.enums.AdvertisingChannelSubTypeEnum.SMART_CAMPAIGN
    )
    # Assign the resource name with a temporary ID.
    campaign.resource_name = client.get_service(
        "CampaignService"
    ).campaign_path(customer_id, _SMART_CAMPAIGN_TEMPORARY_ID)
    # Set the budget using the given budget resource name.
    campaign.campaign_budget = client.get_service(
        "CampaignBudgetService"
    ).campaign_budget_path(customer_id, _BUDGET_TEMPORARY_ID)

    # Declare whether or not this campaign serves political ads targeting the
    # EU. Valid values are:
    #   CONTAINS_EU_POLITICAL_ADVERTISING
    #   DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING
    campaign.contains_eu_political_advertising = (
        client.enums.EuPoliticalAdvertisingStatusEnum.DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING
    )

    return mutate_operation
      

Ruby

# Creates a mutate_operation that creates a new Smart campaign.
# A temporary ID will be assigned to this campaign so that it can
# be referenced by other objects being created in the same mutate request.
def create_smart_campaign_operation(
    client,
    customer_id)
  mutate_operation = client.operation.mutate do |m|
    m.campaign_operation = client.operation.create_resource.campaign do |c|
      c.name = "Smart campaign ##{(Time.new.to_f * 1000).to_i}"
      # Sets the campaign status as PAUSED. The campaign is the only entity in
      # the mutate request that should have its' status set.
      c.status = :PAUSED
      # campaign.advertising_channel_type is required to be SMART.
      c.advertising_channel_type = :SMART
      # campaign.advertising_channel_sub_type is required to be SMART_CAMPAIGN.
      c.advertising_channel_sub_type = :SMART_CAMPAIGN
      # Assigns the resource name with a temporary ID.
      c.resource_name = client.path.campaign(customer_id, SMART_CAMPAIGN_TEMPORARY_ID)
      c.campaign_budget = client.path.campaign_budget(customer_id, BUDGET_TEMPORARY_ID)
      # Declare whether or not this campaign serves political ads targeting the EU.
      # Valid values are CONTAINS_EU_POLITICAL_ADVERTISING and
      # DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING.
      c.contains_eu_political_advertising = :DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING
    end
  end

  mutate_operation
end
      

Perl

# Creates a MutateOperation that creates a new Smart campaign.
# A temporary ID will be assigned to this campaign so that it can be referenced
# by other objects being created in the same Mutate request.
sub _create_smart_campaign_operation {
  my ($customer_id) = @_;

  return
    Google::Ads::GoogleAds::V25::Services::GoogleAdsService::MutateOperation->
    new({
      campaignOperation =>
        Google::Ads::GoogleAds::V25::Services::CampaignService::CampaignOperation
        ->new({
          create => Google::Ads::GoogleAds::V25::Resources::Campaign->new({
              name => "Smart campaign #" . uniqid(),
              # Set the campaign status as PAUSED. The campaign is the only
              # entity in the mutate request that should have its status set.
              status => PAUSED,
              # AdvertisingChannelType must be SMART.
              advertisingChannelType => SMART,
              # AdvertisingChannelSubType must be SMART_CAMPAIGN.
              advertisingChannelSubType =>
                Google::Ads::GoogleAds::V25::Enums::AdvertisingChannelSubTypeEnum::SMART_CAMPAIGN,
              # Assign the resource name with a temporary ID.
              resourceName =>
                Google::Ads::GoogleAds::V25::Utils::ResourceNames::campaign(
                $customer_id, SMART_CAMPAIGN_TEMPORARY_ID
                ),
              # Declare whether or not this campaign serves political ads targeting the EU.
              # Valid values are CONTAINS_EU_POLITICAL_ADVERTISING and
              # DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING.
              containsEuPoliticalAdvertising =>
                DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING,
              # Set the budget using the given budget resource name.
              campaignBudget =>
                Google::Ads::GoogleAds::V25::Utils::ResourceNames::campaign_budget(
                $customer_id, BUDGET_TEMPORARY_ID
                )})})});
}
      

curl

스마트 캠페인 설정 만들기

SmartCampaignSetting 리소스는 스마트 캠페인을 구성하는 데만 사용됩니다. 이 리소스는 참조할 수 있는 스마트 캠페인이 없는 한 구성할 수 없습니다. 이러한 이유로 스마트 캠페인 설정은 고유합니다. 기본 Campaign 리소스의 확장 프로그램으로 생각하면 됩니다.

스마트 캠페인 설정은 캠페인과 매우 밀접하게 연결되어 있으므로 create 작업을 사용하여 구성할 수 없습니다. 대신 update 작업에서 구성해야 합니다.

campaign 필드가 있어 속한 캠페인을 지정하는 AdGroup 객체와 같은 리소스와 달리 스마트 캠페인 설정은 캠페인과 동일한 ID를 사용하여 리소스 이름을 직접 업데이트해야 합니다. 스마트 캠페인 설정을 구성하는 것은 별도의 리소스를 사용하여 캠페인을 업데이트하는 것과 유사합니다.

스마트 캠페인 설정의 주요 요구사항은 다음과 같습니다.

  • 참조할 수 있는 Campaign이 있어야 합니다.
  • Campaign와의 관계는 campaign 필드가 아닌 resource_name에 정의됩니다.
  • business_profile_location를 설정하거나 final_url 및 business_name를 함께 설정해야 합니다.
  • 처음 설정을 구성할 때도 update 작업에 update_mask를 추가해야 합니다.
  • 모든 스마트 캠페인에는 방문 페이지가 있어야 합니다. 방문 페이지는 final_url를 사용하여 설정하거나 자동 방문 페이지를 선택하여 설정할 수 있습니다. 자동 방문 페이지를 선택하면 제공된 business_profile_location의 정보를 사용하여 캠페인의 방문 페이지가 생성됩니다.

자바

private MutateOperation createSmartCampaignSettingOperation(
    long customerId, String businessProfileLocation, String businessName) {
  MutateOperation.Builder builder = MutateOperation.newBuilder();
  SmartCampaignSetting.Builder settingBuilder =
      builder
          .getSmartCampaignSettingOperationBuilder()
          .getUpdateBuilder()
          // Sets a temporary ID in the campaign setting's resource name to associate it with
          // the campaign created in the previous step.
          .setResourceName(
              ResourceNames.smartCampaignSetting(customerId, SMART_CAMPAIGN_TEMPORARY_ID));
  // Configures the SmartCampaignSetting using many of the same details used to
  // generate a budget suggestion.
  settingBuilder
      .setFinalUrl(LANDING_PAGE_URL)
      .setAdvertisingLanguageCode(LANGUAGE_CODE)
      .getPhoneNumberBuilder()
      .setCountryCode(COUNTRY_CODE)
      .setPhoneNumber(PHONE_NUMBER);

  // It's required that either a business profile location resource name or a business name is
  // added to the SmartCampaignSetting.
  if (businessProfileLocation != null) {
    settingBuilder.setBusinessProfileLocation(businessProfileLocation);
  } else {
    settingBuilder.setBusinessName(businessName);
  }
  builder
      .getSmartCampaignSettingOperationBuilder()
      .setUpdateMask(FieldMasks.allSetFieldsOf(settingBuilder.build()));
  return builder.build();
}
      

C#

/// <summary>
/// Creates a MutateOperation to create a new SmartCampaignSetting. SmartCampaignSettings
/// are unique in that they only support UPDATE operations, which are used to update and
/// create them. Below we will use a temporary ID in the resource name to associate it with
/// the campaign created in the previous step.
/// </summary>
/// <param name="customerId">The Google Ads customer ID.</param>
/// <param name="businessProfileLocation">The identifier of a Business Profile location.</param>
/// <param name="businessName">The name of a Business Profile business.</param>
/// <returns>A MutateOperation that creates a SmartCampaignSetting.</returns>
private MutateOperation CreateSmartCampaignSettingOperation(long customerId,
    string businessProfileLocation, string businessName)
{
    SmartCampaignSetting smartCampaignSetting = new SmartCampaignSetting
    {
        // Set a temporary ID in the campaign setting's resource name to associate it with
        // the campaign created in the previous step.
        ResourceName =
            ResourceNames.SmartCampaignSetting(customerId, SMART_CAMPAIGN_TEMPORARY_ID),
        // Below we configure the SmartCampaignSetting using many of the same details used
        // to generate a budget suggestion.
        PhoneNumber = new SmartCampaignSetting.Types.PhoneNumber
        {
            CountryCode = COUNTRY_CODE,
            PhoneNumber_ = PHONE_NUMBER
        },
        FinalUrl = LANDING_PAGE_URL,
        AdvertisingLanguageCode = LANGUAGE_CODE
    };

    // Either a business profile location or a business name must be added to the
    // SmartCampaignSetting.
    if (!string.IsNullOrEmpty(businessProfileLocation))
    {
        // Transform Google Business Location ID to a compatible format before
        // passing it onto the API.
        smartCampaignSetting.BusinessProfileLocation = businessProfileLocation;
    }
    else
    {
        smartCampaignSetting.BusinessName = businessName;
    }

    return new MutateOperation
    {
        SmartCampaignSettingOperation = new SmartCampaignSettingOperation
        {
            Update = smartCampaignSetting,
            // Set the update mask on the operation. This is required since the smart
            // campaign setting is created in an UPDATE operation. Here the update mask
            // will be a list of all the fields that were set on the SmartCampaignSetting.
            UpdateMask = FieldMasks.AllSetFieldsOf(smartCampaignSetting)
        }
    };
}
      

PHP

private static function createSmartCampaignSettingOperation(
    int $customerId,
    ?string $businessProfileLocationResourceName,
    ?string $businessName
): MutateOperation {
    // Creates the smart campaign setting object.
    $smartCampaignSetting = new SmartCampaignSetting(
        [
        // Sets a temporary ID in the campaign setting's resource name to associate it with
        // the campaign created in the previous step.
        'resource_name' => ResourceNames::forSmartCampaignSetting(
            $customerId,
            self::SMART_CAMPAIGN_TEMPORARY_ID
        ),
        // Below we configure the SmartCampaignSetting using many of the same details used to
        // generate a budget suggestion.
        'phone_number' => new PhoneNumber(
            [
            'country_code' => self::COUNTRY_CODE,
            'phone_number' => self::PHONE_NUMBER
            ]
        ),
        'final_url' => self::LANDING_PAGE_URL,
        'advertising_language_code' => self::LANGUAGE_CODE,
        ]
    );

    // It's required that either a business profile location resource name or a business name is
    // added to the SmartCampaignSetting.
    if ($businessProfileLocationResourceName) {
        $smartCampaignSetting->setBusinessProfileLocation($businessProfileLocationResourceName);
    } else {
        $smartCampaignSetting->setBusinessName($businessName);
    }

    // Creates the MutateOperation that creates the smart campaign setting with an update.
    return new MutateOperation(
        [
        'smart_campaign_setting_operation' => new SmartCampaignSettingOperation(
            [
            'update' => $smartCampaignSetting,
            // Sets the update mask on the operation. This is required since the smart campaign
            // setting is created in an UPDATE operation. Here the update mask will be a list
            // of all the fields that were set on the SmartCampaignSetting.
            'update_mask' => FieldMasks::allSetFieldsOf($smartCampaignSetting)
            ]
        )
        ]
    );
}
      

Python

def create_smart_campaign_setting_operation(
    client: GoogleAdsClient,
    customer_id: str,
    business_profile_location: Optional[str],
    business_name: Optional[str],
) -> MutateOperation:
    """Creates a MutateOperation to create a new SmartCampaignSetting.

    SmartCampaignSettings are unique in that they only support UPDATE
    operations, which are used to update and create them. Below we will
    use a temporary ID in the resource name to associate it with the
    campaign created in the previous step.

    Args:
        client: an initialized GoogleAdsClient instance.
        customer_id: a client customer ID.
        business_profile_location: the resource name of a Business Profile
          location.
        business_name: the name of a Business Profile.

    Returns:
        a MutateOperation that creates a SmartCampaignSetting.
    """
    mutate_operation: MutateOperation = client.get_type("MutateOperation")
    smart_campaign_setting_operation: SmartCampaignSettingOperation = (
        mutate_operation.smart_campaign_setting_operation
    )
    smart_campaign_setting: SmartCampaignSetting = (
        smart_campaign_setting_operation.update
    )
    # Set a temporary ID in the campaign setting's resource name to associate it
    # with the campaign created in the previous step.
    smart_campaign_setting.resource_name = client.get_service(
        "SmartCampaignSettingService"
    ).smart_campaign_setting_path(customer_id, _SMART_CAMPAIGN_TEMPORARY_ID)

    # Below we configure the SmartCampaignSetting using many of the same
    # details used to generate a budget suggestion.
    smart_campaign_setting.phone_number.country_code = _COUNTRY_CODE
    smart_campaign_setting.phone_number.phone_number = _PHONE_NUMBER
    smart_campaign_setting.final_url = _LANDING_PAGE_URL
    smart_campaign_setting.advertising_language_code = _LANGUAGE_CODE

    # Set either of the business_profile_location or business_name, depending on
    # whichever is provided.
    if business_profile_location:
        smart_campaign_setting.business_profile_location = (
            business_profile_location
        )
    else:
        smart_campaign_setting.business_name = business_name

    # Set the update mask on the operation. This is required since the smart
    # campaign setting is created in an UPDATE operation. Here the update
    # mask will be a list of all the fields that were set on the
    # SmartCampaignSetting.
    client.copy_from(
        smart_campaign_setting_operation.update_mask,
        protobuf_helpers.field_mask(None, smart_campaign_setting._pb),
    )

    return mutate_operation
      

Ruby

# Creates a mutate_operation to create a new smart_campaign_setting.
# smart_campaign_settings are unique in that they only support UPDATE
# operations, which are used to update and create them. Below we will
# use a temporary ID in the resource name to associate it with the
# campaign created in the previous step.
def create_smart_campaign_setting_operation(
  client,
  customer_id,
  business_profile_location,
  business_name)
  mutate_operation = client.operation.mutate do |m|
    m.smart_campaign_setting_operation =
      client.operation.update_resource.smart_campaign_setting(
        # Sets a temporary ID in the campaign setting's resource name to
        # associate it with the campaign created in the previous step.
        client.path.smart_campaign_setting(
          customer_id, SMART_CAMPAIGN_TEMPORARY_ID)
      ) do |scs|
      # Below we configure the smart_campaign_setting using many of the same
      # details used to generate a budget suggestion.
      scs.phone_number = client.resource.phone_number do |p|
        p.country_code = COUNTRY_CODE
        p.phone_number = PHONE_NUMBER
      end
      scs.final_url = LANDING_PAGE_URL
      scs.advertising_language_code = LANGUAGE_CODE
      # It's required that either a business location ID or a business name is
      # added to the smart_campaign_setting.
      if business_profile_location
        scs.business_profile_location = business_profile_location
      else
        scs.business_name = business_name
      end
    end
  end

  mutate_operation
end
      

Perl

# Creates a MutateOperation to create a new SmartCampaignSetting.
# SmartCampaignSettings are unique in that they only support UPDATE operations,
# which are used to update and create them. Below we will use a temporary ID in
# the resource name to associate it with the campaign created in the previous step.
sub _create_smart_campaign_setting_operation {
  my ($customer_id, $business_profile_location, $business_name) = @_;

  my $smart_campaign_setting =
    Google::Ads::GoogleAds::V25::Resources::SmartCampaignSetting->new({
      # Set a temporary ID in the campaign setting's resource name to associate it
      # with the campaign created in the previous step.
      resourceName =>
        Google::Ads::GoogleAds::V25::Utils::ResourceNames::smart_campaign_setting(
        $customer_id, SMART_CAMPAIGN_TEMPORARY_ID
        ),
      # Below we configure the SmartCampaignSetting using many of the same
      # details used to generate a budget suggestion.
      phoneNumber => Google::Ads::GoogleAds::V25::Resources::PhoneNumber->new({
          countryCode => COUNTRY_CODE,
          phoneNumber => PHONE_NUMBER
        }
      ),
      finalUrl                => LANDING_PAGE_URL,
      advertisingLanguageCode => LANGUAGE_CODE
    });

  # It's required that either a business profile location or a business name is
  # added to the SmartCampaignSetting.
  if (defined $business_profile_location) {
    $smart_campaign_setting->{businessProfileLocation} =
      $business_profile_location;
  } else {
    $smart_campaign_setting->{businessName} = $business_name;
  }

  return
    Google::Ads::GoogleAds::V25::Services::GoogleAdsService::MutateOperation->
    new({
      smartCampaignSettingOperation =>
        Google::Ads::GoogleAds::V25::Services::SmartCampaignSettingService::SmartCampaignSettingOperation
        ->new({
          update => $smart_campaign_setting,
          # Set the update mask on the operation. This is required since the
          # smart campaign setting is created in an UPDATE operation. Here the
          # update mask will be a list of all the fields that were set on the
          # SmartCampaignSetting.
          updateMask => all_set_fields_of($smart_campaign_setting)})});
}
      

curl

방문 페이지

스마트 캠페인에는 시청자를 안내할 방문 페이지가 있어야 합니다. final_url를 제공하여 웹사이트 URL을 사용하거나 자동 방문 페이지를 선택하여 방문 페이지를 만들 수 있습니다. 생성된 방문 페이지는 비즈니스 프로필의 정보를 사용합니다.

캠페인에 방문 페이지를 생성하려면 business_profile_location 식별자를 제공하고, AdOptimizedBusinessProfileSetting 인스턴스로 ad_optimized_business_profile_setting 필드를 구성하고 (include_lead_form 하위 필드를 false 또는 true로 설정) 작업의 update_mask에 ad_optimized_business_profile_setting.include_lead_form을 포함해야 합니다 (리프가 아닌 경로 ad_optimized_business_profile_setting을 update_mask에 포함하면 FieldMaskError.FIELD_HAS_SUBFIELDS 오류가 반환됨). 다음은 리드 양식 없이 설정을 구성하는 방법의 예입니다.

자바

SmartCampaignSetting smartCampaignSetting =
    SmartCampaignSetting.newBuilder()
        .setBusinessProfileLocation(businessProfileLocation)
        // Configures the ad-optimized Business Profile setting with
        // include_lead_form set to false.
        .setAdOptimizedBusinessProfileSetting(
            AdOptimizedBusinessProfileSetting.newBuilder()
                .setIncludeLeadForm(false)
                .build())
        .build();

C#

SmartCampaignSetting smartCampaignSetting = new SmartCampaignSetting()
{
    BusinessProfileLocation = businessProfileLocation,
    // Configures the ad-optimized Business Profile setting with
    // include_lead_form set to false.
    AdOptimizedBusinessProfileSetting =
        new SmartCampaignSetting.Types.AdOptimizedBusinessProfileSetting
        {
            IncludeLeadForm = false
        }
};

PHP

$smartCampaignSetting = new SmartCampaignSetting([
    'business_profile_location' => $business_profile_location,
    // Configures the ad-optimized Business Profile setting with
    // include_lead_form set to false.
    'ad_optimized_business_profile_setting' =>
        new AdOptimizedBusinessProfileSetting([
            'include_lead_form' => false
        ]),
]);

Python

smart_campaign_setting = client.get_type("SmartCampaignSetting")
smart_campaign_setting.business_profile_location = business_profile_location
# Configures the ad-optimized Business Profile setting with
# include_lead_form set to false.
setting = smart_campaign_setting.ad_optimized_business_profile_setting
setting.include_lead_form = False

Ruby

smart_campaign_setting = client.resource.smart_campaign_setting do |s|
  s.business_profile_location = business_profile_location
  # Configures the ad-optimized Business Profile setting with
  # include_lead_form set to false.
  s.ad_optimized_business_profile_setting =
    client.resource.ad_optimized_business_profile_setting do |a|
      a.include_lead_form = false
    end
end

Perl

my $smart_campaign_setting =
  Google::Ads::GoogleAds::V25::Resources::SmartCampaignSetting
  ->new({
    businessProfileLocation => $business_profile_location,
    # Configures the ad-optimized Business Profile setting with
    # include_lead_form set to false.
    adOptimizedBusinessProfileSetting =>
      Google::Ads::GoogleAds::V25::Resources::AdOptimizedBusinessProfileSetting
      ->new({
        includeLeadForm => "false"
      })
  });

잠재고객이 양식을 작성하여 직접 연락할 수 있도록 생성된 방문 페이지에 리드 양식을 포함하려면 include_lead_form을 true로 설정하고 update_mask에 ad_optimized_business_profile_setting.include_lead_form을 포함하세요. 사용 설정 방법의 예는 다음과 같습니다.

자바

SmartCampaignSetting smartCampaignSetting =
    SmartCampaignSetting.newBuilder()
        .setBusinessProfileLocation(businessProfileLocation)
        // Sets the AdOptimizedBusinessProfileSetting.include_lead_form
        // field to true.
        .setAdOptimizedBusinessProfileSetting(
            AdOptimizedBusinessProfileSetting.newBuilder()
                .setIncludeLeadForm(true)
                .build())
        .build();

C#

SmartCampaignSetting smartCampaignSetting = new SmartCampaignSetting()
{
    BusinessProfileLocation = businessProfileLocation,
    // Sets the AdOptimizedBusinessProfileSetting.include_lead_form
    // field to true.
    AdOptimizedBusinessProfileSetting =
        new SmartCampaignSetting.Types.AdOptimizedBusinessProfileSetting
        {
            IncludeLeadForm = true
        }
};

PHP

$smartCampaignSetting = new SmartCampaignSetting([
    'business_profile_location' => $business_profile_location,
    // Sets the AdOptimizedBusinessProfileSetting.include_lead_form field
    // to true.
    'ad_optimized_business_profile_setting' =>
        new AdOptimizedBusinessProfileSetting([
            'include_lead_form' => true
        ]),
]);

Python

smart_campaign_setting = client.get_type("SmartCampaignSetting")
smart_campaign_setting.business_profile_location = business_profile_location
# Sets the AdOptimizedBusinessProfileSetting.include_lead_form field to
# true.
setting = smart_campaign_setting.ad_optimized_business_profile_setting
setting.include_lead_form = True

Ruby

smart_campaign_setting = client.resource.smart_campaign_setting do |s|
  s.business_profile_location = business_profile_location
  # Sets the AdOptimizedBusinessProfileSetting.include_lead_form field to
  # true.
  s.ad_optimized_business_profile_setting =
    client.resource.ad_optimized_business_profile_setting do |a|
      a.include_lead_form = true
    end
end

Perl

my $smart_campaign_setting =
  Google::Ads::GoogleAds::V25::Resources::SmartCampaignSetting
  ->new({
    businessProfileLocation => $business_profile_location,
    # Sets the AdOptimizedBusinessProfileSetting.include_lead_form field to
    # true.
    adOptimizedBusinessProfileSetting =>
      Google::Ads::GoogleAds::V25::Resources::AdOptimizedBusinessProfileSetting
      ->new({
        includeLeadForm => "true"
      })
  });