লোকেশন অ্যাসেট

অন্যান্য অ্যাসেটের মতো, আপনি অ্যাসেট সেট তৈরি করার পরে Google Ads API অটোমেটিক লোকেশন অ্যাসেট তৈরি করে। প্রথমে, লোকেশন সিঙ্ক অ্যাসেট সেট তৈরি করুন এবং এটি গ্রাহকের সাথে অ্যাটাচ করুন। তারপর, কোনও ক্যাম্পেন বা বিজ্ঞাপন গ্রুপের জন্য অ্যাসেট সেটে লোকেশন অ্যাসেটের সাবসেট বেছে নিতে হলে, লোকেশন গ্রুপ অ্যাসেট সেট তৈরি করে ক্যাম্পেন বা বিজ্ঞাপন গ্রুপের সাথে অ্যাটাচ করুন।

লোকেশন সিঙ্ক অ্যাসেট সেট তৈরি করে গ্রাহকের সাথে অ্যাটাচ করুন

  1. লোকেশন সিঙ্ক অ্যাসেট সেট তৈরি করুন।
  2. CustomerAssetSetService ব্যবহার করে এটি কোনও গ্রাহকের সাথে অ্যাটাচ করুন।

লোকেশন সিঙ্ক অ্যাসেট সেট তৈরি করা

  1. নতুন AssetSet তৈরি করুন।
    1. type-কে LOCATION_SYNC-এ সেট করুন।
    2. location_set-কে নতুন LocationSet-এ সেট করুন।
  2. নতুন LocationSet-এ,

    1. আপনার ব্যবহারের উপর ভিত্তি করে location_ownership_type সেট করুন:
      • আপনি ব্যবসার লোকেশনের মালিক হলে এটি BUSINESS_OWNER হিসেবে সেট করুন।
      • আপনি ব্যবসার লোকেশনের মালিক না হলেও সেখানে প্রোডাক্ট বিক্রি করলে, এটিকে AFFILIATE সেট করুন।
    2. আপনার ব্যবহারের উপর ভিত্তি করে source oneof ফিল্ড সেট করুন:

      • আপনার Google Business Profile অ্যাকাউন্টে আপনার লোকেশনের সাথে সিঙ্ক করতে চাইলে, business_profile_location_set সেট করুন।

        Google Business Profile অ্যাকাউন্টের সাথে Google Ads লিঙ্ক করার জন্য BusinessProfileLocationSet তৈরি করার সময়, আপনাকে http_authorization_token ফিল্ডে OAuth 2.0 অ্যাক্সেস টোকেন দিতে হবে। এই টোকেন প্রমাণ করে যে আপনি Google Ads-কে নির্দিষ্ট Google Business Profile থেকে লোকেশন ডেটা অ্যাক্সেস করার অনুমতি দিচ্ছেন।

        টোকেনকে এইসব প্রয়োজনীয়তা পূরণ করতে হবে:

        • এটি অবশ্যই সেই Google অ্যাকাউন্টের (ব্যবহারকারী বা পরিষেবা অ্যাকাউন্ট) জন্য তৈরি করতে হবে যার ইমেল আইডি BusinessProfileLocationSet-এর email_address ফিল্ডে প্রদান করা হয়েছে।
        • Google Business Profile-এ ব্যবসার লোকেশন সংক্রান্ত তথ্য পড়ার জন্য এই অ্যাকাউন্টের কাছে পর্যাপ্ত অনুমতি থাকতে হবে।
        • OAuth 2.0 টোকেন অবশ্যই https://www.googleapis.com/auth/business.manage স্কোপের সাথে পেতে হবে।

        OAuth 2.0 অ্যাক্সেস টোকেন কীভাবে তৈরি করতে হয় সেই সম্পর্কে বিস্তারিত নির্দেশাবলীর জন্য, Google API অ্যাক্সেস করার জন্য OAuth 2.0 ব্যবহার করা নিবন্ধটি দেখুন।

      • আপনি যদি নির্দিষ্ট চেইন আইডির লোকেশনের সাথে সিঙ্ক করতে চান, তাহলে chain_location_set সেট করুন।

      • আপনি যদি প্লেস আইডি ব্যবহার করে ম্যানুয়ালি লোকেশন যোগ করতে চান, তাহলে maps_location_set সেট করুন।

