কীওয়ার্ড থিম, বাজেট, এবং বিজ্ঞাপন পাঠ্য সম্পদ পরামর্শ পান

Google Ads API স্মার্ট ক্যাম্পেইন তৈরি করার সময় কনফিগারেশনের বিশদ পরামর্শ দেওয়ার জন্য SmartCampaignSuggestService প্রকাশ করে। এটি কীওয়ার্ড থিম, বাজেটের পরিমাণ, সেইসাথে পৃথক বিজ্ঞাপনের জন্য শিরোনাম এবং বিবরণের পরামর্শ দেওয়ার জন্য বিজ্ঞাপিত ব্যবসার বিশদ বিবরণ ব্যবহার করে (একটি SmartCampaignSuggestionInfo উদাহরণের আকারে)।

একটি SmartCampaignSuggestionInfo উদাহরণ তৈরি করুন

স্মার্ট প্রচারাভিযানের পরামর্শ তৈরি করার জন্য একটি SmartCampaignSuggestionInfo ইন্সট্যান্স ব্যবহার করা প্রয়োজন যাতে বিজ্ঞাপিত ব্যবসার বিশদ বিবরণ থাকে। যেহেতু একই SmartCampaignSuggestionInfo ইন্সট্যান্স ব্যবহার করে বিভিন্ন ধরনের স্মার্ট প্রচারাভিযানের পরামর্শ পুনরুদ্ধার করা সম্ভব, আপনি প্রথমে একটি তৈরি করতে পারেন এবং এটি একাধিকবার ব্যবহার করতে পারেন।

SmartCampaignSuggestionInfo এর জন্য মূল প্রয়োজনীয়তা:

  • একটি ল্যান্ডিং পৃষ্ঠা প্রয়োজন, যা হয় একটি বিদ্যমান ওয়েবসাইট ( final_url ) হতে পারে অথবা business_profile_location শনাক্তকারীর মাধ্যমে প্রাপ্ত বিজনেস প্রোফাইল তথ্য ব্যবহার করে আপনার প্রচারের জন্য তৈরি একটি স্বয়ংক্রিয় ল্যান্ডিং পৃষ্ঠা হতে পারে। আপনি যদি একটি স্বয়ংক্রিয় ল্যান্ডিং পৃষ্ঠা ব্যবহার করার পরিকল্পনা করেন, তাহলে পরামর্শ তৈরি করার সময় business_profile_location ফিল্ড সেট করতে ভুলবেন না।

    • যদি final_url সেট করা থাকে, তাহলে হয় business_profile_location বা business_name সেট করা যেতে পারে।
    • যদি final_url সেট করা না থাকে, তাহলে business_profile_location সেট করতে হবে।
  • যখন SuggestKeywordThemes পদ্ধতি থেকে কীওয়ার্ড থিম পরামর্শ পুনরুদ্ধার করতে ব্যবহৃত হয়, তখন keyword_themes ক্ষেত্র সেট করার প্রয়োজন হয় না।

  • যখন SuggestSmartCampaignAd পদ্ধতি থেকে বিজ্ঞাপনের পরামর্শ পুনরুদ্ধার করতে ব্যবহার করা হয়, তখন language_code এবং keyword_themes ক্ষেত্র প্রয়োজন হয়।

  • সর্বোত্তম পরামর্শের জন্য অবজেক্টে যতটা সম্ভব বিশদ যোগ করা উচিত।

জাভা

private SmartCampaignSuggestionInfo getSmartCampaignSuggestionInfo(
    GoogleAdsClient googleAdsClient, String businessProfileLocation, String businessName) {
  SmartCampaignSuggestionInfo.Builder suggestionInfoBuilder =
      SmartCampaignSuggestionInfo.newBuilder()
          // Adds the URL of the campaign's landing page.
          .setFinalUrl(LANDING_PAGE_URL)
          // Adds the language code for the campaign.
          .setLanguageCode(LANGUAGE_CODE)
          // Constructs location information using the given geo target constant. It's also
          // possible to provide a geographic proximity using the "proximity" field,
          // for example:
          // .setProximity(
          //     ProximityInfo.newBuilder()
          //         .setAddress(
          //             AddressInfo.newBuilder()
          //                 .setPostalCode(INSERT_POSTAL_CODE)
          //                 .setProvinceCode(INSERT_PROVINCE_CODE)
          //                 .setCountryCode(INSERT_COUNTRY_CODE)
          //                 .setProvinceName(INSERT_PROVINCE_NAME)
          //                 .setStreetAddress(INSERT_STREET_ADDRESS)
          //                 .setStreetAddress2(INSERT_STREET_ADDRESS_2)
          //                 .setCityName(INSERT_CITY_NAME)
          //                 .build())
          //         .setRadius(INSERT_RADIUS)
          //         .setRadiusUnits(INSERT_RADIUS_UNITS)
          //         .build())
          // For more information on proximities see:
          // https://developers.google.com/google-ads/api/reference/rpc/latest/ProximityInfo
          //
          // Adds LocationInfo objects to the list of locations. You have the option of
          // providing multiple locations when using location-based suggestions.
          .setLocationList(
              LocationList.newBuilder()
                  // Sets one location to the resource name of the given geo target constant.
                  .addLocations(
                      LocationInfo.newBuilder()
                          .setGeoTargetConstant(
                              ResourceNames.geoTargetConstant(GEO_TARGET_CONSTANT))
                          .build())
                  .build())
          // Adds a schedule detailing which days of the week the business is open.
          // This schedule describes a schedule in which the business is open on
          // Mondays from 9am to 5pm.
          .addAdSchedules(
              AdScheduleInfo.newBuilder()
                  // Sets the day of this schedule as Monday.
                  .setDayOfWeek(DayOfWeek.MONDAY)
                  // Sets the start hour to 9am.
                  .setStartHour(9)
                  // Sets the end hour to 5pm.
                  .setEndHour(17)
                  // Sets the start and end minute of zero, for example: 9:00 and 5:00.
                  .setStartMinute(MinuteOfHour.ZERO)
                  .setEndMinute(MinuteOfHour.ZERO)
                  .build());

  // Sets either of the business_profile_location or business_name, depending on whichever is
  // provided.
  if (businessProfileLocation != null) {
    suggestionInfoBuilder.setBusinessProfileLocation(businessProfileLocation);
  } else {
    suggestionInfoBuilder.setBusinessContext(
        BusinessContext.newBuilder().setBusinessName(businessName).build());
  }
  return suggestionInfoBuilder.build();
}
      

সি#

/// <summary>
/// Builds a SmartCampaignSuggestionInfo object with business details.
///
/// The details are used by the SmartCampaignSuggestService to suggest a
/// budget amount as well as creatives for the ad.
///
/// Note that when retrieving ad creative suggestions it's required that the
/// "final_url", "language_code" and "keyword_themes" fields are set on the
/// SmartCampaignSuggestionInfo instance.
/// </summary>
/// <param name="client">The Google Ads client.</param>
/// <param name="businessProfileLocation">The identifier of a Business Profile location.
/// </param>
/// <param name="businessName">The name of a Business Profile.</param>
/// <returns>A SmartCampaignSuggestionInfo instance .</returns>
private SmartCampaignSuggestionInfo GetSmartCampaignSuggestionInfo(GoogleAdsClient client,
    string businessProfileLocation, string businessName)
{
    // Note: This is broken since businessLocationId is not yet renamed in
    // SmartCampaignSuggestionInfo. The use of dynamic temporarily fixes the broken build.
    // TODO(Anash): Revert the type change once this field is fixed.
    dynamic suggestionInfo = new SmartCampaignSuggestionInfo
    {
        // Add the URL of the campaign's landing page.
        FinalUrl = LANDING_PAGE_URL,
        LanguageCode = LANGUAGE_CODE,
        // Construct location information using the given geo target constant. It's
        // also possible to provide a geographic proximity using the "proximity"
        // field on suggestion_info, for example:
        // Proximity = new ProximityInfo
        // {
        //     Address = new AddressInfo
        //     {
        //         PostalCode = "INSERT_POSTAL_CODE",
        //         ProvinceCode = "INSERT_PROVINCE_CODE",
        //         CountryCode = "INSERT_COUNTRY_CODE",
        //         ProvinceName = "INSERT_PROVINCE_NAME",
        //         StreetAddress = "INSERT_STREET_ADDRESS",
        //         StreetAddress2 = "INSERT_STREET_ADDRESS_2",
        //         CityName = "INSERT_CITY_NAME"
        //     },
        //     Radius = Double.Parse("INSERT_RADIUS"),
        //     RadiusUnits = ProximityRadiusUnits.Kilometers
        // }
        // For more information on proximities see:
        // https://developers.google.com/google-ads/api/reference/rpc/latest/ProximityInfo
        LocationList = new LocationList()
        {
            Locations =
            {
                new LocationInfo
                {
                    // Set the location to the resource name of the given geo target
                    // constant.
                    GeoTargetConstant =
                        ResourceNames.GeoTargetConstant(GEO_TARGET_CONSTANT)
                }
            }
        }
    };

    // Add the Business Profile location if provided.
    if (!string.IsNullOrEmpty(businessProfileLocation))
    {
        suggestionInfo.BusinessProfileLocation = businessProfileLocation;
    }
    else
    {
        suggestionInfo.BusinessContext = new BusinessContext
        {
            BusinessName = businessName,
        };
    }

    // Add a schedule detailing which days of the week the business is open. This schedule
    // describes a business that is open on Mondays from 9:00 AM to 5:00 PM.
    AdScheduleInfo adScheduleInfo = new AdScheduleInfo
    {
        // Set the day of this schedule as Monday.
        DayOfWeek = DayOfWeekEnum.Types.DayOfWeek.Monday,
        // Set the start hour to 9 AM.
        StartHour = 9,
        // Set the end hour to 5 PM.
        EndHour = 17,
        // Set the start and end minutes to zero.
        StartMinute = MinuteOfHourEnum.Types.MinuteOfHour.Zero,
        EndMinute = MinuteOfHourEnum.Types.MinuteOfHour.Zero
    };

    suggestionInfo.AdSchedules.Add(adScheduleInfo);

    return suggestionInfo;
}
      