আপনি এইসব ধাপ সম্পূর্ণ করার পরে, Google Ads API লোকেশন অ্যাসেট তৈরি করে এবং আপনার জন্য তৈরি করা লোকেশন সিঙ্ক অ্যাসেট সেটে সেগুলি যোগ করে, AssetSetAssetService ব্যবহার করে আপনি ম্যানুয়ালি যেভাবে করেন এটিও ঠিক সেইরকম। আপনি যদি ম্যানুয়ালি স্ট্যাটিক লোকেশন গ্রুপ অ্যাসেট সেটে যোগ করতে না চান, তাহলে আপনাকে সেগুলি ম্যানিপুলেট করতে হবে না।

কোনও গ্রাহকের জন্য status-এর সাথে ENABLED-এ সেট করা শুধুমাত্র একটি অ্যাক্টিভ লোকেশন সিঙ্ক অ্যাসেট সেট থাকতে পারে। আপনাকে অন্য ধরনের লোকেশন সিঙ্ক অ্যাসেট সেট তৈরি করতে হলে, আগে থেকে থাকা অ্যাসেট সেট সরিয়ে দিন।

গ্রাহকের সাথে লোকেশন সিঙ্ক অ্যাসেট সেট অ্যাটাচ করা

আপনার গ্রাহকের সাথে আগের বিভাগে সেট করা লোকেশন সিঙ্ক অ্যাসেট সেট অ্যাটাচ করতে CustomerAssetSetService.MutateCustomerAssetSets ব্যবহার করুন।

(ঐচ্ছিক) লোকেশন গ্রুপ অ্যাসেট সেট তৈরি করে সেটি কোনও ক্যাম্পেন বা বিজ্ঞাপন গ্রুপের সাথে অ্যাটাচ করুন

আপনাকে লোকেশন অ্যাসেটের সাবসেট বেছে নিতে হলে তবেই লোকেশন গ্রুপ অ্যাসেট সেট প্রয়োজন। ক্যাম্পেন ও বিজ্ঞাপন গ্রুপ গ্রাহক লেভেল থেকে লোকেশন অ্যাসেট ইনহেরিট করার কারণে এটি হয়।

লোকেশন গ্রুপ অ্যাসেট সেটে লোকেশন সিঙ্ক অ্যাসেট সেটের লোকেশন অ্যাসেটের একটি সাবসেট থাকে। আপনি Google Business Profile-এর কিছু ফিচার (যেমন, লেবেল অনুযায়ী ফিল্টার করা) অথবা চেনের আইডি ও চেনের লোকেশন ব্যবহার করে ডায়নামিক লোকেশন গ্রুপ অ্যাসেট সেট তৈরি করতে পারবেন। বিকল্প হিসেবে, আপনি স্ট্যাটিক পদ্ধতিতে লোকেশন গ্রুপ অ্যাসেট সেট তৈরি করতে পারেন।

  1. লোকেশন গ্রুপ অ্যাসেট সেট তৈরি করুন। লোকেশন গ্রুপ অ্যাসেট সেট ডায়নামিক বা স্ট্যাটিক হতে পারে।
  2. আপনার প্রয়োজন অনুযায়ী, কোনও ক্যাম্পেন বা বিজ্ঞাপন গ্রুপের সাথে অ্যাসেট সেট অ্যাটাচ করুন।
  3. (ঐচ্ছিক) আগে তৈরি করা অ্যাসেটকে নতুন তৈরি করা স্ট্যাটিক লোকেশন গ্রুপ অ্যাসেট সেটে যোগ করুন।