পিএইচপি

private static function getSmartCampaignSuggestionInfo(
    ?string $businessProfileLocationResourceName,
    ?string $businessName
): SmartCampaignSuggestionInfo {
    $suggestionInfo = new SmartCampaignSuggestionInfo([
        // Adds the URL of the campaign's landing page.
        'final_url' => self::LANDING_PAGE_URL,

        // Adds the language code for the campaign.
        'language_code' => self::LANGUAGE_CODE,

        // Constructs location information using the given geo target constant. It's also
        // possible to provide a geographic proximity using the "proximity" field,
        // for example:
        //
        // 'proximity' => new ProximityInfo([
        //     'address' => mew AddressInfo([
        //         'post_code' => INSERT_POSTAL_CODE,
        //         'province_code' => INSERT_PROVINCE_CODE,
        //         'country_code' => INSERT_COUNTRY_CODE,
        //         'province_name' => INSERT_PROVINCE_NAME,
        //         'street_address' => INSERT_STREET_ADDRESS,
        //         'street_address2' => INSERT_STREET_ADDRESS_2,
        //         'city_name' => INSERT_CITY_NAME
        //     ]),
        //     'radius' => INSERT_RADIUS,
        //     'radius_units' => INSERT_RADIUS_UNITS
        // ])
        //
        // For more information on proximities see:
        // https://developers.google.com/google-ads/api/reference/rpc/latest/ProximityInfo

        // Adds LocationInfo objects to the list of locations. You have the option of
        // providing multiple locations when using location-based suggestions.
        'location_list' => new LocationList([
            // Sets one location to the resource name of the given geo target constant.
            'locations' => [new LocationInfo([
                'geo_target_constant' => ResourceNames::forGeoTargetConstant(
                    self::GEO_TARGET_CONSTANT
                )
            ])]
        ]),

        // Adds a schedule detailing which days of the week the business is open.
        // This schedule describes a schedule in which the business is open on
        // Mondays from 9am to 5pm.
        'ad_schedules' => [new AdScheduleInfo([
            // Sets the day of this schedule as Monday.
            'day_of_week' => DayOfWeek::MONDAY,
            // Sets the start hour to 9am.
            'start_hour' => 9,
            // Sets the end hour to 5pm.
            'end_hour' => 17,
            // Sets the start and end minute of zero, for example: 9:00 and 5:00.
            'start_minute' => MinuteOfHour::ZERO,
            'end_minute' => MinuteOfHour::ZERO
        ])]
    ]);

    // Sets either of the business_profile_location or business_name, depending on whichever is
    // provided.
    if ($businessProfileLocationResourceName) {
        $suggestionInfo->setBusinessProfileLocation($businessProfileLocationResourceName);
    } else {
        $suggestionInfo->setBusinessContext(new BusinessContext([
            'business_name' => $businessName
        ]));
    }
    return $suggestionInfo;
}
      

পাইথন

def get_smart_campaign_suggestion_info(
    client, business_profile_location, business_name
):
    """Builds a SmartCampaignSuggestionInfo object with business details.

    The details are used by the SmartCampaignSuggestService to suggest a
    budget amount as well as creatives for the ad.

    Note that when retrieving ad creative suggestions it's required that the
    "final_url", "language_code" and "keyword_themes" fields are set on the
    SmartCampaignSuggestionInfo instance.

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

    Returns:
        A SmartCampaignSuggestionInfo instance.
    """
    suggestion_info = client.get_type("SmartCampaignSuggestionInfo")

    # Add the URL of the campaign's landing page.
    suggestion_info.final_url = _LANDING_PAGE_URL

    # Add the language code for the campaign.
    suggestion_info.language_code = _LANGUAGE_CODE

    # Construct location information using the given geo target constant. It's
    # also possible to provide a geographic proximity using the "proximity"
    # field on suggestion_info, for example:
    #
    # suggestion_info.proximity.address.post_code = INSERT_POSTAL_CODE
    # suggestion_info.proximity.address.province_code = INSERT_PROVINCE_CODE
    # suggestion_info.proximity.address.country_code = INSERT_COUNTRY_CODE
    # suggestion_info.proximity.address.province_name = INSERT_PROVINCE_NAME
    # suggestion_info.proximity.address.street_address = INSERT_STREET_ADDRESS
    # suggestion_info.proximity.address.street_address2 = INSERT_STREET_ADDRESS_2
    # suggestion_info.proximity.address.city_name = INSERT_CITY_NAME
    # suggestion_info.proximity.radius = INSERT_RADIUS
    # suggestion_info.proximity.radius_units = RADIUS_UNITS
    #
    # For more information on proximities see:
    # https://developers.google.com/google-ads/api/reference/rpc/latest/ProximityInfo
    location = client.get_type("LocationInfo")
    # Set the location to the resource name of the given geo target constant.
    location.geo_target_constant = client.get_service(
        "GeoTargetConstantService"
    ).geo_target_constant_path(_GEO_TARGET_CONSTANT)
    # Add the LocationInfo object to the list of locations on the
    # suggestion_info object. You have the option of providing multiple
    # locations when using location-based suggestions.
    suggestion_info.location_list.locations.append(location)

    # Set either of the business_profile_location or business_name, depending on
    # whichever is provided.
    if business_profile_location:
        suggestion_info.business_profile_location = business_profile_location
    else:
        suggestion_info.business_context.business_name = business_name

    # Add a schedule detailing which days of the week the business is open.
    # This schedule describes a schedule in which the business is open on
    # Mondays from 9am to 5pm.
    ad_schedule_info = client.get_type("AdScheduleInfo")
    # Set the day of this schedule as Monday.
    ad_schedule_info.day_of_week = client.enums.DayOfWeekEnum.MONDAY
    # Set the start hour to 9am.
    ad_schedule_info.start_hour = 9
    # Set the end hour to 5pm.
    ad_schedule_info.end_hour = 17
    # Set the start and end minute of zero, for example: 9:00 and 5:00.
    zero_minute_of_hour = client.enums.MinuteOfHourEnum.ZERO
    ad_schedule_info.start_minute = zero_minute_of_hour
    ad_schedule_info.end_minute = zero_minute_of_hour
    suggestion_info.ad_schedules.append(ad_schedule_info)

    return suggestion_info
      

রুবি

# Builds a SmartCampaignSuggestionInfo object with business details.
#
# The details are used by the SmartCampaignSuggestService to suggest a
# budget amount as well as creatives for the ad.
#
# Note that when retrieving ad creative suggestions it's required that the
# "final_url", "language_code" and "keyword_themes" fields are set on the
# SmartCampaignSuggestionInfo instance.
def get_smart_campaign_suggestion_info(
  client,
  business_profile_location,
  business_name)

  # Since these suggestions are for a new campaign, we're going to
  # use the suggestion_info field instead.
  suggestion_info = client.resource.smart_campaign_suggestion_info do |si|
    # Adds the URL of the campaign's landing page.
    si.final_url = LANDING_PAGE_URL
    # Add the language code for the campaign.
    si.language_code = LANGUAGE_CODE
    # Constructs location information using the given geo target constant. It's
    # also possible to provide a geographic proximity using the "proximity"
    # field on suggestion_info, for example:
    # si.proximity = client.resource.proximity_info do |proximity|
    #   proximity.address = client.resource.address_info do |address|
    #     address.post_code = INSERT_POSTAL_CODE
    #     address.province_code = INSERT_PROVINCE_CODE
    #     address.country_code = INSERT_COUNTRY_CODE
    #     address.province_name = INSERT_PROVINCE_NAME
    #     address.street_address = INSERT_STREET_ADDRESS
    #     address.street_address2 = INSERT_STREET_ADDRESS_2
    #     address.city_name = INSERT_CITY_NAME
    #   end
    #   proximity.radius = INSERT_RADIUS
    #   proximity.radius_units = :INSERT_RADIUS_UNIT_ENUM
    # end
    #
    # For more information on proximities see:
    # https://developers.google.com/google-ads/api/reference/rpc/latest/ProximityInfo
    si.location_list = client.resource.location_list do |loc_list|
      # Adds the location_info object to the list of locations on the
      # suggestion_info object. You have the option of providing multiple
      # locations when using location-based suggestions.
      loc_list.locations << client.resource.location_info do |li|
        li.geo_target_constant = client.path.geo_target_constant(GEO_TARGET_CONSTANT)
      end
    end
    # Set either of the business_profile_location or business_name, depending on
    # whichever is provided.
    if business_profile_location
      si.business_profile_location = business_profile_location
    else
      si.business_context = client.resource.business_context do |bc|
        bc.business_name = business_name
      end
    end
    # Adds a schedule detailing which days of the week the business is open.
    # This schedule describes a schedule in which the business is open on
    # Mondays from 9am to 5pm.
    si.ad_schedules += [
      client.resource.ad_schedule_info do |as|
        # Sets the day of this schedule as Monday.
        as.day_of_week = :MONDAY
        # Sets the start hour to 9:00am.
        as.start_hour = 9
        as.start_minute = :ZERO
        # Sets the end hour to 5:00pm.
        as.end_hour = 17
        as.end_minute = :ZERO
      end
    ]
  end

  suggestion_info