কোনও নির্দিষ্ট গ্রাহকের জন্য, আপনি একাধিক ডায়নামিক বা স্ট্যাটিক লোকেশন গ্রুপ অ্যাসেট সেট তৈরি করতে পারবেন।

লোকেশন গ্রুপ অ্যাসেট সেট তৈরি করুন

নতুন AssetSet তৈরি করুন এবং location_group_parent_asset_set_id-কে আগে তৈরি করা লোকেশন সিঙ্ক অ্যাসেট সেটের আইডিতে সেট করুন।

তারপর, আপনি ডায়নামিক বা স্ট্যাটিক লোকেশন গ্রুপ অ্যাসেট সেট তৈরি করতে চান কিনা তার উপর ভিত্তি করে কিছু ফিল্ড সেট করুন।

ডায়নামিক অ্যাসেট সেট

-এ সেট করা LocationSet ফিল্ডের উপর নির্ভর করে, নিম্নলিখিত নিয়ম অনুযায়ী ফিল্ড সেট করুন:

আপনি যদি নিম্নলিখিত ফিল্ড সেট করেন তারপর ধরন সেট করুন এবং এই ফিল্ডটিকে asset_set_source oneof ফিল্ড হিসেবে সেট করুন
business_profile_location_set BUSINESS_PROFILE_DYNAMIC_LOCATION_GROUP business_profile_location_group
chain_location_set CHAIN_DYNAMIC_LOCATION_GROUP chain_location_group

আপনি যদি maps_location_set সেট করেন, তাহলে লোকেশন সিঙ্ক অ্যাসেট তৈরি করার সময় সেট করুন, আপনি ডায়নামিক লোকেশন গ্রুপ অ্যাসেট সেট তৈরি করতে পারবেন না। কারণ আপনি ম্যানুয়ালি প্লেস আইডি দিয়ে লোকেশন যোগ করেছেন এবং এই ধরনের লোকেশনের জন্য আপনি কোনও ফিল্টারিং ফিচার ব্যবহার করতে পারবেন না।

স্ট্যাটিক অ্যাসেট সেট

type-কে STATIC_LOCATION_GROUP-এ সেট করুন। আপনি যেকোনও ধরনের লোকেশন সিঙ্ক অ্যাসেট সেটের জন্য স্ট্যাটিক লোকেশন গ্রুপ অ্যাসেট সেট তৈরি করতে পারেন, আপনি LocationSet-এ যে ফিল্ডই (business_profile_location_set, chain_location_set, অথবা maps_location_set) সেট করুন না কেন।

স্ট্যাটিক লোকেশন গ্রুপ অ্যাসেট সেটের জন্য, আপনাকে তৈরি করা লোকেশন অ্যাসেট, লোকেশন গ্রুপ অ্যাসেট সেটে ম্যানুয়ালি যোগ করতে হবে।

কোনও ক্যাম্পেন বা বিজ্ঞাপন গ্রুপে অ্যাসেট সেট অ্যাটাচ করুন

আপনার ক্যাম্পেনের সাথে লোকেশন গ্রুপ অ্যাসেট সেট অ্যাটাচ করতে CampaignAssetSetService.MutateCampaignAssetSets ব্যবহার করুন।

বিকল্প হিসেবে, AdGroupAssetSetService.MutateAdGroupAssetSets ব্যবহার করুন যদি আপনি লোকেশন গ্রুপ অ্যাসেট সেট পরিবর্তে কোনও বিজ্ঞাপন গ্রুপের সাথে অ্যাটাচ করতে চান।

(ঐচ্ছিক) স্ট্যাটিক লোকেশন গ্রুপ অ্যাসেট সেটে লোকেশন অ্যাসেট যোগ করুন