end
      

পার্ল

# Builds a SmartCampaignSuggestionInfo object with business details.
# The details are used by the SmartCampaignSuggestService to suggest a budget
# amount as well as creatives for the ad.
# Note that when retrieving ad creative suggestions you must set the
# "final_url", "language_code" and "keyword_themes" fields on the
# SmartCampaignSuggestionInfo instance.
sub _get_smart_campaign_suggestion_info {
  my ($business_profile_location, $business_name) = @_;

  my $suggestion_info =
    Google::Ads::GoogleAds::V18::Services::SmartCampaignSuggestService::SmartCampaignSuggestionInfo
    ->new({
      # Add the URL of the campaign's landing page.
      finalUrl => LANDING_PAGE_URL,
      # Add the language code for the campaign.
      languageCode => LANGUAGE_CODE,
      # Construct location information using the given geo target constant.
      # It's also possible to provide a geographic proximity using the
      # "proximity" field on suggestion_info, for example:
      #
      # proximity => Google::Ads::GoogleAds::V18::Common::ProximityInfo->new({
      #     address => Google::Ads::GoogleAds::V18::Common::AddressInfo->new({
      #         postalCode     => "INSERT_POSTAL_CODE",
      #         provinceCode   => "INSERT_PROVINCE_CODE",
      #         countryCode    => "INSERT_COUNTRY_CODE",
      #         provinceName   => "INSERT_PROVINCE_NAME",
      #         streetAddress  => "INSERT_STREET_ADDRESS",
      #         streetAddress2 => "INSERT_STREET_ADDRESS_2",
      #         cityName       => "INSERT_CITY_NAME"
      #       }
      #     ),
      #     radius      => "INSERT_RADIUS",
      #     radiusUnits => MILES
      #   }
      # ),
      #
      # For more information on proximities see:
      # https://developers.google.com/google-ads/api/reference/rpc/latest/ProximityInfo
      locationList =>
        Google::Ads::GoogleAds::V18::Services::SmartCampaignSuggestService::LocationList
        ->new(
        )});

  # Add the LocationInfo object to the list of locations on the SuggestionInfo
  # object. You have the option of providing multiple locations when using
  # location-based suggestions.
  push @{$suggestion_info->{locationList}{locations}},
    Google::Ads::GoogleAds::V18::Common::LocationInfo->new({
      # Set the location to the resource name of the given geo target constant.
      geoTargetConstant =>
        Google::Ads::GoogleAds::V18::Utils::ResourceNames::geo_target_constant(
        GEO_TARGET_CONSTANT)});

  # Set one of the business_profile_location or business_name, whichever is provided.
  if (defined $business_profile_location) {
    $suggestion_info->{businessProfileLocation} =
      _convert_business_profile_location($business_profile_location);
  } else {
    $suggestion_info->{businessContext} =
      Google::Ads::GoogleAds::V18::Services::SmartCampaignSuggestService::BusinessContext
      ->new({
        businessName => $business_name
      });
  }

  # Add a schedule detailing which days of the week the business is open. This
  # example schedule describes a business that is open on Mondays from 9:00 AM
  # to 5:00 PM.
  push @{$suggestion_info->{adSchedules}},
    Google::Ads::GoogleAds::V18::Common::AdScheduleInfo->new({
      # Set the day of this schedule as Monday.
      dayOfWeek => MONDAY,
      # Set the start hour to 9 AM.
      startHour => 9,
      # Set the end hour to 5 PM.
      endHour => 17,
      # Set the start and end minutes to zero.
      startMinute => ZERO,
      endMinute   => ZERO
    });

  return $suggestion_info;
}
      

কীওয়ার্ড থিমগুলির একটি তালিকা তৈরি করুন

একটি কীওয়ার্ড থিম হল একটি একক শব্দ বা বাক্যাংশ যা সম্পর্কিত অনুসন্ধান পদগুলির একটি গ্রুপকে প্রতিনিধিত্ব করে। যেমন "বেকারি" "আমার কাছাকাছি বেকারি" এবং "স্থানীয় বেকারি" এর সাথে সম্পর্কিত। এগুলিকে KeywordTheme সংস্থান দ্বারা Google বিজ্ঞাপন API-এ উপস্থাপন করা হয়, যা সাধারণত একটি KeywordThemeInfo উদাহরণের সাথে সংযুক্ত থাকে এবং হয় একটি KeywordThemeConstant বা একটি ফ্রি-ফর্ম কীওয়ার্ড থিম হতে পারে।

প্রস্তাবিত কীওয়ার্ড থিম

একটি SmartCampaignSuggestionInfo উদাহরণ দেওয়া, SuggestKeywordThemes পরিষেবা পদ্ধতি আপনার ব্যবসার বিশদ বিবরণ, এর অবস্থান এবং ওয়েবসাইটের বিষয়বস্তু ব্যবহার করে কীওয়ার্ড থিমগুলির পরামর্শ দেয়৷

আপনার স্মার্ট ক্যাম্পেইনের পারফরম্যান্স সম্পূর্ণরূপে অপ্টিমাইজ করতে, কীওয়ার্ড থিম তৈরি করার সময় SuggestKeywordThemes পদ্ধতি ব্যবহার করুন। যেহেতু এটি ব্যবসা এবং এর ওয়েবসাইট সম্পর্কে নির্দিষ্ট বিবরণ একত্রিত করে, তাই এটি অন্য দুটি কৌশলের তুলনায় উল্লেখযোগ্যভাবে ভাল কীওয়ার্ড থিম তৈরি করে, যেগুলিকে ব্যাক-আপ বিকল্প হিসাবে সবচেয়ে ভাল বিবেচনা করা হয়।

জাভা

private List<KeywordTheme> getKeywordThemeSuggestions(
    GoogleAdsClient googleAdsClient,
    long customerId,
    SmartCampaignSuggestionInfo suggestionInfo) {
  // Creates the service client.
  try (SmartCampaignSuggestServiceClient client =
      googleAdsClient.getLatestVersion().createSmartCampaignSuggestServiceClient()) {
    // Sends the request.
    SuggestKeywordThemesResponse response =
        client.suggestKeywordThemes(
            SuggestKeywordThemesRequest.newBuilder()
                .setSuggestionInfo(suggestionInfo)
                .setCustomerId(String.valueOf(customerId))
                .build());
    // Prints some information about the result.
    System.out.printf(
        "Retrieved %d keyword theme suggestions from the SuggestKeywordThemes method.%n",
        response.getKeywordThemesCount());
    return new ArrayList(response.getKeywordThemesList());
  }
}
      

সি#

/// <summary>
/// Retrieves KeywordThemeConstants suggestions with the SmartCampaignSuggestService.
/// </summary>
/// <param name="client">The Google Ads client.</param>
/// <param name="customerId">The Google Ads customer ID.</param>
/// <param name="suggestionInfo">The suggestion information.</param>
/// <returns>The suggestions.</returns>
private List<KeywordThemeConstant> GetKeywordThemeSuggestions(
    GoogleAdsClient client, long customerId, SmartCampaignSuggestionInfo suggestionInfo)
{
    SmartCampaignSuggestServiceClient smartCampaignSuggestService =
        client.GetService(Services.V18.SmartCampaignSuggestService);

    SuggestKeywordThemesRequest request = new SuggestKeywordThemesRequest()
    {
        SuggestionInfo = suggestionInfo,
        CustomerId = customerId.ToString()
    };

    SuggestKeywordThemesResponse response =
        smartCampaignSuggestService.SuggestKeywordThemes(request);

    // Prints some information about the result.
    Console.WriteLine($"Retrieved {response.KeywordThemes.Count} keyword theme " +
        $"constant suggestions from the SuggestKeywordThemes method.");
    return response.KeywordThemes.ToList().ConvertAll(x => x.KeywordThemeConstant);
}
      

পিএইচপি

private static function getKeywordThemeSuggestions(
    GoogleAdsClient $googleAdsClient,
    int $customerId,
    SmartCampaignSuggestionInfo $suggestionInfo
): array {
    $smartCampaignSuggestServiceClient =
        $googleAdsClient->getSmartCampaignSuggestServiceClient();

    // Issues a request to retrieve the keyword themes.
    $response = $smartCampaignSuggestServiceClient->suggestKeywordThemes(
        (new SuggestKeywordThemesRequest())
            ->setCustomerId($customerId)
            ->setSuggestionInfo($suggestionInfo)
    );

    printf(
        "Retrieved %d keyword theme suggestions from the SuggestKeywordThemes "
        . "method.%s",
        $response->getKeywordThemes()->count(),
        PHP_EOL
    );
    return iterator_to_array($response->getKeywordThemes()->getIterator());
}
      

পাইথন

def get_keyword_theme_suggestions(client, customer_id, suggestion_info):
    """Retrieves KeywordThemes using the given suggestion info.

    Here we use the SuggestKeywordThemes method, which uses all of the business
    details included in the given SmartCampaignSuggestionInfo instance to
    generate keyword theme suggestions. This is the recommended way to
    generate keyword themes because it uses detailed information about your
    business, its location, and website content to generate keyword themes.

    Args:
        client: an initialized GoogleAdsClient instance.
        customer_id: a client customer ID.
        suggestion_info: a SmartCampaignSuggestionInfo instance with details
          about the business being advertised.

    Returns:
        a list of KeywordThemes.
    """
    smart_campaign_suggest_service = client.get_service(
        "SmartCampaignSuggestService"
    )
    request = client.get_type("SuggestKeywordThemesRequest")
    request.customer_id = customer_id
    request.suggestion_info = suggestion_info

    response = smart_campaign_suggest_service.suggest_keyword_themes(
        request=request
    )

    print(
        f"Retrieved {len(response.keyword_themes)} keyword theme suggestions "
        "from the SuggestKeywordThemes method."
    )
    return response.keyword_themes
      

রুবি

def get_keyword_theme_suggestions(client, customer_id, suggestion_info)
  response = client.service.smart_campaign_suggest.suggest_keyword_themes(
    customer_id: customer_id,
    suggestion_info: suggestion_info,
  )

  puts "Retrieved #{response.keyword_themes.size} keyword theme" \
    " suggestions from SuggestKeywordThemes service."
  return response.keyword_themes
end
      

পার্ল

# Retrieves KeywordThemes using the given suggestion info.
# Here we use the SuggestKeywordThemes method, which uses all of the business
# details included in the given SmartCampaignSuggestionInfo instance to generate
# keyword theme suggestions. This is the recommended way to generate keyword themes
# because it uses detailed information about your business, its location, and
# website content to generate keyword themes.
sub _get_keyword_theme_suggestions {
  my ($api_client, $customer_id, $suggestion_info) = @_;

  my $response =
    $api_client->SmartCampaignSuggestService()->suggest_keyword_themes(
    Google::Ads::GoogleAds::V18::Services::SmartCampaignSuggestService::SuggestKeywordThemesRequest
      ->new({
        customerId     => $customer_id,
        suggestionInfo => $suggestion_info
      }));

  printf "Retrieved %d keyword theme suggestions from the SuggestKeywordThemes"
    . "method.\n",
    scalar @{$response->{keywordThemes}};

  return $response->{keywordThemes};
}
      

একটি শব্দ বা বাক্যাংশ দেওয়া হলে, KeywordThemeConstantService প্রস্তাবিত KeywordThemeConstants যা প্রদত্ত পাঠ্যের জন্য স্বয়ংক্রিয়-সম্পূর্ণ ডেটা থেকে প্রাপ্ত। এই কৌশলটি একটি কার্যকর বিকল্প যদি, উদাহরণস্বরূপ, যে ব্যবসার বিজ্ঞাপন দেওয়া হচ্ছে তাতে SuggestKeywordThemes পদ্ধতির সুবিধা নেওয়ার জন্য কোনো ওয়েবসাইট বা পর্যাপ্ত তথ্য না থাকে। এই পদ্ধতিটি শুধুমাত্র তখনই ব্যবহার করা উচিত যদি SuggestKeywordThemes পদ্ধতিটি ব্যবহার করা না যায় বা অপর্যাপ্ত পরামর্শ প্রদান করে।

জাভা

private List<KeywordTheme> getKeywordTextAutoCompletions(
    GoogleAdsClient googleAdsClient, String keywordText) {
  try (KeywordThemeConstantServiceClient client =
      googleAdsClient.getLatestVersion().createKeywordThemeConstantServiceClient()) {
    SuggestKeywordThemeConstantsRequest request =
        SuggestKeywordThemeConstantsRequest.newBuilder()
            .setQueryText(keywordText)
            .setCountryCode(COUNTRY_CODE)
            .setLanguageCode(LANGUAGE_CODE)
            .build();
    SuggestKeywordThemeConstantsResponse response = client.suggestKeywordThemeConstants(request);
    // Converts the keyword theme constants to KeywordTheme instances for consistency with the
    // response from SmartCampaignSuggestService.SuggestKeywordThemes.
    return response.getKeywordThemeConstantsList().stream()
        .map(
            keywordThemeConstant ->
                KeywordTheme.newBuilder().setKeywordThemeConstant(keywordThemeConstant).build())
        .collect(Collectors.toList());
  }
}
      

সি#

/// <summary>
/// Retrieves KeywordThemeConstants that are derived from autocomplete data for the
/// given keyword text.
/// </summary>
/// <param name="client">The Google Ads client.</param>
/// <param name="keywordText">A keyword used for generating keyword auto completions.
/// </param>
/// <returns>A list of KeywordThemeConstants.</returns>
private IEnumerable<KeywordThemeConstant> GetKeywordTextAutoCompletions(
    GoogleAdsClient client, string keywordText)
{
    KeywordThemeConstantServiceClient keywordThemeConstantServiceClient =
        client.GetService(Services.V18.KeywordThemeConstantService);

    SuggestKeywordThemeConstantsRequest request = new SuggestKeywordThemeConstantsRequest
    {
        QueryText = keywordText,
        CountryCode = COUNTRY_CODE,
        LanguageCode = LANGUAGE_CODE
    };

    SuggestKeywordThemeConstantsResponse response =
        keywordThemeConstantServiceClient.SuggestKeywordThemeConstants(request);

    Console.WriteLine($"Retrieved {response.KeywordThemeConstants.Count} keyword theme " +
        $"constants using the keyword '{keywordText}'.");
    return response.KeywordThemeConstants.ToList();
}
      

পিএইচপি

private static function getKeywordTextAutoCompletions(
    GoogleAdsClient $googleAdsClient,
    string $keywordText
): array {
    $keywordThemeConstantService = $googleAdsClient->getKeywordThemeConstantServiceClient();

    // Issues a request to retrieve the keyword theme constants.
    $response = $keywordThemeConstantService->suggestKeywordThemeConstants(
        (new SuggestKeywordThemeConstantsRequest())
            ->setQueryText($keywordText)
            ->setCountryCode(self::COUNTRY_CODE)
            ->setLanguageCode(self::LANGUAGE_CODE)
    );

    printf(
        "Retrieved %d keyword theme constants using the keyword: '%s'.%s",
        $response->getKeywordThemeConstants()->count(),
        $keywordText,
        PHP_EOL
    );

    // Maps the keyword theme constants to KeywordTheme instances for consistency with the
    // response from SmartCampaignSuggestService.SuggestKeywordThemes.
    return array_map(function (KeywordThemeConstant $keywordThemeConstant) {
        return new KeywordTheme([
            'keyword_theme_constant' => $keywordThemeConstant
        ]);
    }, iterator_to_array($response->getKeywordThemeConstants()->getIterator()));
}
      

পাইথন

def get_keyword_text_auto_completions(client, keyword_text):
    """Retrieves KeywordThemeConstants for the given keyword text.

    These KeywordThemeConstants are derived from autocomplete data for the
    given keyword text. They are mapped to KeywordThemes before being returned.

    Args:
        client: an initialized GoogleAdsClient instance.
        keyword_text: a keyword used for generating keyword themes.

    Returns:
        a list of KeywordThemes.
    """
    keyword_theme_constant_service = client.get_service(
        "KeywordThemeConstantService"
    )
    request = client.get_type("SuggestKeywordThemeConstantsRequest")
    request.query_text = keyword_text
    request.country_code = _COUNTRY_CODE
    request.language_code = _LANGUAGE_CODE

    response = keyword_theme_constant_service.suggest_keyword_theme_constants(
        request=request
    )

    print(
        f"Retrieved {len(response.keyword_theme_constants)} keyword theme "
        f"constants using the keyword: '{keyword_text}'"
    )

    # Map the keyword theme constants to KeywordTheme instances for consistency
    # with the response from SmartCampaignSuggestService.SuggestKeywordThemes.
    keyword_themes = []
    KeywordTheme = client.get_type("SuggestKeywordThemesResponse").KeywordTheme
    for keyword_theme_constant in response.keyword_theme_constants:
        keyword_theme = KeywordTheme()
        keyword_theme.keyword_theme_constant = keyword_theme_constant
        keyword_themes.append(keyword_theme)

    return keyword_themes
      

রুবি

# Retrieves keyword_theme_constants for the given criteria.
# These KeywordThemeConstants are derived from autocomplete data for the given
# keyword text. They are mapped to KeywordThemes before being returned.
def get_keyword_text_auto_completions(client, keyword_text)
  response = client.service.keyword_theme_constant.suggest_keyword_theme_constants(
    query_text: keyword_text,
    country_code: COUNTRY_CODE,
    language_code: LANGUAGE_CODE,
  )

  puts "Retrieved #{response.keyword_theme_constants.size} keyword theme" \
    "constants using the keyword: '#{keyword_text}'"

  response.keyword_theme_constants.map do |ktc|
    client.resource.keyword_theme do |kt|
      kt.keyword_theme_constant = ktc
    end
  end
end
      

পার্ল