আপনি আগে স্ট্যাটিক লোকেশন গ্রুপ অ্যাসেট সেট তৈরি করে থাকলে তবেই এই ধাপটি প্রয়োজন।

  1. asset_set_asset রিপোর্ট ব্যবহার করে আগে তৈরি করা লোকেশন সিঙ্ক অ্যাসেট সেটের অ্যাসেটের রিসোর্স নাম অটোমেটিক জেনারেট করুন। আপনি যে অ্যাসেট চান শুধু সেটি পেতে ফিল্টার ব্যবহার করুন।
  2. AssetSetAssetService.MutateAssetSetAssets ব্যবহার করে এগুলিকে স্ট্যাটিক লোকেশন গ্রুপ অ্যাসেট সেটে যোগ করুন।

Business Profile-এর লোকেশন আইডি ম্যানেজ করা

আপনি যখন Business Profile ওয়েবসাইট বা API থেকে পাওয়া listing_id_filters-এর উপর business_profile_location_set এবং ফিল্টার ব্যবহার করেন, তখন এইসব সংখ্যাসূচক ভ্যালু uint64 থেকে int64-এ কনভার্ট করার প্রয়োজন হতে পারে। আপনার কোড যদি রানটাইম সমস্যা তৈরি করে যে আপনার Business Profile লোকেশন আইডি রেঞ্জের বাইরে যখন এটি listing_id_filters[] রিপিটেড ফিল্ডে যোগ করা হয়, তাহলে আপনাকে সম্ভবত এটি নিম্নলিখিত যেকোনও উদাহরণ ব্যবহার করে কনভার্ট করতে হবে:

Java

/**
 * Converts the business profile location ID to the format expected by the
 * DynamicBusinessProfileLocationGroupFilter.listing_id_filters[] repeated field.
 * The business profile location ID is an unsigned 64-bit integer, while the
 * listing_id_filters[] field expects signed 64-bit integers. This means that
 * for business profile location IDs that are out of range, we must perform the
 * two's complement to convert it into a signed int.
 *
 * @param businessProfileLocationId The ID of a Business Profile location ID.
 * @return a Business Profile location ID as a signed 64-bit integer (long).
 */
public static long convertBusinessProfileLocationId(String businessProfileLocationId) {
    return Long.parseUnsignedLong(businessProfileLocationId);
}

C#

/// <summary>
/// Converts the business profile location ID to the format expected by the
/// DynamicBusinessProfileLocationGroupFilter.listing_id_filters[] repeated field.
/// The business profile location ID is an unsigned 64-bit integer, while the
/// listing_id_filters[] field expects signed 64-bit integers. This means that
/// for business profile location IDs that are out of range, we must perform the
/// two's complement to convert it into a signed int.
/// </summary>
/// <param name="businessProfileLocationId">The ID of a Business Profile location.</param>
/// <returns>The converted business location ID in signed 64 bit.</returns>
public long ConvertBusinessProfileLocationId(ulong businessProfileLocationId)
{
  return unchecked((long)businessProfileLocationId);
}

PHP

/**
* Converts a business profile location ID to a signed 64 bit integer.
*
* Converts the business profile location ID to the format expected by the
* DynamicBusinessProfileLocationGroupFilter.listing_id_filters[] repeated field.
* The business profile location ID is an unsigned 64-bit integer, while the
* listing_id_filters[] field expects signed 64-bit integers. This means that
* for business profile location IDs that are out of range, we must perform the
* two's complement to convert it into a signed int.
*
* @param string $businessProfileLocationId the ID of a Business Profile location
* @return int the converted business location ID in signed 64 bit
*/
public static function convertBusinessProfileLocationId(string $businessProfileLocationId): int
{
    $unsignedMax = '18446744073709551615'; // 2^64 - 1
    $signedMax = '9223372036854775807'; // 2^63 - 1

    // Check if the business profile location ID is within 64 bit range.
    // If not, throw an error.
    if (bccomp($businessProfileLocationId, '0') < 0 || bccomp($businessProfileLocationId, $unsignedMax) > 0) {
        throw new InvalidArgumentException(
            'The given business profile location id is outside of the range for a 64 bit integer.'
        );
    }

    // Check if the business profile location ID is in signed 64 bit range.
    // If it's not, convert it to its two's complement.
    if (bccomp($businessProfileLocationId, $signedMax) > 0) {
        // Two's complement: ID - 2^64
        return (int) bcsub($businessProfileLocationId, '18446744073709551616');
    }

    return (int) $businessProfileLocationId;
}