# Retrieves KeywordThemeConstants for the given keyword text.
# These KeywordThemeConstants are derived from autocomplete data for the given
# keyword text. They are mapped to KeywordThemes before being returned.
sub _get_keyword_text_auto_completions {
  my ($api_client, $keyword_text) = @_;

  my $response = $api_client->KeywordThemeConstantService()->suggest(
    Google::Ads::GoogleAds::V18::Services::KeywordThemeConstantService::SuggestKeywordThemeConstantsRequest
      ->new({
        queryText    => $keyword_text,
        countryCode  => COUNTRY_CODE,
        languageCode => LANGUAGE_CODE
      }));

  printf "Retrieved %d keyword theme constants using the keyword '%s'.\n",
    scalar @{$response->{keywordThemeConstants}}, $keyword_text;

  # Map the keyword theme constants to KeywordTheme instances for consistency
  # with the response from SmartCampaignSuggestService.SuggestKeywordThemes.
  my $keyword_themes = [];
  foreach my $keyword_theme_constant (@{$response->{keywordThemeConstants}}) {
    push @$keyword_themes,
      Google::Ads::GoogleAds::V18::Services::SmartCampaignSuggestService::KeywordTheme
      ->new({
        keywordThemeConstant => $keyword_theme_constant
      });
  }

  return $keyword_themes;
}
      

ফ্রি-ফর্ম কীওয়ার্ড থিম

অবশেষে, একটি KeywordThemeInfo উদাহরণে free_form_keyword_theme ফিল্ড সেট করে ম্যানুয়ালি ফ্রি-ফর্ম কীওয়ার্ড থিম তৈরি করা যেতে পারে।

ফ্রি-ফর্ম কীওয়ার্ড থিমগুলি ব্যবহার করা সাধারণত সুপারিশ করা হয় না কারণ সেগুলি প্রস্তাবিত কীওয়ার্ড থিমগুলির চেয়ে কম কার্যকর। যাইহোক, এগুলি এমন পরিস্থিতিতে দরকারী যেখানে একটি খুব নির্দিষ্ট শব্দকে টার্গেট করা প্রয়োজন, বা যখন আপনি একটি শব্দকে নেতিবাচকভাবে লক্ষ্য করতে চান।

SuggestKeywordThemes পদ্ধতিটি ফ্রি-ফর্ম কীওয়ার্ড থিমের পরামর্শ দিতে পারে, কিন্তু শুধুমাত্র যদি আপনি অনুরোধে একটি final_url প্রদান করেন।

জাভা

if (freeFormKeywordText != null) {
  keywordThemeInfos.add(
      KeywordThemeInfo.newBuilder().setFreeFormKeywordTheme(freeFormKeywordText).build());
}
      

সি#

suggestionInfo.KeywordThemes.Add(keywordThemeInfos);
      

পিএইচপি

// Optionally includes any free-form keywords in verbatim.
if (!empty($freeFormKeywordText)) {
    $keywordThemeInfos[] =
        new KeywordThemeInfo(['free_form_keyword_theme' => $freeFormKeywordText]);
}
      

পাইথন

def get_free_form_keyword_theme_info(client, free_form_keyword_text):
    """Creates a KeywordThemeInfo using the given free-form keyword text.

    Args:
        client: an initialized GoogleAdsClient instance.
        free_form_keyword_text: a keyword used to create a free-form keyword
          theme.

    Returns:
        a KeywordThemeInfo instance.
    """
    info = client.get_type("KeywordThemeInfo")
    info.free_form_keyword_theme = free_form_keyword_text
    return info
      

রুবি

def get_freeform_keyword_theme_info(client, free_form_keyword_text)
  client.resource.keyword_theme_info do |kti|
    kti.free_form_keyword_theme = free_form_keyword_text
  end
end
      

পার্ল

# Creates a KeywordInfo instance using the given free-form keyword text.
sub _get_free_form_keyword_theme_info {
  my ($free_form_keyword_text) = @_;

  return Google::Ads::GoogleAds::V18::Common::KeywordThemeInfo->new({
    freeFormKeywordTheme => $free_form_keyword_text
  });
}
      

এই দুটি কৌশল এমনভাবে প্রয়োগ করা উচিত যাতে প্রতিটি বিভিন্ন ধরনের কীওয়ার্ড থিম একটি KeywordThemeInfo উদাহরণের সাথে সংযুক্ত হয়:

জাভা

// Gets the SmartCampaignSuggestionInfo object which acts as the basis for many of the
// entities necessary to create a Smart campaign. It will be reused a number of times to
// retrieve suggestions for keyword themes, budget amount, ad creatives, and campaign criteria.
SmartCampaignSuggestionInfo suggestionInfo =
    getSmartCampaignSuggestionInfo(googleAdsClient, businessProfileLocation, businessName);

// Generates a list of keyword themes using the SuggestKeywordThemes method on the
// SmartCampaignSuggestService. It is strongly recommended that you use this strategy for
// generating keyword themes.
List<KeywordTheme> keywordThemes =
    getKeywordThemeSuggestions(googleAdsClient, customerId, suggestionInfo);

// If a keyword text is given, retrieves keyword theme constant suggestions from the
// KeywordThemeConstantService, maps them to KeywordThemes, and appends them to the existing
// list.
// This logic should ideally only be used if the suggestions from the
// getKeywordThemeSuggestions function are insufficient.
if (keywordText != null) {
  keywordThemes.addAll(getKeywordTextAutoCompletions(googleAdsClient, keywordText));
}

// Converts the list of KeywordThemes to a list of KeywordThemes objects.
List<KeywordThemeInfo> keywordThemeInfos = getKeywordThemeInfos(keywordThemes);

// Optionally includes any freeForm keywords in verbatim.
if (freeFormKeywordText != null) {
  keywordThemeInfos.add(
      KeywordThemeInfo.newBuilder().setFreeFormKeywordTheme(freeFormKeywordText).build());
}

// Includes the keyword suggestions in the overall SuggestionInfo object.
suggestionInfo = suggestionInfo.toBuilder().addAllKeywordThemes(keywordThemeInfos).build();
      

সি#

// Gets the SmartCampaignSuggestionInfo object which acts as the basis for many
// of the entities necessary to create a Smart campaign. It will be reused a number
// of times to retrieve suggestions for keyword themes, budget amount, ad
//creatives, and campaign criteria.
SmartCampaignSuggestionInfo suggestionInfo =
    GetSmartCampaignSuggestionInfo(client, businessProfileLocation, businessName);

// Generates a list of keyword themes using the SuggestKeywordThemes method on the
// SmartCampaignSuggestService. It is strongly recommended that you use this
// strategy for generating keyword themes.
List<KeywordThemeConstant> keywordThemeConstants =
    GetKeywordThemeSuggestions(client, customerId, suggestionInfo);

// Optionally retrieves auto-complete suggestions for the given keyword text and
// adds them to the list of keyWordThemeConstants.
if (keywordText != null)
{
    keywordThemeConstants.AddRange(GetKeywordTextAutoCompletions(
        client, keywordText));
}

// Converts the KeywordThemeConstants to KeywordThemeInfos.
List<KeywordThemeInfo> keywordThemeInfos = keywordThemeConstants.Select(
    constant =>
        new KeywordThemeInfo { KeywordThemeConstant = constant.ResourceName })
    .ToList();

// Optionally includes any freeform keywords verbatim.
if (freeFormKeywordText != null)
{
    keywordThemeInfos.Add(new KeywordThemeInfo()
    {
        FreeFormKeywordTheme = freeFormKeywordText
    });
}

// Includes the keyword suggestions in the overall SuggestionInfo object.
suggestionInfo.KeywordThemes.Add(keywordThemeInfos);
      

পিএইচপি

// Gets the SmartCampaignSuggestionInfo object which acts as the basis for many of the
// entities necessary to create a Smart campaign. It will be reused a number of times to
// retrieve suggestions for keyword themes, budget amount, ads, and campaign criteria.
$suggestionInfo = self::getSmartCampaignSuggestionInfo(
    $businessProfileLocationResourceName,
    $businessName
);

// Generates a list of keyword themes using the SuggestKeywordThemes method on the
// SmartCampaignSuggestService. It is strongly recommended that you use this strategy for
// generating keyword themes.
$keywordThemes =
    self::getKeywordThemeSuggestions($googleAdsClient, $customerId, $suggestionInfo);

// Optionally retrieves auto-complete suggestions for the given keyword text and adds them
// to the list of keyword themes.
if (!empty($keywordText)) {
    $keywordThemes = array_merge(
        $keywordThemes,
        self::getKeywordTextAutoCompletions($googleAdsClient, $keywordText)
    );
}

// Maps the list of KeywordThemes to KeywordThemeInfos.
$keywordThemeInfos = array_map(function (KeywordTheme $keywordTheme) {
    if ($keywordTheme->getKeywordThemeConstant()) {
        return new KeywordThemeInfo([
            'keyword_theme_constant' => $keywordTheme->getKeywordThemeConstant()
                ->getResourceName()
        ]);
    } elseif ($keywordTheme->getFreeFormKeywordTheme()) {
        return new KeywordThemeInfo([
            'free_form_keyword_theme' => $keywordTheme->getFreeFormKeywordTheme()
        ]);
    } else {
        throw new \UnexpectedValueException(
            'A malformed KeywordTheme was encountered: ' . $keywordTheme->getKeywordTheme()
        );
    }
}, $keywordThemes);

// Optionally includes any free-form keywords in verbatim.
if (!empty($freeFormKeywordText)) {
    $keywordThemeInfos[] =
        new KeywordThemeInfo(['free_form_keyword_theme' => $freeFormKeywordText]);
}
// Includes the keyword suggestions in the overall SuggestionInfo object.
$suggestionInfo = $suggestionInfo->setKeywordThemes($keywordThemeInfos);
      

পাইথন

# The SmartCampaignSuggestionInfo object acts as the basis for many of the
# entities necessary to create a Smart campaign. It will be reused a number
# of times to retrieve suggestions for keyword themes, budget amount,
# ad creatives, and campaign criteria.
suggestion_info = get_smart_campaign_suggestion_info(
    client, business_profile_location, business_name
)

# After creating a SmartCampaignSuggestionInfo object we first use it to
# generate a list of keyword themes using the SuggestKeywordThemes method
# on the SmartCampaignSuggestService. It is strongly recommended that you
# use this strategy for generating keyword themes.
keyword_themes = get_keyword_theme_suggestions(
    client, customer_id, suggestion_info
)

# If a keyword text is given, retrieve keyword theme constant suggestions
# from the KeywordThemeConstantService, map them to KeywordThemes, and
# append them to the existing list. This logic should ideally only be used
# if the suggestions from the get_keyword_theme_suggestions function are
# insufficient.
if keyword_text:
    keyword_themes.extend(
        get_keyword_text_auto_completions(client, keyword_text)
    )

# Map the KeywordThemes retrieved by the previous two steps to
# KeywordThemeInfo instances.
keyword_theme_infos = map_keyword_themes_to_keyword_infos(
    client, keyword_themes
)

# If a free-form keyword text is given we create a KeywordThemeInfo instance
# from it and add it to the existing list.
if free_form_keyword_text:
    keyword_theme_infos.append(
        get_free_form_keyword_theme_info(client, free_form_keyword_text)
    )

# Now add the generated keyword themes to the suggestion info instance.
suggestion_info.keyword_themes = keyword_theme_infos
      

রুবি

# The SmartCampaignSuggestionInfo object acts as the basis for many of the
# entities necessary to create a Smart campaign. It will be reused a number
# of times to retrieve suggestions for keyword themes, budget amount,
# ad creatives, and campaign criteria.
suggestion_info = get_smart_campaign_suggestion_info(
  client,
  business_profile_location,
  business_name,
)

# After creating a SmartCampaignSuggestionInfo object we first use it to
# generate a list of keyword themes using the SuggestKeywordThemes method
# on the SmartCampaignSuggestService. It is strongly recommended that you
# use this strategy for generating keyword themes.
keyword_themes = get_keyword_theme_suggestions(
  client,
  customer_id,
  suggestion_info,
)

# If a keyword text is given, retrieve keyword theme constant suggestions
# from the KeywordThemeConstantService, map them to KeywordThemes, and append
# them to the existing list. This logic should ideally only be used if the
# suggestions from the get_keyword_theme_suggestions function are
# insufficient.
if keyword_text
  keyword_themes += get_keyword_text_auto_completions(
    client,
    keyword_text,
  )
end

# Map the KeywordThemeConstants retrieved by the previous two steps to
# KeywordThemeInfo instances.
keyword_theme_infos = map_keyword_themes_to_keyword_infos(
  client,
  keyword_themes,
)

# If a free-form keyword text is given we create a KeywordThemeInfo instance
# from it and add it to the existing list.
if free_form_keyword_text
  keyword_theme_infos << get_freeform_keyword_theme_info(
    client,
    free_form_keyword_text,
  )
end

# Now add the generated keyword themes to the suggestion info instance.
suggestion_info.keyword_themes += keyword_theme_infos
      

পার্ল

# The SmartCampaignSuggestionInfo object acts as the basis for many of the
# entities necessary to create a Smart campaign. It will be reused a number
# of times to retrieve suggestions for keyword themes, budget amount,
# ad creatives, and campaign criteria.
my $suggestion_info =
  _get_smart_campaign_suggestion_info($business_profile_location,
  $business_name);

# After creating a SmartCampaignSuggestionInfo object we first use it to
# generate a list of keyword themes using the SuggestKeywordThemes method
# on the SmartCampaignSuggestService. It is strongly recommended that you
# use this strategy for generating keyword themes.
my $keyword_themes =
  _get_keyword_theme_suggestions($api_client, $customer_id, $suggestion_info);

# If a keyword text is given, retrieve keyword theme constant suggestions
# from the KeywordThemeConstantService, map them to KeywordThemes, and
# append them to the existing list. This logic should ideally only be used
# if the suggestions from the get_keyword_theme_suggestions funtion are
# insufficient.
if (defined $keyword_text) {
  push @$keyword_themes,
    @{_get_keyword_text_auto_completions($api_client, $keyword_text)};
}

# Map the KeywordThemeConstants retrieved by the previous two steps to
# KeywordThemeInfo instances.
my $keyword_theme_infos = _map_keyword_themes_to_infos($keyword_themes);

# If a free-form keyword text is given we create a KeywordThemeInfo instance
# from it and add it to the existing list.
if (defined $free_form_keyword_text) {
  push @$keyword_theme_infos,
    _get_free_form_keyword_theme_info($free_form_keyword_text);
}

# Now add the generated keyword themes to the suggestion info instance.
$suggestion_info->{keywordThemes} = $keyword_theme_infos;
      

প্রস্তাবিত বাজেটের পরিমাণ পান

SmartCampaignSuggestService এর একটি SuggestSmartCampaignBudgetOptions পদ্ধতি রয়েছে যা কিওয়ার্ড থিম এবং ব্যবসার বিবরণের একটি সেট দেওয়া হলে দৈনিক বাজেটের বিকল্পগুলির তিনটি স্তরের পরামর্শ দেয়৷ স্তরগুলি low , high এবং recommended , এবং প্রতিটি বিকল্পে দৈনিক ক্লিকের আনুমানিক সর্বনিম্ন এবং সর্বাধিক সংখ্যাও অন্তর্ভুক্ত রয়েছে৷

জাভা

private long getBudgetSuggestions(
    GoogleAdsClient googleAdsClient,
    long customerId,
    SmartCampaignSuggestionInfo suggestionInfo) {
  SuggestSmartCampaignBudgetOptionsRequest.Builder request =
      SuggestSmartCampaignBudgetOptionsRequest.newBuilder()
          .setCustomerId(String.valueOf(customerId));

  // You can retrieve suggestions for an existing campaign by setting the
  // "campaign" field of the request equal to the resource name of a campaign
  // and leaving the rest of the request fields below unset:
  // request.setCampaign("INSERT_CAMPAIGN_RESOURCE_NAME_HERE");

  // Uses the suggestion_info field instead, since these suggestions are for a new campaign.
  request.setSuggestionInfo(suggestionInfo);

  // Issues a request to retrieve a budget suggestion.
  try (SmartCampaignSuggestServiceClient client =
      googleAdsClient.getLatestVersion().createSmartCampaignSuggestServiceClient()) {
    SuggestSmartCampaignBudgetOptionsResponse response =
        client.suggestSmartCampaignBudgetOptions(request.build());
    BudgetOption recommendation = response.getRecommended();
    System.out.printf(
        "A daily budget amount of %d micros was suggested, garnering an estimated minimum of %d"
            + " clicks and an estimated maximum of %d per day.%n",
        recommendation.getDailyAmountMicros(),
        recommendation.getMetrics().getMinDailyClicks(),
        recommendation.getMetrics().getMaxDailyClicks());
    return recommendation.getDailyAmountMicros();
  }
}
      

সি#

/// <summary>
/// Retrieves a suggested budget amount for a new budget.
/// Using the SmartCampaignSuggestService to determine a daily budget for new and existing
/// Smart campaigns is highly recommended because it helps the campaigns achieve optimal
/// performance.
/// </summary>
/// <param name="client">The Google Ads client.</param>
/// <param name="customerId">The Google Ads customer ID.</param>
/// <param name="suggestionInfo"></param>
/// <returns>A daily budget amount in micros.</returns>
private long GetBudgetSuggestion(GoogleAdsClient client, long customerId,
    SmartCampaignSuggestionInfo suggestionInfo)
{
    SmartCampaignSuggestServiceClient smartCampaignSuggestServiceClient = client.GetService
        (Services.V18.SmartCampaignSuggestService);

    SuggestSmartCampaignBudgetOptionsRequest request =
        new SuggestSmartCampaignBudgetOptionsRequest
        {
            CustomerId = customerId.ToString(),
            // You can retrieve suggestions for an existing campaign by setting the
            // "Campaign" field of the request to the resource name of a campaign and
            // leaving the rest of the request fields below unset:
            // Campaign = "INSERT_CAMPAIGN_RESOURCE_NAME_HERE",

            // Since these suggestions are for a new campaign, we're going to use the
            // SuggestionInfo field instead.
            SuggestionInfo = suggestionInfo,
        };

    LocationInfo locationInfo = new LocationInfo
    {
        // Set the location to the resource name of the given geo target constant.
        GeoTargetConstant = ResourceNames.GeoTargetConstant(GEO_TARGET_CONSTANT)
    };

    // Issue a request to retrieve a budget suggestion.
    SuggestSmartCampaignBudgetOptionsResponse response =
        smartCampaignSuggestServiceClient.SuggestSmartCampaignBudgetOptions(request);

    // Three tiers of options will be returned: "low", "high", and "recommended".
    // Here we will use the "recommended" option. The amount is specified in micros, where
    // one million is equivalent to one currency unit.
    Console.WriteLine($"A daily budget amount of " +
        $"{response.Recommended.DailyAmountMicros}" +
        $" was suggested, garnering an estimated minimum of " +
        $"{response.Recommended.Metrics.MinDailyClicks} clicks and an estimated " +
        $"maximum of {response.Recommended.Metrics.MaxDailyClicks} clicks per day.");

    return response.Recommended.DailyAmountMicros;
}
      