Python

import ctypes

def convert_business_profile_location_id(business_profile_location_id):
    """Converts a business profile location ID to a signed 64 bit integer.

    Converts the business profile location ID to the format expected by the
    DynamicBusinessProfileLocationGroupFilter.listing_id_filters[] repeated field.
    The business profile location ID is an unsigned 64-bit integer, while the
    listing_id_filters[] field expects signed 64-bit integers. This means that
    for business profile location IDs that are out of range, we must perform the
    two's complement to convert it into a signed int.

    Args:
        business_profile_location_id: the ID of a Business Profile location ID.

    Returns:
        a Business Profile location ID as a signed 64 bit integer.
    """
    # Check if the business profile location ID is within 64 bit range.
    # If not, throw an error.
    if business_profile_location_id < 0 or business_profile_location_id >= 2 ** 64:
        raise ValueError(
            "The given business profile location id is outside of the range for a 64 bit integer."
        )
    # Check if the business profile location ID is in signed 64 bit range.
    # If it's not, convert it to its two's complement.
    elif business_profile_location_id >= 2 ** 63:
        return ctypes.c_int64(business_profile_location_id).value
    else:
        return business_profile_location_id

Ruby

# Converts the business profile location ID to the format expected by the
# DynamicBusinessProfileLocationGroupFilter.listing_id_filters[] repeated field.
# The business profile location ID is an unsigned 64-bit integer, while the
# listing_id_filters[] field expects signed 64-bit integers. This means that
# for business profile location IDs that are out of range, we must perform the
# two's complement to convert it into a signed int.
# Since Ruby supports arbitrary precision numbers, we have to calculate it
# manually.
LONG_MAX = 2 ** 63
ULONG_MAX = LONG_MAX * 2
def convert_business_profile_location_id(business_profile_location_id)
  # Check if the business profile location ID is within 64 bit range.
  # If not, throw an error.
  if business_profile_location_id < 0 || business_profile_location_id >= 2 ** 64
    raise "The given business profile location id is outside of the range for a 64 bit integer."
  # Check if the business profile location ID is in signed 64 bit range.
  # If it's not, convert it to its two's complement.
  elsif business_profile_location_id >= 2**63
    -1 * (ULONG_MAX - business_profile_location_id)
  else
    business_profile_location_id
  end
end

Perl

use bigint;

# Converts the business profile location ID to the format expected by the
# DynamicBusinessProfileLocationGroupFilter.listing_id_filters[] repeated field.
# The business profile location ID is an unsigned 64-bit integer, while the
# listing_id_filters[] field expects signed 64-bit integers. This means that
# for business profile location IDs that are out of range, we must perform the
# two's complement to convert it into a signed int.
sub convert_business_profile_location_id {
  my ($business_profile_location_id) = @_;

  # Check if the business profile location ID is within 64 bit range.
  # If not, throw an error.
  if ($business_profile_location_id < 0 || $business_profile_location_id >= 2**64) {
    die "The given business profile location id is outside of the range for a 64 bit integer";
  # Check if the business profile location ID is in signed 64 bit range.
  # If it's not, convert it to its two's complement.
  } elsif ($business_profile_location_id >= 2**63) {
    return -1 * (2**64 - $business_profile_location_id);
  } else {
    return $business_profile_location_id;
  }
}