পিএইচপি

private static function getBudgetSuggestion(
    GoogleAdsClient $googleAdsClient,
    int $customerId,
    SmartCampaignSuggestionInfo $suggestionInfo
): int {



    // Issues a request to retrieve a budget suggestion.
    $smartCampaignSuggestService = $googleAdsClient->getSmartCampaignSuggestServiceClient();
    $response = $smartCampaignSuggestService->suggestSmartCampaignBudgetOptions(
        (new SuggestSmartCampaignBudgetOptionsRequest())
            ->setCustomerId($customerId)
            // You can retrieve suggestions for an existing campaign by setting the "campaign"
            // field equal to the resource name of a campaign:
            // ->setCampaign('INSERT_CAMPAIGN_RESOURCE_NAME_HERE');
            // Since these suggestions are for a new campaign, we're going to use the
            // suggestion_info field instead.
            ->setSuggestionInfo($suggestionInfo)
    );

    // Three tiers of options will be returned, a "low", "high" and "recommended". Here we will
    // use the "recommended" option. The amount is specified in micros, where one million is
    // equivalent to one currency unit.
    $recommendation = $response->getRecommended();
    printf(
        "A daily budget amount of %d micros was suggested, garnering an estimated minimum of "
        . "%d clicks and an estimated maximum of %d per day.%s",
        $recommendation->getDailyAmountMicros(),
        $recommendation->getMetrics()->getMinDailyClicks(),
        $recommendation->getMetrics()->getMaxDailyClicks(),
        PHP_EOL
    );

    return $recommendation->getDailyAmountMicros();
}
      

পাইথন

def get_budget_suggestion(client, customer_id, suggestion_info):
    """Retrieves a suggested budget amount for a new budget.

    Using the SmartCampaignSuggestService to determine a daily budget for new
    and existing Smart campaigns is highly recommended because it helps the
    campaigns achieve optimal performance.

    Args:
        client: an initialized GoogleAdsClient instance.
        customer_id: a client customer ID.
        suggestion_info: a SmartCampaignSuggestionInfo instance with details
          about the business being advertised.

    Returns:
        a daily budget amount in micros.
    """
    sc_suggest_service = client.get_service("SmartCampaignSuggestService")
    request = client.get_type("SuggestSmartCampaignBudgetOptionsRequest")
    request.customer_id = customer_id
    # You can retrieve suggestions for an existing campaign by setting the
    # "campaign" field of the request equal to the resource name of a campaign
    # and leaving the rest of the request fields below unset:
    # request.campaign = INSERT_CAMPAIGN_RESOURCE_NAME_HERE

    # Since these suggestions are for a new campaign, we're going to
    # use the suggestion_info field instead.
    request.suggestion_info = suggestion_info

    # Issue a request to retrieve a budget suggestion.
    response = sc_suggest_service.suggest_smart_campaign_budget_options(
        request=request
    )

    # Three tiers of options will be returned, a "low", "high" and
    # "recommended". Here we will use the "recommended" option. The amount is
    # specified in micros, where one million is equivalent to one currency unit.
    recommendation = response.recommended
    print(
        f"A daily budget amount of {recommendation.daily_amount_micros} micros "
        "was suggested, garnering an estimated minimum of "
        f"{recommendation.metrics.min_daily_clicks} clicks and an estimated "
        f"maximum of {recommendation.metrics.max_daily_clicks} per day."
    )

    return recommendation.daily_amount_micros
      

রুবি

# Retrieves a suggested budget amount for a new budget.
#
# Using the SmartCampaignSuggestService to determine a daily budget for new
# and existing Smart campaigns is highly recommended because it helps the
# campaigns achieve optimal performance.
def get_budget_suggestion(client, customer_id, suggestion_info)
  # Issues a request to retrieve a budget suggestion.
  response = client.service.smart_campaign_suggest.suggest_smart_campaign_budget_options(
    customer_id: customer_id,
    # You can retrieve suggestions for an existing campaign by setting the
    # "campaign" field of the request equal to the resource name of a campaign
    # and leaving the rest of the request fields below unset:
    # campaign: INSERT_CAMPAIGN_RESOURCE_NAME_HERE,
    # Since these suggestions are for a new campaign, we're going to
    # use the suggestion_info field instead.
    suggestion_info: suggestion_info,
  )

  # Three tiers of options will be returned, a "low", "high" and
  # "recommended". Here we will use the "recommended" option. The amount is
  # specified in micros, where one million is equivalent to one currency unit.
  recommendation = response.recommended
  puts "A daily budget amount of #{recommendation.daily_amount_micros} micros" \
    " was suggested, garnering an estimated minimum of" \
    " #{recommendation.metrics.min_daily_clicks} clicks and an estimated" \
    " maximum of #{recommendation.metrics.max_daily_clicks} per day."

  recommendation.daily_amount_micros
end
      

পার্ল

# Retrieves a suggested budget amount for a new budget.
# Using the SmartCampaignSuggestService to determine a daily budget for new and
# existing Smart campaigns is highly recommended because it helps the campaigns
# achieve optimal performance.
sub _get_budget_suggestion {
  my ($api_client, $customer_id, $suggestion_info) = @_;

  my $request =
    Google::Ads::GoogleAds::V18::Services::SmartCampaignSuggestService::SuggestSmartCampaignBudgetOptionsRequest
    ->new({
      customerId => $customer_id,
      # You can retrieve suggestions for an existing campaign by setting the
      # "campaign" field of the request to the resource name of a campaign and
      # leaving the rest of the request fields below unset:
      # campaign => "INSERT_CAMPAIGN_RESOURCE_NAME_HERE",
      #
      # Since these suggestions are for a new campaign, we're going to use the
      # "suggestion_info" field instead.
      suggestionInfo => $suggestion_info
    });

  # Issue a request to retrieve a budget suggestion.
  my $response = $api_client->SmartCampaignSuggestService()
    ->suggest_smart_campaign_budget_options($request);

  # Three tiers of options will be returned: "low", "high", and "recommended".
  # Here we will use the "recommended" option. The amount is specified in micros,
  # where one million is equivalent to one currency unit.
  printf "A daily budget amount of %d was suggested, garnering an estimated " .
    "minimum of %d clicks and an estimated maximum of %d clicks per day.\n",
    $response->{recommended}{dailyAmountMicros},
    $response->{recommended}{metrics}{minDailyClicks},
    $response->{recommended}{metrics}{maxDailyClicks};

  return $response->{recommended}{dailyAmountMicros};
}
      

প্রস্তাবিত বিজ্ঞাপন পাঠ্য সম্পদ পান

SmartCampaignSuggestService একটি SuggestSmartCampaignAd পদ্ধতি রয়েছে যা আপনার স্মার্ট প্রচারাভিযানের বিজ্ঞাপনের জন্য তিনটি পর্যন্ত শিরোনাম এবং দুটি বিবরণের জন্য পরামর্শ সহ একটি SmartCampaignAdInfo উদাহরণ প্রদান করে। প্রতিটি শিরোনাম এবং বিবরণ SmartCampaignAdInfo এর সাথে সংযুক্ত একটি AdTextAsset উদাহরণের ক্ষেত্রে রয়েছে।

এই পদ্ধতিতে কোনো পরামর্শ দেওয়া নাও হতে পারে, অথবা যে AdTextAsset দৃষ্টান্তগুলি ফেরত দেওয়া হয় সেগুলির text ক্ষেত্রের মান হিসাবে একটি খালি স্ট্রিং থাকতে পারে। আমরা সুপারিশ করি যে আপনি বিজ্ঞাপনগুলি তৈরি করতে ব্যবহার করার আগে এই পরামর্শগুলি পর্যালোচনা করুন যাতে বিজ্ঞাপনগুলি সর্বদা সর্বনিম্ন 3টি শিরোনাম এবং 2টি বিবরণের সাথে তৈরি করা হয়। যদি এই ন্যূনতমটি পূরণ না হয়, বা যদি সম্পদের পাঠ্য খুব ছোট হয়, অনুরোধটি একটি ত্রুটি সহ ব্যর্থ হবে৷

বিজ্ঞাপন সম্পদের জন্য প্রস্তাবনাগুলি মূলত ওয়েবসাইটের বিষয়বস্তু থেকে প্রাপ্ত হয়, তাই যদি SmartCampaignSuggestionInfo উদাহরণে একটি final_url নির্দিষ্ট করা না থাকে, তাহলে পরামর্শগুলি শুধুমাত্র অনুরোধে প্রদত্ত কীওয়ার্ড থিম থেকে তৈরি করা হয়।

জাভা

private SmartCampaignAdInfo getAdSuggestions(
    GoogleAdsClient googleAdsClient,
    long customerId,
    SmartCampaignSuggestionInfo suggestionInfo) {
  // Unlike the SuggestSmartCampaignBudgetOptions method, it's only possible to use
  // suggestion_info to retrieve ad creative suggestions.

  // Issues a request to retrieve ad creative suggestions.
  try (SmartCampaignSuggestServiceClient smartCampaignSuggestService =
      googleAdsClient.getLatestVersion().createSmartCampaignSuggestServiceClient()) {
    SuggestSmartCampaignAdResponse response =
        smartCampaignSuggestService.suggestSmartCampaignAd(
            SuggestSmartCampaignAdRequest.newBuilder()
                .setCustomerId(Long.toString(customerId))
                .setSuggestionInfo(suggestionInfo)
                .build());

    // The SmartCampaignAdInfo object in the response contains a list of up to three headlines
    // and two descriptions. Note that some of the suggestions may have empty strings as text.
    // Before setting these on the ad you should review them and filter out any empty values.
    SmartCampaignAdInfo adSuggestions = response.getAdInfo();
    for (AdTextAsset headline : adSuggestions.getHeadlinesList()) {
      System.out.println(!headline.getText().isEmpty() ? headline.getText() : "None");
    }
    for (AdTextAsset description : adSuggestions.getDescriptionsList()) {
      System.out.println(!description.getText().isEmpty() ? description.getText() : "None");
    }
    return adSuggestions;
  }
}
      

সি#

/// <summary>
/// Retrieves creative suggestions for a Smart campaign ad.
///
/// Using the SmartCampaignSuggestService to suggest creatives for new
/// and existing Smart campaigns is highly recommended because it helps
/// the campaigns achieve optimal performance.
/// </summary>
/// <param name="client"></param>
/// <param name="customerId">The Google Ads customer ID.</param>
/// <param name="suggestionInfo">a SmartCampaignSuggestionInfo instance
/// with details about the business being advertised.</param>
/// <returns>A SmartCampaignAdInfo instance with suggested headlines and
/// descriptions.</returns>
private SmartCampaignAdInfo GetAdSuggestions(GoogleAdsClient client,
    long customerId, SmartCampaignSuggestionInfo suggestionInfo)
{
    SmartCampaignSuggestServiceClient smartCampaignSuggestService =
      client.GetService(Services.V18.SmartCampaignSuggestService);

    SuggestSmartCampaignAdRequest request = new SuggestSmartCampaignAdRequest
    {
        CustomerId = customerId.ToString(),
        // Unlike the SuggestSmartCampaignBudgetOptions method, it's only possible to
        // use suggestion_info to retrieve ad creative suggestions.
        SuggestionInfo = suggestionInfo
    };

    // Issue a request to retrieve ad creative suggestions.
    SuggestSmartCampaignAdResponse response =
      smartCampaignSuggestService.SuggestSmartCampaignAd(request);

    // The SmartCampaignAdInfo object in the response contains a list of up to
    // three headlines and two descriptions. Note that some of the suggestions
    // may have empty strings as text. Before setting these on the ad you should
    // review them and filter out any empty values.
    SmartCampaignAdInfo adSuggestions = response.AdInfo;

    if (adSuggestions != null)
    {
        Console.WriteLine($"The following headlines were suggested:");
        foreach (AdTextAsset headline in adSuggestions.Headlines)
        {
            Console.WriteLine($"\t{headline.Text}");
        }

        Console.WriteLine($"And the following descriptions were suggested:");
        foreach (AdTextAsset description in adSuggestions.Descriptions)
        {
            Console.WriteLine($"\t{description.Text}");
        }
    }
    else
    {
        Console.WriteLine("No ad suggestions were found.");
        adSuggestions = new SmartCampaignAdInfo();
    }

    return adSuggestions;
}
      

পিএইচপি

private static function getAdSuggestions(
    GoogleAdsClient $googleAdsClient,
    int $customerId,
    SmartCampaignSuggestionInfo $suggestionInfo
) {
    // Unlike the SuggestSmartCampaignBudgetOptions method, it's only possible to use
    // suggestion_info to retrieve ad creative suggestions.

    // Issues a request to retrieve ad creative suggestions.
    $smartCampaignSuggestService = $googleAdsClient->getSmartCampaignSuggestServiceClient();
    $response = $smartCampaignSuggestService->suggestSmartCampaignAd(
        (new SuggestSmartCampaignAdRequest())
            ->setCustomerId($customerId)
            ->setSuggestionInfo($suggestionInfo)
    );

    // The SmartCampaignAdInfo object in the response contains a list of up to three headlines
    // and two descriptions. Note that some of the suggestions may have empty strings as text.
    // Before setting these on the ad you should review them and filter out any empty values.
    $adSuggestions = $response->getAdInfo();
    if (is_null($adSuggestions)) {
        return null;
    }
    print 'The following headlines were suggested:' . PHP_EOL;
    foreach ($adSuggestions->getHeadlines() as $headline) {
        print "\t" . ($headline->getText() ?: 'None') . PHP_EOL;
    }
    print 'And the following descriptions were suggested:' . PHP_EOL;
    foreach ($adSuggestions->getDescriptions() as $description) {
        print "\t" . ($description->getText() ?: 'None') . PHP_EOL;
    }
    return $adSuggestions;
}
      

পাইথন

def get_ad_suggestions(client, customer_id, suggestion_info):
    """Retrieves creative suggestions for a Smart campaign ad.

    Using the SmartCampaignSuggestService to suggest creatives for new and
    existing Smart campaigns is highly recommended because it helps the
    campaigns achieve optimal performance.

    Args:
        client: an initialized GoogleAdsClient instance.
        customer_id: a client customer ID.
        suggestion_info: a SmartCampaignSuggestionInfo instance with details
          about the business being advertised.

    Returns:
        a SmartCampaignAdInfo instance with suggested headlines and
            descriptions.
    """
    sc_suggest_service = client.get_service("SmartCampaignSuggestService")
    request = client.get_type("SuggestSmartCampaignAdRequest")
    request.customer_id = customer_id

    # Unlike the SuggestSmartCampaignBudgetOptions method, it's only possible
    # to use suggestion_info to retrieve ad creative suggestions.
    request.suggestion_info = suggestion_info

    # Issue a request to retrieve ad creative suggestions.
    response = sc_suggest_service.suggest_smart_campaign_ad(request=request)

    # The SmartCampaignAdInfo object in the response contains a list of up to
    # three headlines and two descriptions. Note that some of the suggestions
    # may have empty strings as text. Before setting these on the ad you should
    # review them and filter out any empty values.
    ad_suggestions = response.ad_info

    print("The following headlines were suggested:")
    for headline in ad_suggestions.headlines:
        print(f"\t{headline.text or '<None>'}")

    print("And the following descriptions were suggested:")
    for description in ad_suggestions.descriptions:
        print(f"\t{description.text or '<None>'}")

    return ad_suggestions
      

রুবি

# Retrieves creative suggestions for a Smart campaign ad.
#
# Using the SmartCampaignSuggestService to suggest creatives for new and
# existing Smart campaigns is highly recommended because it helps the
# campaigns achieve optimal performance.
def get_ad_suggestions(client, customer_id, suggestion_info)
  # Issue a request to retrieve ad creative suggestions.
  response = client.service.smart_campaign_suggest.suggest_smart_campaign_ad(
    customer_id: customer_id,
    # Unlike the SuggestSmartCampaignBudgetOptions method, it's only possible
    # to use suggestion_info to retrieve ad creative suggestions.
    suggestion_info: suggestion_info,
  )

  # The SmartCampaignAdInfo object in the response contains a list of up to
  # three headlines and two descriptions. Note that some of the suggestions
  # may have empty strings as text. Before setting these on the ad you should
  # review them and filter out any empty values.
  ad_suggestions = response.ad_info

  # If there are no suggestions, the response will be blank.
  return nil if ad_suggestions.nil?

  puts 'The following headlines were suggested:'
  ad_suggestions.headlines.each do  |headline|
    puts "\t#{headline.text || '<None>'}"
  end

  puts 'And the following descriptions were suggested:'
  ad_suggestions.descriptions.each do |description|
    puts "\t#{description.text || '<None>'}"
  end

  ad_suggestions
end
      

পার্ল

# Retrieves creative suggestions for a Smart campaign ad.
# Using the SmartCampaignSuggestService to suggest creatives for new and
# existing Smart campaigns is highly recommended because it helps the campaigns
# achieve optimal performance.
sub _get_ad_suggestions {
  my ($api_client, $customer_id, $suggestion_info) = @_;

  # Issue a request to retrieve ad creative suggestions.
  my $response =
    $api_client->SmartCampaignSuggestService()->suggest_smart_campaign_ad(
    Google::Ads::GoogleAds::V18::Services::SmartCampaignSuggestService::SuggestSmartCampaignAdRequest
      ->new({
        customerId => $customer_id,
        # Unlike the SuggestSmartCampaignBudgetOptions method, it's only
        # possible to use suggestion_info to retrieve ad creative suggestions.
        suggestionInfo => $suggestion_info
      }));

  # The SmartCampaignAdInfo object in the response contains a list of up to
  # three headlines and two descriptions. Note that some of the suggestions
  # may have empty strings as text. Before setting these on the ad you should
  # review them and filter out any empty values.
  my $ad_suggestions = $response->{adInfo};
  printf "The following headlines were suggested:\n";
  foreach my $headline (@{$ad_suggestions->{headlines}}) {
    printf "\t%s\n", defined $headline->{text} ? $headline->{text} : "<None>";
  }
  printf "And the following descriptions were suggested:\n";
  foreach my $description (@{$ad_suggestions->{descriptions}}) {
    printf "\t%s\n",
      defined $description->{text} ? $description->{text} : "<None>";
  }

  return $ad_suggestions;
}