গ্রাহক ম্যাচ দিয়ে শুরু করুন

কাস্টমার ম্যাচ আপনাকে আপনার অনলাইন এবং অফলাইন ডেটা ব্যবহার করে সার্চ, শপিং ট্যাব, জিমেইল, ইউটিউব এবং ডিসপ্লে জুড়ে আপনার গ্রাহকদের কাছে পৌঁছাতে এবং তাদের সাথে পুনরায় সংযোগ স্থাপন করতে সাহায্য করে। আপনার গ্রাহকদের শেয়ার করা তথ্য ব্যবহার করে, কাস্টমার ম্যাচ সেই গ্রাহকদের এবং তাদের মতো অন্যান্য গ্রাহকদের লক্ষ্য করে বিজ্ঞাপন প্রদর্শন করে। আপনি একসাথে অনেক কাস্টমার রিলেশনশিপ ম্যানেজমেন্ট (CRM) ডেটা আপলোড করতে পারেন, ডেটা যোগ বা অপসারণ করতে পারেন, অথবা এই ব্যবহারকারী তালিকাগুলি ব্যবহার করে একটি logical_user_list তৈরি করতে পারেন।

কাস্টমার ম্যাচকে অন্যান্য ব্যবহারকারী তালিকার বিকল্পগুলির সাথে তুলনা করতে, বিভিন্ন ধরণের অডিয়েন্স সেগমেন্টের তালিকার জন্য অডিয়েন্স ম্যানেজমেন্ট ওভারভিউ দেখুন।

কাস্টমার ম্যাচ এবং অডিয়েন্স টার্গেটিং সম্পর্কে আরও জানুন।

পূর্বশর্ত

সব অ্যাকাউন্ট কাস্টমার ম্যাচ ব্যবহারের জন্য যোগ্য নয়। কাস্টমার ম্যাচ ব্যবহার করতে হলে, আপনার অ্যাকাউন্টে নিম্নলিখিত বিষয়গুলো থাকতে হবে:

  • নীতিমালা পালনের একটি ভালো ইতিহাস
  • একটি ভালো পরিশোধের ইতিহাস

আপনার অ্যাকাউন্ট কোন কোন শর্ত পূরণ করে, তার উপর নির্ভর করে বিভিন্ন সুবিধা পাওয়া যায়। যোগ্যতার শর্তাবলী এবং সীমাবদ্ধতা জানতে কাস্টমার ম্যাচ নীতি দেখুন।

শুরু করার আগে: আপনার বাস্তবায়নের পরিকল্পনা করুন।

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

ব্যবহারের প্রবাহ

গ্রাহক তালিকা তৈরি এবং টার্গেট করার জন্য প্রস্তাবিত কার্যপ্রবাহটি নিচে দেওয়া হলো:

  1. একটি খালি গ্রাহক তালিকা তৈরি করুন।

  2. একটি OfflineUserDataJob তৈরি করুন। কয়েকটি ছোট ছোট জব তৈরি করার চেয়ে একটি বড় জব তৈরি করা অনেক বেশি কার্যকর।

    আপনার OfflineUserDataJob create অনুরোধগুলিতে customer_match_user_list_metadata এর consent ক্ষেত্রটি পূরণ করা নিশ্চিত করুন। remove অনুরোধের জন্য সম্মতির প্রয়োজন নেই। যদি জবটির consent.ad_user_data বা consent.ad_personalization কে DENIED হিসেবে সেট করা থাকে, তাহলে API-টি OfflineUserDataJobError.CUSTOMER_NOT_ACCEPTED_CUSTOMER_DATA_TERMS রিটার্ন করে।

    যদি কোনো ব্যবহারকারী সম্মতি না দিয়ে থাকেন, তাহলে আপনি ব্যবহারকারীর তালিকা থেকে তার শনাক্তকারীগুলো মুছে ফেলার জন্য একটি remove অপারেশনসহ একটি জব তৈরি করতে পারেন।

    যদি নির্দিষ্ট ব্যবহারকারীদের সম্মতি না থাকে, তাহলে একটি আলাদা জব তৈরি করুন যেখানে আপনি জবটির customer_match_user_list_metadata এর consent ফিল্ডটি সেট করবেন না, তারপর সেই আলাদা জবটির create অপারেশন ব্যবহার করে ওই ব্যবহারকারীদের জন্য আইডেন্টিফায়ার যোগ করুন।

  3. OfflineUserDataJobService.AddOfflineUserDataJobOperations মেথড ব্যবহার করে অপারেশন যোগ করুন। সর্বোত্তম প্রক্রিয়াকরণের জন্য আমরা একটি একক কলে মোট ১০,০০০ পর্যন্ত আইডেন্টিফায়ার যোগ করার পরামর্শ দিই। একটি একক AddOfflineUserDataJobOperations অনুরোধে অপারেশন তালিকার সমস্ত UserData অবজেক্ট জুড়ে সর্বাধিক ১০০,০০০ আইডেন্টিফায়ার থাকতে পারে।

    উদাহরণস্বরূপ, যদি আপনার প্রতিটি UserData অবজেক্টে hashed_email জন্য একটি UserIdentifier এবং hashed_phone_number এর জন্য আরেকটি UserIdentifier থাকে, তাহলে প্রতি অনুরোধে ৫,০০০টি UserData অবজেক্ট পাঠানোই সর্বোত্তম, কারণ প্রতিটি অনুরোধে মোট ১০,০০০টি ব্যবহারকারী শনাক্তকারী থাকবে।

  4. সমস্ত অপারেশন যোগ না হওয়া পর্যন্ত অথবা জবটি তার ধারণক্ষমতায় না পৌঁছানো পর্যন্ত পূর্ববর্তী ধাপটি পুনরাবৃত্তি করুন। একটি একক জবে আপনি যত খুশি অপারেশন যোগ করতে পারেন, এর কোনো সীমা নেই; তবে, সর্বোত্তম প্রক্রিয়াকরণের জন্য আমরা প্রতি জবে ১০,০০,০০০-এর বেশি অপারেশন না রাখার পরামর্শ দিই।

  5. জবটি চালান । এটি তৈরি করার ৫ দিনের মধ্যে আপনাকে অবশ্যই জবটি চালাতে হবে। অন্যথায়, জবটি আর চালানোর জন্য উপলব্ধ থাকবে না।

  6. সফলভাবে আপলোড হয়েছে কিনা তা জানতে পোল করুন।

  7. ম্যাচ রেট যাচাই করুন।

  8. তালিকাটিকে লক্ষ্য করুন।

অফলাইনইউজারডেটাজবসার্ভিস এবং ইউজারডেটাসার্ভিস

কাস্টমার ম্যাচ ডেটা আপলোড করার জন্য দুটি পরিষেবা উপলব্ধ আছে। আপনার ব্যবহারের ক্ষেত্র অনুযায়ী পরিষেবাটি নির্বাচন করুন, কারণ কোনো একটি পরিষেবার সীমাবদ্ধতা থাকতে পারে।

গ্রাহক ম্যাচ আপলোড পরিষেবা
OfflineUserDataJobService (পছন্দনীয়) বেশিরভাগ ডেভেলপার এই পরিষেবাটি ব্যবহার করেন। এটি উচ্চ থ্রুপুট সহ বড় আপলোডের জন্য অপ্টিমাইজ করা হয়েছে এবং কাজ সম্পন্ন হলে সফলতার মেট্রিক্স প্রদান করে। এই নির্দেশিকাটি প্রধানত এই পরিষেবাটির উপর আলোকপাত করে।
UserDataService এই পরিষেবাটি বিক্ষিপ্ত আপডেটের মাধ্যমে একবারে অল্প সংখ্যক আইডেন্টিফায়ার আপলোড করার জন্য অপ্টিমাইজ করা হয়েছে এবং এটি অবিচ্ছিন্নভাবে চলার জন্য অপ্টিমাইজ করা হয়নি। প্রতি অনুরোধে এর ১০টি অপারেশনের একটি সীমা রয়েছে। এছাড়াও, একটি একক অনুরোধে সমস্ত user_identifiers মিলিয়ে মোট ১০০টির বেশি আইটেম থাকতে পারবে না।

এই পরিষেবার মাধ্যমে আপলোড সংক্রান্ত নির্দেশনার জন্য, আপনার কাস্টমার ম্যাচ ইন্টিগ্রেশন পরিচালনার নির্দেশিকাটি দেখুন।

Google Ads API-এর v15 সংস্করণ থেকে শুরু করে, আপনার UploadUserDataRequest create অনুরোধগুলিতে customer_match_user_list_metadata এর consent ক্ষেত্রটি পূরণ করতে হবে। remove অনুরোধের জন্য সম্মতির প্রয়োজন নেই। যদি consent.ad_user_data বা consent.ad_personalization সম্মতি DENIED হয়, তাহলে API একটি প্রতিক্রিয়া ফেরত দেয় যেখানে received_operations_count শূন্য সেট করা থাকে, যা নির্দেশ করে যে অনুরোধটি প্রক্রিয়া করা হয়নি। যদি কোনো আইডেন্টিফায়ারের সম্মতি DENIED হয়, তাহলে আপনি UploadUserDataRequest এর remove অপারেশন ব্যবহার করে ব্যবহারকারীর তালিকা থেকে আইডেন্টিফায়ারটি সরানোর জন্য অনুরোধ করতে পারেন।

সর্বোত্তম অনুশীলন

আপনার কাস্টমার ম্যাচ ইন্টিগ্রেশন ডিজাইন করার সময় নিম্নলিখিত সেরা অনুশীলনগুলি মনে রাখবেন:

  • একটি ব্যবহারকারী তালিকা পরিবর্তন করার জন্য একাধিক অ্যাকাউন্ট ব্যবহার করার চেষ্টা করবেন না। একটি ব্যবহারকারী তালিকা শুধুমাত্র সেই Google Ads বা ডেটা পার্টনার অ্যাকাউন্ট দ্বারাই পরিবর্তন করা যাবে, যেটি এটি তৈরি করেছে।

  • RESOURCE_EXHAUSTED ত্রুটি এড়াতে, AddOfflineUserDataJobOperationsRequest প্রতি অপারেশনের সংখ্যা সর্বাধিক করুন, যা সর্বোচ্চ ১০০,০০০ আইডেন্টিফায়ার পর্যন্ত হতে পারে।

  • একই OfflineUserDataJob মধ্যে create এবং remove অপারেশন একসাথে ব্যবহার করবেন না। এমনটা করলে CONFLICTING_OPERATION ত্রুটি দেখা দিতে পারে।

  • জবটি চালানোর আগে যেকোনো সমস্যাযুক্ত অপারেশন শনাক্ত করার জন্য AddOfflineUserDataJobOperationsRequestpartial_failure সক্ষম করুন। OfflineUserDataJob এ আপলোড করার সময় অপারেশনগুলো যাচাই করা হয়।

  • ব্যবহারকারীর তালিকা আপডেট করার সময় CONCURRENT_MODIFICATION ত্রুটি প্রতিরোধ করতে:

    CustomerMatchUserListMetadata.user_list এ নির্দিষ্ট করা একই ইউজার লিস্ট রিসোর্স নেমকে টার্গেট করলে, একাধিক OfflineUserDataJob প্রসেসকে একই সাথে RUNNING অবস্থায় রাখা থেকে বিরত থাকুন। এই ত্রুটিটি ঘটে কারণ একাধিক জব একই সময়ে একই লিস্ট পরিবর্তন করার চেষ্টা করে। কোনো এপিআই (API) জব প্রসেস হওয়ার সময় আপনি যদি গুগল অ্যাডস ইউআই (Google Ads UI)-এর মাধ্যমে লিস্টটি পরিবর্তন করেন, তাহলেও এই দ্বন্দ্ব দেখা দিতে পারে।

    এই সীমাবদ্ধতা সেইসব জবের ক্ষেত্রে প্রযোজ্য যেগুলো শুরু করা হয়েছে, অর্থাৎ যেগুলো চলমান (RUNNING)। এর বিপরীতে, একটি OfflineUserDataJob যখন পেন্ডিং (PENDING) অবস্থায় থাকে, তখনও আপনি নিরাপদে সেটিতে ডেটা যোগ করার জন্য একাধিক AddOfflineUserDataJobOperations রিকোয়েস্ট পাঠাতে পারেন। প্রসেসটি শুরু করার জন্য RunOfflineUserDataJob কল করার আগে যেকোনো সময়ে একটি জবে অপারেশন যোগ করা যেতে পারে।

  • যদি আপনাকে হাজার হাজার অপারেশন প্রয়োগ করতে হয়, তবে সমস্ত অপারেশন সম্বলিত একটিমাত্র OfflineUserDataJob তৈরি করুন। প্রতিটিতে মাত্র কয়েকশ অপারেশন নিয়ে একাধিক জব তৈরি করে সেগুলোকে ক্রমানুসারে বা একসাথে চালাবেন না। একাধিক ছোট জবের চেয়ে আপনার সমস্ত অপারেশন সম্বলিত একটিমাত্র বড় জব অনেক বেশি কার্যকর এবং এটি আপনার ওয়ার্কফ্লোতে ত্রুটির সম্মুখীন হওয়ার সম্ভাবনা কমিয়ে দেয়।

আপনার গ্রাহক তালিকা ব্যবহার করে সর্বোত্তম টার্গেটিং কীভাবে করবেন, সে সম্পর্কে ধারণা পেতে ‘গ্রাহক ম্যাচিংয়ের সেরা অনুশীলনসমূহ’ দেখুন।

ধাপ ১: একটি গ্রাহক তালিকা তৈরি করুন

UserListService ব্যবহার করে একটি গ্রাহক তালিকা তৈরি করুন। user_list অবজেক্টে crm_based_user_list ফিল্ডটি সেট করার মাধ্যমে গ্রাহক তালিকা তৈরি করা হয়। যে সকল ক্যাম্পেইন টাইপ গ্রাহক তালিকা টার্গেট করা সমর্থন করে, সেগুলিতে crm_based_user_list ফিল্ডটি সেট করা যেতে পারে:

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

crm_based_user_list তিনটি ফিল্ড রয়েছে:

  • app_id : একটি স্ট্রিং যা সেই মোবাইল অ্যাপটিকে অনন্যভাবে শনাক্ত করে যেখান থেকে ডেটা সংগ্রহ করা হয়েছে। মোবাইল বিজ্ঞাপন আইডি আপলোড করার জন্য CrmBasedUserList তৈরি করার সময় এটি প্রয়োজন হয়।

  • upload_key_type : তালিকার সাথে মেলে এমন একটি কী টাইপ, যা CONTACT_INFO , CRM_ID , বা MOBILE_ADVERTISING_ID হতে পারে। একই তালিকায় মিশ্র ডেটা টাইপের অনুমতি নেই। সমস্ত গ্রাহক তালিকার জন্য এই ফিল্ডটি আবশ্যক।

  • data_source_type : তালিকার ডেটা উৎস। এর ডিফল্ট মান হলো FIRST_PARTY । অনুমোদিত তালিকায় থাকা গ্রাহকরা তৃতীয় পক্ষের ডেটা ব্যবহার করে গ্রাহক তালিকা তৈরি করতে পারেন।

ব্যবহারকারী তালিকার membership_life_span অ্যাট্রিবিউটটি আপনাকে দিনের হিসাবে সেই সময়কাল নির্ধারণ করতে দেয়, যে সময়ের জন্য একজন ব্যবহারকারীকে তালিকার অন্তর্ভুক্ত বলে গণ্য করা হবে। একটি কাস্টমার ম্যাচ ব্যবহারকারী তালিকার membership_life_span অবশ্যই 540 এর বেশি হবে না, যা এর ডিফল্ট মানও বটে।

membership_status অ্যাট্রিবিউটটি নির্ধারণ করে যে তালিকাটি নতুন ব্যবহারকারী গ্রহণ করবে কি না।

গ্রাহক তালিকা তৈরির কোড উদাহরণ

জাভা

private String createCustomerMatchUserList(GoogleAdsClient googleAdsClient, long customerId) {
  // Creates the new user list.
  UserList userList =
      UserList.newBuilder()
          .setName("Customer Match list #" + getPrintableDateTime())
          .setDescription("A list of customers that originated from email addresses")
          // Membership life span must be between 0 and 540 days inclusive. See:
          // https://developers.google.com/google-ads/api/reference/rpc/latest/UserList#membership_life_span
          // Sets the membership life span to 30 days.
          .setMembershipLifeSpan(30)
          // Sets the upload key type to indicate the type of identifier that will be used to
          // add users to the list. This field is immutable and required for a CREATE operation.
          .setCrmBasedUserList(
              CrmBasedUserListInfo.newBuilder()
                  .setUploadKeyType(CustomerMatchUploadKeyType.CONTACT_INFO))
          .build();

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

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

      

সি#

private string CreateCustomerMatchUserList(GoogleAdsClient client, long customerId)
{
    // Get the UserListService.
    UserListServiceClient service = client.GetService(Services.V23.UserListService);

    // Creates the user list.
    UserList userList = new UserList()
    {
        Name = $"Customer Match list# {ExampleUtilities.GetShortRandomString()}",
        Description = "A list of customers that originated from email and physical" +
            " addresses",
        // Membership life span must be between 0 and 540 days inclusive. See:
        // https://developers.google.com/google-ads/api/reference/rpc/latest/UserList#membership_life_span
        // Sets the membership life span to 30 days.
        MembershipLifeSpan = 30,
        CrmBasedUserList = new CrmBasedUserListInfo()
        {
            UploadKeyType = CustomerMatchUploadKeyType.ContactInfo
        }
    };
    // Creates the user list operation.
    UserListOperation operation = new UserListOperation()
    {
        Create = userList
    };

    // Issues a mutate request to add the user list and prints some information.
    MutateUserListsResponse response = service.MutateUserLists(
        customerId.ToString(), new[] { operation });
    string userListResourceName = response.Results[0].ResourceName;
    Console.WriteLine($"User list with resource name '{userListResourceName}' " +
        $"was created.");
    return userListResourceName;
}
      

পিএইচপি

private static function createCustomerMatchUserList(
    GoogleAdsClient $googleAdsClient,
    int $customerId
): string {
    // Creates the user list.
    $userList = new UserList([
        'name' => 'Customer Match list #' . Helper::getPrintableDatetime(),
        'description' => 'A list of customers that originated from email '
            . 'and physical addresses',
        // Membership life span must be between 0 and 540 days inclusive. See:
        // https://developers.google.com/google-ads/api/reference/rpc/latest/UserList#membership_life_span
        // Sets the membership life span to 30 days.
        'membership_life_span' => 30,
        'crm_based_user_list' => new CrmBasedUserListInfo([
            // Sets the upload key type to indicate the type of identifier that will be used to
            // add users to the list. This field is immutable and required for a CREATE
            // operation.
            'upload_key_type' => CustomerMatchUploadKeyType::CONTACT_INFO
        ])
    ]);

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

    // Issues a mutate request to add the user list and prints some information.
    $userListServiceClient = $googleAdsClient->getUserListServiceClient();
    $response = $userListServiceClient->mutateUserLists(
        MutateUserListsRequest::build($customerId, [$operation])
    );
    $userListResourceName = $response->getResults()[0]->getResourceName();
    printf("User list with resource name '%s' was created.%s", $userListResourceName, PHP_EOL);

    return $userListResourceName;
}
      

পাইথন

def create_customer_match_user_list(
    client: GoogleAdsClient, customer_id: str
) -> str:
    """Creates a Customer Match user list.

    Args:
        client: The Google Ads client.
        customer_id: The ID for the customer that owns the user list.

    Returns:
        The string resource name of the newly created user list.
    """
    # Creates the UserListService client.
    user_list_service_client: UserListServiceClient = client.get_service(
        "UserListService"
    )

    # Creates the user list operation.
    user_list_operation: UserListOperation = client.get_type(
        "UserListOperation"
    )

    # Creates the new user list.
    user_list: UserList = user_list_operation.create
    user_list.name = f"Customer Match list #{uuid.uuid4()}"
    user_list.description = (
        "A list of customers that originated from email and physical addresses"
    )
    # Sets the upload key type to indicate the type of identifier that is used
    # to add users to the list. This field is immutable and required for a
    # CREATE operation.
    user_list.crm_based_user_list.upload_key_type = (
        client.enums.CustomerMatchUploadKeyTypeEnum.CONTACT_INFO
    )
    # Membership life span must be between 0 and 540 days inclusive. See:
    # https://developers.google.com/google-ads/api/reference/rpc/latest/UserList#membership_life_span
    # Sets the membership life span to 30 days.
    user_list.membership_life_span = 30

    response: MutateUserListsResponse = (
        user_list_service_client.mutate_user_lists(
            customer_id=customer_id, operations=[user_list_operation]
        )
    )
    user_list_resource_name: str = response.results[0].resource_name
    print(
        f"User list with resource name '{user_list_resource_name}' was created."
    )

    return user_list_resource_name
      

রুবি

def create_customer_match_user_list(client, customer_id)
  # Creates the user list.
  operation = client.operation.create_resource.user_list do |ul|
    ul.name = "Customer Match List #{(Time.new.to_f * 1000).to_i}"
    ul.description = "A list of customers that originated from email and " \
      "physical addresses"
    # Membership life span must be between 0 and 540 days inclusive. See:
    # https://developers.google.com/google-ads/api/reference/rpc/latest/UserList#membership_life_span
    # Sets the membership life span to 30 days.
    ul.membership_life_span = 30
    ul.crm_based_user_list = client.resource.crm_based_user_list_info do |crm|
      crm.upload_key_type = :CONTACT_INFO
    end
  end

  # Issues a mutate request to add the user list and prints some information.
  response = client.service.user_list.mutate_user_lists(
    customer_id: customer_id,
    operations: [operation],
  )

  # Prints out some information about the newly created user list.
  resource_name = response.results.first.resource_name
  puts "User list with resource name #{resource_name} was created."

  resource_name
end
      

পার্ল

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

  # Create the user list.
  my $user_list = Google::Ads::GoogleAds::V23::Resources::UserList->new({
      name        => "Customer Match list #" . uniqid(),
      description =>
        "A list of customers that originated from email and physical addresses",
      # Membership life span must be between 0 and 540 days inclusive. See:
      # https://developers.google.com/google-ads/api/reference/rpc/latest/UserList#membership_life_span
      # Set the membership life span to 30 days.
      membershipLifeSpan => 30,
      # Set the upload key type to indicate the type of identifier that will be
      # used to add users to the list. This field is immutable and required for
      # a CREATE operation.
      crmBasedUserList =>
        Google::Ads::GoogleAds::V23::Common::CrmBasedUserListInfo->new({
          uploadKeyType => CONTACT_INFO
        })});

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

  # Issue a mutate request to add the user list and print some information.
  my $user_lists_response = $api_client->UserListService()->mutate({
      customerId => $customer_id,
      operations => [$user_list_operation]});
  my $user_list_resource_name =
    $user_lists_response->{results}[0]{resourceName};
  printf "User list with resource name '%s' was created.\n",
    $user_list_resource_name;

  return $user_list_resource_name;
}
      

কার্ল

ধাপ ২: ব্যবহারকারী তালিকায় সদস্য যুক্ত করুন

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

প্রতিটি ব্যবহারকারী তালিকায় শুধুমাত্র এক ধরনের গ্রাহক ডেটা থাকতে পারে, যা CrmBasedUserListInfo.upload_key_type ফিল্ড দ্বারা নির্দিষ্ট করা থাকে। এছাড়াও, একটি UserData অবজেক্ট, যা একজন ব্যবহারকারীকে প্রতিনিধিত্ব করে, তাতে সর্বোচ্চ ২০টি ব্যবহারকারী আইডেন্টিফায়ার থাকতে পারে, যার প্রতিটির নিজস্ব UserIdentifier অবজেক্ট থাকে। ২০টির বেশি আইডেন্টিফায়ার থাকলে TOO_MANY_USER_IDENTIFIERS ত্রুটি দেখা দেয়।

গুগল অ্যাডস টার্গেটিংয়ের জন্য কাস্টমার ম্যাচ ইউজার লিস্ট তখনই ব্যবহার করে, যখন বিজ্ঞাপনটি দেখানোর সময় তাতে সক্রিয় ব্যবহারকারীর একটি ন্যূনতম সংখ্যা পূরণ হয়; সক্রিয় ব্যবহারকারী হলো আপনার লিস্টের সেইসব ব্যবহারকারী যারা জিমেইল, সার্চ, ইউটিউব বা ডিসপ্লে-তে সক্রিয়। টার্গেটিংয়ের জন্য পর্যাপ্ত সংখ্যক ম্যাচ করা সক্রিয় ব্যবহারকারী পাওয়ার সম্ভাবনা বাড়াতে কমপক্ষে ৫,০০০ সদস্য আপলোড করুন।

ব্যবহারকারীর যোগাযোগের তথ্য আপলোড করুন

ব্যবহারকারীর ইমেল ঠিকানা, ডাক ঠিকানা বা ফোন নম্বর আপলোড করতে, upload_key_type CONTACT_INFO তে সেট করুন। মনে রাখবেন, মেলানোর জন্য যোগাযোগের তথ্য অবশ্যই একটি Google অ্যাকাউন্টের সাথে যুক্ত থাকতে হবে এবং Google Workspace-এর মতো কর্পোরেট অ্যাকাউন্টগুলোকে টার্গেট করা যাবে না।

গোপনীয়তার স্বার্থে, ইমেল ঠিকানা, প্রথম নাম, পদবি এবং ফোন নম্বর আপলোড করার আগে অবশ্যই SHA-256 অ্যালগরিদম ব্যবহার করে হ্যাশ করতে হবে। হ্যাশের ফলাফলকে মানসম্মত করার জন্য, এই মানগুলির মধ্যে কোনো একটি হ্যাশ করার আগে, নিম্নলিখিত কাজগুলি সম্পন্ন করেছেন কিনা তা নিশ্চিত করুন:

হ্যাশ করার আগে যোগাযোগের তথ্য সঠিকভাবে ফরম্যাট করা না হলে, এপিআই হ্যাশ করা তথ্য গ্রহণ করলেও, তা কোনো গ্রাহকের সাথে মেলানো যায় না।

আপনি যদি ডাক ঠিকানার তথ্য আপলোড করতে চান, তবে আপনাকে অবশ্যই ন্যূনতম নিম্নলিখিত বিষয়গুলো অন্তর্ভুক্ত করতে হবে:

  • দেশের কোড
  • পোস্টাল কোড
  • হ্যাশ করা প্রথম নাম
  • হ্যাশ করা শেষ নাম

এই ক্ষেত্রগুলির কোনোটি অনুপস্থিত থাকলে ঠিকানাটি মেলানো যাবে না।

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

উন্নত রূপান্তরের জন্য ইমেল ঠিকানা বিন্যাস

উন্নত কনভার্সনের জন্য সর্বোচ্চ ম্যাচ রেট নিশ্চিত করতে, হ্যাশ করার আগে আপনাকে অবশ্যই ইমেল অ্যাড্রেসগুলো সঠিকভাবে ফরম্যাট করতে হবে। এই ধাপগুলো অনুসরণ করুন:

  1. স্ট্যান্ডার্ড নর্মালাইজেশন প্রয়োগ করুন (সকল ইমেল ঠিকানার জন্য):

    • শুরুতে বা শেষে থাকা যেকোনো অতিরিক্ত স্থান মুছে ফেলুন।
    • সম্পূর্ণ ইমেল ঠিকানাটিকে ছোট হাতের অক্ষরে রূপান্তর করুন।
  2. প্রযোজ্য ক্ষেত্রে, Gmail/Googlemail-এর জন্য নির্দিষ্ট স্বাভাবিকীকরণ প্রয়োগ করুন:

    • এই ধাপটি শুধুমাত্র gmail.com এবং googlemail.com ডোমেইনযুক্ত ইমেল ঠিকানাগুলোর ক্ষেত্রে প্রযোজ্য।
    • ডট ( . ) সরান: ইউজারনেমের অংশ থেকে ( @ এর আগে) সমস্ত ডট অক্ষর মুছে ফেলুন।
    • প্লাস চিহ্ন ( + ) বাদ দিন: ইউজারনেম অংশ থেকে প্লাস চিহ্ন ( + ) এবং এর পরের সমস্ত অক্ষর মুছে ফেলুন।

      • উদাহরণ: Jane.Doe+Shopping@googlemail.com প্রথমে jane.doe+shopping@googlemail.com (ছোট হাতের অক্ষরে) হয়, এবং তারপর janedoe@googlemail.com হয় (Gmail/Googlemail-এর নির্দিষ্ট নিয়ম অনুযায়ী)।
    • অন্যান্য ডোমেইন: gmail.com বা googlemail.com ছাড়া অন্য কোনো ডোমেইনের ইমেল ঠিকানার ইউজারনেম থেকে পিরিয়ড (.) বা প্লাস (.) সাফিক্স সরানো উচিত নয়। এই ঠিকানাগুলিতে শুধুমাত্র সাধারণ নর্মালাইজেশন (ছোট হাতের অক্ষর, অতিরিক্ত স্পেস বাদ দেওয়া) প্রয়োগ করুন।

      • উদাহরণ: user.name+NYC@Example.com স্বাভাবিক হয়ে user.name+nyc@example.com হবে।
  3. স্বাভাবিককৃত ইমেল ঠিকানাটি হ্যাশ করুন:

    • যথাযথ স্বাভাবিকীকরণ ধাপগুলো প্রয়োগ করার পর, প্রাপ্ত ইমেল ঠিকানাটিকে SHA-256 অ্যালগরিদম ব্যবহার করে হ্যাশ করুন।

CRM আইডি আপলোড করুন

CRM ID দিয়ে গ্রাহক তালিকা পূরণ করতে, upload_key_type CRM_ID তে সেট করুন। বিজ্ঞাপনদাতার দ্বারা তৈরি ও নির্ধারিত একটি ইউজার আইডি থেকে CRM ID-গুলো মেলানো হয়। এটি MOBILE_ADVERTISING_ID ইনস্ট্যান্স আপলোড করার মতোই, তবে এক্ষেত্রে আপনাকে UserIdentifier অবজেক্টের third_party_user_id ফিল্ডটি পূরণ করতে হবে।

মোবাইল আইডি আপলোড করুন

ইমেলের মাধ্যমে কাস্টমার ম্যাচিংয়ের মতোই, আপনি আইডেন্টিফায়ার ফর অ্যাডভার্টাইজিং (IDFA) বা গুগল অ্যাডভার্টাইজিং আইডি (AAID) মোবাইল ডিভাইস আইডি ব্যবহার করে কাস্টমার ম্যাচিং করতে পারেন। এটি করার জন্য, মোবাইল ডিভাইস আইডির মাধ্যমে কাস্টমার ম্যাচিংয়ের জন্য ব্যবহারকারীর তালিকা ব্যবহার করার আগে app_id প্রপার্টিটি নির্দিষ্ট করুন এবং upload_key_type MOBILE_ADVERTISING_ID তে সেট করুন।

কোডের উদাহরণ

নিম্নলিখিত উদাহরণটি একটি গ্রাহক তালিকায় গ্রাহকের যোগাযোগের তথ্য যুক্ত করতে OfflineUserDataJobOperation ব্যবহার করে।

জাভা

// Creates a raw input list of unhashed user information, where each element of the list
// represents a single user and is a map containing a separate entry for the keys "email",
// "phone", "firstName", "lastName", "countryCode", and "postalCode". In your application, this
// data might come from a file or a database.
List<Map<String, String>> rawRecords = new ArrayList<>();
// The first user data has an email address and a phone number.
Map<String, String> rawRecord1 =
    ImmutableMap.<String, String>builder()
        .put("email", "dana@example.com")
        // Phone number to be converted to E.164 format, with a leading '+' as required. This
        // includes whitespace that will be removed later.
        .put("phone", "+1 800 5550101")
        .build();
// The second user data has an email address, a mailing address, and a phone number.
Map<String, String> rawRecord2 =
    ImmutableMap.<String, String>builder()
        // Email address that includes a period (.) before the domain.
        .put("email", "alex.2@example.com")
        // Address that includes all four required elements: first name, last name, country
        // code, and postal code.
        .put("firstName", "Alex")
        .put("lastName", "Quinn")
        .put("countryCode", "US")
        .put("postalCode", "94045")
        // Phone number to be converted to E.164 format, with a leading '+' as required.
        .put("phone", "+1 800 5550102")
        .build();
// The third user data only has an email address.
Map<String, String> rawRecord3 =
    ImmutableMap.<String, String>builder().put("email", "charlie@example.com").build();
// Adds the raw records to the raw input list.
rawRecords.add(rawRecord1);
rawRecords.add(rawRecord2);
rawRecords.add(rawRecord3);

// Iterates over the raw input list and creates a UserData object for each record.
List<UserData> userDataList = new ArrayList<>();
for (Map<String, String> rawRecord : rawRecords) {
  // Creates a builder for the UserData object that represents a member of the user list.
  UserData.Builder userDataBuilder = UserData.newBuilder();
  // Checks if the record has email, phone, or address information, and adds a SEPARATE
  // UserIdentifier object for each one found. For example, a record with an email address and a
  // phone number will result in a UserData with two UserIdentifiers.

  // IMPORTANT: Since the identifier attribute of UserIdentifier
  // (https://developers.google.com/google-ads/api/reference/rpc/latest/UserIdentifier) is a
  // oneof
  // (https://protobuf.dev/programming-guides/proto3/#oneof-features), you must set only ONE of
  // hashedEmail, hashedPhoneNumber, mobileId, thirdPartyUserId, or addressInfo. Setting more
  // than one of these attributes on the same UserIdentifier will clear all the other members
  // of the oneof. For example, the following code is INCORRECT and will result in a
  // UserIdentifier with ONLY a hashedPhoneNumber.
  //
  // UserIdentifier incorrectlyPopulatedUserIdentifier =
  //     UserIdentifier.newBuilder()
  //         .setHashedEmail("...")
  //         .setHashedPhoneNumber("...")
  //         .build();
  //
  // The separate 'if' statements below demonstrate the correct approach for creating a UserData
  // for a member with multiple UserIdentifiers.

  // Checks if the record has an email address, and if so, adds a UserIdentifier for it.
  if (rawRecord.containsKey("email")) {
    UserIdentifier hashedEmailIdentifier =
        UserIdentifier.newBuilder()
            .setHashedEmail(normalizeAndHash(sha256Digest, rawRecord.get("email"), true))
            .build();
    // Adds the hashed email identifier to the UserData object's list.
    userDataBuilder.addUserIdentifiers(hashedEmailIdentifier);
  }

  // Checks if the record has a phone number, and if so, adds a UserIdentifier for it.
  if (rawRecord.containsKey("phone")) {
    UserIdentifier hashedPhoneNumberIdentifier =
        UserIdentifier.newBuilder()
            .setHashedPhoneNumber(normalizeAndHash(sha256Digest, rawRecord.get("phone"), true))
            .build();
    // Adds the hashed phone number identifier to the UserData object's list.
    userDataBuilder.addUserIdentifiers(hashedPhoneNumberIdentifier);
  }

  // Checks if the record has all the required mailing address elements, and if so, adds a
  // UserIdentifier for the mailing address.
  if (rawRecord.containsKey("firstName")) {
    // Checks if the record contains all the other required elements of a mailing address.
    Set<String> missingAddressKeys = new HashSet<>();
    for (String addressKey : new String[] {"lastName", "countryCode", "postalCode"}) {
      if (!rawRecord.containsKey(addressKey)) {
        missingAddressKeys.add(addressKey);
      }
    }

    if (!missingAddressKeys.isEmpty()) {
      System.out.printf(
          "Skipping addition of mailing address information because the following required keys"
              + " are missing: %s%n",
          missingAddressKeys);
    } else {
      // Creates an OfflineUserAddressInfo object that contains all the required elements of a
      // mailing address.
      OfflineUserAddressInfo addressInfo =
          OfflineUserAddressInfo.newBuilder()
              .setHashedFirstName(
                  normalizeAndHash(sha256Digest, rawRecord.get("firstName"), false))
              .setHashedLastName(
                  normalizeAndHash(sha256Digest, rawRecord.get("lastName"), false))
              .setCountryCode(rawRecord.get("countryCode"))
              .setPostalCode(rawRecord.get("postalCode"))
              .build();
      UserIdentifier addressIdentifier =
          UserIdentifier.newBuilder().setAddressInfo(addressInfo).build();
      // Adds the address identifier to the UserData object's list.
      userDataBuilder.addUserIdentifiers(addressIdentifier);
    }
  }

  if (!userDataBuilder.getUserIdentifiersList().isEmpty()) {
    // Builds the UserData and adds it to the list.
    userDataList.add(userDataBuilder.build());
  }
}

// Creates the operations to add users.
List<OfflineUserDataJobOperation> operations = new ArrayList<>();
for (UserData userData : userDataList) {
  operations.add(OfflineUserDataJobOperation.newBuilder().setCreate(userData).build());
}
      

সি#

// Creates a raw input list of unhashed user information, where each element of the list
// represents a single user and is a map containing a separate entry for the keys
// "email", "phone", "firstName", "lastName", "countryCode", and "postalCode".
// In your application, this data might come from a file or a database.
List<Dictionary<string, string>> rawRecords = new List<Dictionary<string, string>>();

// The first user data has an email address and a phone number.
Dictionary<string, string> rawRecord1 = new Dictionary<string, string>();
rawRecord1.Add("email", "dana@example.com");
// Phone number to be converted to E.164 format, with a leading '+' as required.
// This includes whitespace that will be removed later.
rawRecord1.Add("phone", "+1 800 5550101");

// The second user data has an email address, a mailing address, and a phone number.
Dictionary<string, string> rawRecord2 = new Dictionary<string, string>();
// Email address that includes a period (.) before the Gmail domain.
rawRecord2.Add("email", "alex.2@example.com");
// Address that includes all four required elements: first name, last name, country
// code, and postal code.
rawRecord2.Add("firstName", "Alex");
rawRecord2.Add("lastName", "Quinn");
rawRecord2.Add("countryCode", "US");
rawRecord2.Add("postalCode", "94045");
// Phone number to be converted to E.164 format, with a leading '+' as required.
// This includes whitespace that will be removed later.
rawRecord2.Add("phone", "+1 800 5550102");

// The third user data only has an email address.
Dictionary<string, string> rawRecord3 = new Dictionary<string, string>();
rawRecord3.Add("email", "charlie@example.com");

// Adds the raw records to the raw input list.
rawRecords.Add(rawRecord1);
rawRecords.Add(rawRecord2);
rawRecords.Add(rawRecord3);

// Iterates over the raw input list and creates a UserData object for each record.
List<UserData> userDataList = new List<UserData>();
foreach (Dictionary<string, string> rawRecord in rawRecords) {
    // Creates a UserData object that represents a member of the user list.
    UserData userData = new UserData();
    // Checks if the record has email, phone, or address information, and adds a
    // SEPARATE UserIdentifier object for each one found.
    // For example, a record with an email address and a phone number will result in a
    // UserData with two UserIdentifiers.

    // IMPORTANT: Since the identifier attribute of UserIdentifier
    // (https://developers.google.com/google-ads/api/reference/rpc/latest/UserIdentifier)
    // is a oneof
    // (https://protobuf.dev/programming-guides/proto3/#oneof-features), you must set
    // only ONE of hashedEmail, hashedPhoneNumber, mobileId, thirdPartyUserId,
    // or addressInfo.
    // Setting more than one of these attributes on the same UserIdentifier will clear
    // all the other members of the oneof.
    // For example, the following code is INCORRECT and will result in a UserIdentifier
    // with ONLY a hashedPhoneNumber.
    //
    // UserIdentifier incorrectlyPopulatedUserIdentifier = new UserIdentifier()
    // {
    //      HashedEmail = "...",
    //      HashedPhoneNumber = "..."
    // };
    //
    // The separate 'if' statements below demonstrate the correct approach for creating
    // a UserData for a member with multiple UserIdentifiers.

    // Checks if the record has an email address, and if so, adds a UserIdentifier
    // for it.
    if (rawRecord.ContainsKey("email")) {
        UserIdentifier hashedEmailIdentifier = new UserIdentifier()
        {
            HashedEmail = NormalizeAndHash(rawRecord["email"], true)
        };

        userData.UserIdentifiers.Add(hashedEmailIdentifier);
    }

    // Checks if the record has a phone number, and if so, adds a UserIdentifier for it.
    if (rawRecord.ContainsKey("phone")) {
        UserIdentifier hashedPhoneNumberIdentifier = new UserIdentifier()
        {
            HashedPhoneNumber = NormalizeAndHash(rawRecord["phone"], true)
        };

        // Adds the hashed phone number identifier to the UserData object's list.
        userData.UserIdentifiers.Add(hashedPhoneNumberIdentifier);
    }

    // Checks if the record has all the required mailing address elements, and if so,
    // adds a UserIdentifier for the mailing address.
    if (rawRecord.ContainsKey("firstName")) {
        // Checks if the record contains all the other required elements of a mailing
        // address.
        HashSet<string> missingAddressKeys = new HashSet<string>();
        foreach (string addressKey in new string[] {"lastName", "countryCode",
            "postalCode"}) {
        if (!rawRecord.ContainsKey(addressKey)) {
            missingAddressKeys.Add(addressKey);
        }
        }

        if (!missingAddressKeys.Any()) {
        Console.WriteLine(
            $"Skipping addition of mailing address information because the following " +
                "required keys are missing: {missingAddressKeys}");
        } else {
            // Creates an OfflineUserAddressInfo object that contains all the required
            // elements of a mailing address.
            OfflineUserAddressInfo addressInfo = new OfflineUserAddressInfo()
            {
                HashedFirstName = NormalizeAndHash(rawRecord["firstName"]),
                HashedLastName = NormalizeAndHash(rawRecord["lastName"]),
                CountryCode = rawRecord["countryCode"],
                PostalCode = rawRecord["postalCode"]
            };

            UserIdentifier addressIdentifier = new UserIdentifier()
            {
                AddressInfo = addressInfo
            };

            // Adds the address identifier to the UserData object's list.
            userData.UserIdentifiers.Add(addressIdentifier);
        }
    }

    if (userData.UserIdentifiers.Any())
    {
        userDataList.Add(userData);
    }
}

// Creates the operations to add the users.
List<OfflineUserDataJobOperation> operations = new List<OfflineUserDataJobOperation>();
foreach(UserData userData in userDataList)
{
    operations.Add(new OfflineUserDataJobOperation()
    {
        Create = userData
    });
}
      

পিএইচপি

// Creates a raw input list of unhashed user information, where each element of the list
// represents a single user and is a map containing a separate entry for the keys 'email',
// 'phone', 'firstName', 'lastName', 'countryCode', and 'postalCode'. In your application,
// this data might come from a file or a database.
$rawRecords = [];
// The first user data has an email address and a phone number.
$rawRecord1 = [
    // The first user data has an email address and a phone number.
    'email' => 'dana@example.com',
    // Phone number to be converted to E.164 format, with a leading '+' as required. This
    // includes whitespace that will be removed later.
    'phone' => '+1 800 5550101'
];
$rawRecords[] = $rawRecord1;

// The second user data has an email address, a mailing address, and a phone number.
$rawRecord2 = [
    // Email address that includes a period (.) before the Gmail domain.
    'email' => 'alex.2@example.com',
    // Address that includes all four required elements: first name, last name, country
    // code, and postal code.
    'firstName' => 'Alex',
    'lastName' => 'Quinn',
    'countryCode' => 'US',
    'postalCode' => '94045',
    // Phone number to be converted to E.164 format, with a leading '+' as required.
    'phone' => '+1 800 5550102',
];
$rawRecords[] = $rawRecord2;

// The third user data only has an email address.
$rawRecord3 = ['email' => 'charlie@example.com'];
$rawRecords[] = $rawRecord3;

// Iterates over the raw input list and creates a UserData object for each record.
$userDataList = [];
foreach ($rawRecords as $rawRecord) {
    // Checks if the record has email, phone, or address information, and adds a SEPARATE
    // UserIdentifier object for each one found. For example, a record with an email address
    // and a phone number will result in a UserData with two UserIdentifiers.

    // IMPORTANT: Since the identifier attribute of UserIdentifier
    // (https://developers.google.com/google-ads/api/reference/rpc/latest/UserIdentifier) is
    // a oneof
    // (https://protobuf.dev/programming-guides/proto3/#oneof-features), you must set only
    // ONE of 'hashed_email, 'hashed_phone_number', 'mobile_id', 'third_party_user_id', or
    // 'address_info'.
    // Setting more than one of these attributes on the same UserIdentifier will clear all
    // the other members of the oneof. For example, the following code is INCORRECT and will
    // result in a UserIdentifier with ONLY a 'hashed_phone_number'.
    //
    // $incorrectlyPopulatedUserIdentifier = new UserIdentifier();
    // $incorrectlyPopulatedUserIdentifier->setHashedEmail('...');
    // $incorrectlyPopulatedUserIdentifier->setHashedPhoneNumber('...');
    //
    // The separate 'if' statements below demonstrate the correct approach for creating a
    // UserData for a member with multiple UserIdentifiers.

    $userIdentifiers = [];
    // Checks if the record has an email address, and if so, adds a UserIdentifier for it.
    if (array_key_exists('email', $rawRecord)) {
        $hashedEmailIdentifier = new UserIdentifier([
            'hashed_email' => self::normalizeAndHash($rawRecord['email'], true)
        ]);
        // Adds the hashed email identifier to the user identifiers list.
        $userIdentifiers[] = $hashedEmailIdentifier;
    }

    // Checks if the record has a phone number, and if so, adds a UserIdentifier for it.
    if (array_key_exists('phone', $rawRecord)) {
        $hashedPhoneNumberIdentifier = new UserIdentifier([
            'hashed_phone_number' => self::normalizeAndHash($rawRecord['phone'], true)
        ]);
        // Adds the hashed email identifier to the user identifiers list.
        $userIdentifiers[] = $hashedPhoneNumberIdentifier;
    }

    // Checks if the record has all the required mailing address elements, and if so, adds a
    // UserIdentifier for the mailing address.
    if (array_key_exists('firstName', $rawRecord)) {
        // Checks if the record contains all the other required elements of a mailing
        // address.
        $missingAddressKeys = [];
        foreach (['lastName', 'countryCode', 'postalCode'] as $addressKey) {
            if (!array_key_exists($addressKey, $rawRecord)) {
                $missingAddressKeys[] = $addressKey;
            }
        }
        if (!empty($missingAddressKeys)) {
            printf(
                "Skipping addition of mailing address information because the "
                . "following required keys are missing: %s%s",
                json_encode($missingAddressKeys),
                PHP_EOL
            );
        } else {
            // Creates an OfflineUserAddressInfo object that contains all the required
            // elements of a mailing address.
            $addressIdentifier = new UserIdentifier([
               'address_info' => new OfflineUserAddressInfo([
                   'hashed_first_name' => self::normalizeAndHash(
                       $rawRecord['firstName'],
                       false
                   ),
                   'hashed_last_name' => self::normalizeAndHash(
                       $rawRecord['lastName'],
                       false
                   ),
                   'country_code' => $rawRecord['countryCode'],
                   'postal_code' => $rawRecord['postalCode']
               ])
            ]);
            // Adds the address identifier to the user identifiers list.
            $userIdentifiers[] = $addressIdentifier;
        }
    }
    if (!empty($userIdentifiers)) {
        // Builds the UserData and adds it to the list.
        $userDataList[] = new UserData(['user_identifiers' => $userIdentifiers]);
    }
}

// Creates the operations to add users.
$operations = array_map(
    function (UserData $userData) {
        return new OfflineUserDataJobOperation(['create' => $userData]);
    },
    $userDataList
);
      

পাইথন

def build_offline_user_data_job_operations(
    client: GoogleAdsClient,
) -> List[OfflineUserDataJobOperation]:
    """Creates a raw input list of unhashed user information.

    Each element of the list represents a single user and is a dict containing a
    separate entry for the keys "email", "phone", "first_name", "last_name",
    "country_code", and "postal_code". In your application, this data might come
    from a file or a database.

    Args:
        client: The Google Ads client.

    Returns:
        A list containing the operations.
    """
    # The first user data has an email address and a phone number.
    raw_record_1: Dict[str, str] = {
        "email": "dana@example.com",
        # Phone number to be converted to E.164 format, with a leading '+' as
        # required. This includes whitespace that will be removed later.
        "phone": "+1 800 5550101",
    }

    # The second user data has an email address, a mailing address, and a phone
    # number.
    raw_record_2: Dict[str, str] = {
        # Email address that includes a period (.) before the email domain.
        "email": "alex.2@example.com",
        # Address that includes all four required elements: first name, last
        # name, country code, and postal code.
        "first_name": "Alex",
        "last_name": "Quinn",
        "country_code": "US",
        "postal_code": "94045",
        # Phone number to be converted to E.164 format, with a leading '+' as
        # required.
        "phone": "+1 800 5550102",
    }

    # The third user data only has an email address.
    raw_record_3: Dict[str, str] = {"email": "charlie@example.com"}

    # Adds the raw records to a raw input list.
    raw_records: List[Dict[str, str]] = [
        raw_record_1,
        raw_record_2,
        raw_record_3,
    ]

    operations: List[OfflineUserDataJobOperation] = []
    # Iterates over the raw input list and creates a UserData object for each
    # record.
    for record in raw_records:
        # Creates a UserData object that represents a member of the user list.
        user_data: UserData = client.get_type("UserData")

        # Checks if the record has email, phone, or address information, and
        # adds a SEPARATE UserIdentifier object for each one found. For example,
        # a record with an email address and a phone number will result in a
        # UserData with two UserIdentifiers.

        # IMPORTANT: Since the identifier attribute of UserIdentifier
        # (https://developers.google.com/google-ads/api/reference/rpc/latest/UserIdentifier)
        # is a oneof
        # (https://protobuf.dev/programming-guides/proto3/#oneof-features), you
        # must set only ONE of hashed_email, hashed_phone_number, mobile_id,
        # third_party_user_id, or address-info. Setting more than one of these
        # attributes on the same UserIdentifier will clear all the other members
        # of the oneof. For example, the following code is INCORRECT and will
        # result in a UserIdentifier with ONLY a hashed_phone_number:

        # incorrect_user_identifier = client.get_type("UserIdentifier")
        # incorrect_user_identifier.hashed_email = "..."
        # incorrect_user_identifier.hashed_phone_number = "..."

        # The separate 'if' statements below demonstrate the correct approach
        # for creating a UserData object for a member with multiple
        # UserIdentifiers.

        # Checks if the record has an email address, and if so, adds a
        # UserIdentifier for it.
        if "email" in record:
            user_identifier: UserIdentifier = client.get_type("UserIdentifier")
            user_identifier.hashed_email = normalize_and_hash(
                record["email"], True
            )
            # Adds the hashed email identifier to the UserData object's list.
            user_data.user_identifiers.append(user_identifier)

        # Checks if the record has a phone number, and if so, adds a
        # UserIdentifier for it.
        if "phone" in record:
            user_identifier: UserIdentifier = client.get_type("UserIdentifier")
            user_identifier.hashed_phone_number = normalize_and_hash(
                record["phone"], True
            )
            # Adds the hashed phone number identifier to the UserData object's
            # list.
            user_data.user_identifiers.append(user_identifier)

        # Checks if the record has all the required mailing address elements,
        # and if so, adds a UserIdentifier for the mailing address.
        if "first_name" in record:
            required_keys = ("last_name", "country_code", "postal_code")
            # Checks if the record contains all the other required elements of
            # a mailing address.
            if not all(key in record for key in required_keys):
                # Determines which required elements are missing from the
                # record.
                missing_keys = record.keys() - required_keys
                print(
                    "Skipping addition of mailing address information "
                    "because the following required keys are missing: "
                    f"{missing_keys}"
                )
            else:
                user_identifier: UserIdentifier = client.get_type(
                    "UserIdentifier"
                )
                address_info: AddressInfo = user_identifier.address_info
                address_info.hashed_first_name = normalize_and_hash(
                    record["first_name"], False
                )
                address_info.hashed_last_name = normalize_and_hash(
                    record["last_name"], False
                )
                address_info.country_code = record["country_code"]
                address_info.postal_code = record["postal_code"]
                user_data.user_identifiers.append(user_identifier)

        # If the user_identifiers repeated field is not empty, create a new
        # OfflineUserDataJobOperation and add the UserData to it.
        if user_data.user_identifiers:
            operation: OfflineUserDataJobOperation = client.get_type(
                "OfflineUserDataJobOperation"
            )
            operation.create = user_data
            operations.append(operation)
      

রুবি

# Create a list of unhashed user data records that we will format in the
# following steps to prepare for the API.
raw_records = [
  # The first user data has an email address and a phone number.
  {
    email: 'dana@example.com',
    # Phone number to be converted to E.164 format, with a leading '+' as
    # required. This includes whitespace that will be removed later.
    phone: '+1 800 5550100',
  },
  # The second user data has an email address, a phone number, and an address.
  {
    # Email address that includes a period (.) before the Gmail domain.
    email: 'alex.2@example.com',
    # Address that includes all four required elements: first name, last
    # name, country code, and postal code.
    first_name: 'Alex',
    last_name: 'Quinn',
    country_code: 'US',
    postal_code: '94045',
    # Phone number to be converted to E.164 format, with a leading '+' as
    # required.
    phone: '+1 800 5550102',
  },
  # The third user data only has an email address.
  {
    email: 'charlie@example.com',
  },
]

# Create a UserData for each entry in the raw records.
user_data_list = raw_records.map do |record|
  client.resource.user_data do |data|
    if record[:email]
      data.user_identifiers << client.resource.user_identifier do |ui|
        ui.hashed_email = normalize_and_hash(record[:email], true)
      end
    end
    if record[:phone]
      data.user_identifiers << client.resource.user_identifier do |ui|
        ui.hashed_phone_number = normalize_and_hash(record[:phone], true)
      end
    end
    if record[:first_name]
      # Check that we have all the required information.
      missing_keys = [:last_name, :country_code, :postal_code].reject {|key|
        record[key].nil?
      }
      if missing_keys.empty?
        # If nothing is missing, add the address.
        data.user_identifiers << client.resource.user_identifier do |ui|
          ui.address_identifier = client.resource.offline_user_address_info do |address|
            address.hashed_first_name = normalize_and_hash(record[:first_name])
            address.hashed_last_name = normalize_and_hash(record[:last_name])
            address.country_code = record[:country_code]
            address.postal_code = record[:postal_code]
          end
        end
      else
        # If some data is missing, skip this entry.
        puts "Skipping addition of mailing information because the following keys are missing:" \
          "#{missing_keys}"
      end
    end
  end
end

operations = user_data_list.map do |user_data|
  client.operation.create_resource.offline_user_data_job(user_data)
end
      

পার্ল

  # The first user data has an email address and a phone number.
  my $raw_record_1 = {
    email => 'dana@example.com',
    # Phone number to be converted to E.164 format, with a leading '+' as
    # required. This includes whitespace that will be removed later.
    phone => '+1 800 5550101',
  };

  # The second user data has an email address, a mailing address, and a phone
  # number.
  my $raw_record_2 = {
    # Email address that includes a period (.) before the Gmail domain.
    email => 'alex.2@example.com',
    # Address that includes all four required elements: first name, last
    # name, country code, and postal code.
    firstName   => 'Alex',
    lastName    => 'Quinn',
    countryCode => 'US',
    postalCode  => '94045',
    # Phone number to be converted to E.164 format, with a leading '+' as
    # required.
    phone => '+1 800 5550102',
  };

  # The third user data only has an email address.
  my $raw_record_3 = {email => 'charlie@example.com',};

  my $raw_records = [$raw_record_1, $raw_record_2, $raw_record_3];

  my $operations = [];
  foreach my $record (@$raw_records) {
    # Check if the record has email, phone, or address information, and adds a
    # SEPARATE UserIdentifier object for each one found. For example, a record
    # with an email address and a phone number will result in a UserData with two
    # UserIdentifiers.
    #
    # IMPORTANT: Since the identifier attribute of UserIdentifier
    # (https://developers.google.com/google-ads/api/reference/rpc/latest/UserIdentifier)
    # is a oneof
    # (https://protobuf.dev/programming-guides/proto3/#oneof-features), you must set
    # only ONE of hashed_email, hashed_phone_number, mobile_id, third_party_user_id,
    # or address-info. Setting more than one of these attributes on the same UserIdentifier
    # will clear all the other members of the oneof. For example, the following code is
    # INCORRECT and will result in a UserIdentifier with ONLY a hashed_phone_number:
    #
    # my $incorrect_user_identifier = Google::Ads::GoogleAds::V23::Common::UserIdentifier->new({
    #   hashedEmail => '...',
    #   hashedPhoneNumber => '...',
    # });
    #
    # The separate 'if' statements below demonstrate the correct approach for creating a
    # UserData object for a member with multiple UserIdentifiers.

    my $user_identifiers = [];

    # Check if the record has an email address, and if so, add a UserIdentifier for it.
    if (defined $record->{email}) {
      # Add the hashed email identifier to the list of UserIdentifiers.
      push(
        @$user_identifiers,
        Google::Ads::GoogleAds::V23::Common::UserIdentifier->new({
            hashedEmail => normalize_and_hash($record->{email}, 1)}));
    }

    # Check if the record has a phone number, and if so, add a UserIdentifier for it.
    if (defined $record->{phone}) {
      # Add the hashed phone number identifier to the list of UserIdentifiers.
      push(
        @$user_identifiers,
        Google::Ads::GoogleAds::V23::Common::UserIdentifier->new({
            hashedPhoneNumber => normalize_and_hash($record->{phone}, 1)}));
    }

    # Check if the record has all the required mailing address elements, and if so, add
    # a UserIdentifier for the mailing address.
    if (defined $record->{firstName}) {
      my $required_keys = ["lastName", "countryCode", "postalCode"];
      my $missing_keys  = [];

      foreach my $key (@$required_keys) {
        if (!defined $record->{$key}) {
          push(@$missing_keys, $key);
        }
      }

      if (@$missing_keys) {
        print
"Skipping addition of mailing address information because the following"
          . "keys are missing: "
          . join(",", @$missing_keys);
      } else {
        push(
          @$user_identifiers,
          Google::Ads::GoogleAds::V23::Common::UserIdentifier->new({
              addressInfo =>
                Google::Ads::GoogleAds::V23::Common::OfflineUserAddressInfo->
                new({
                  # First and last name must be normalized and hashed.
                  hashedFirstName => normalize_and_hash($record->{firstName}),
                  hashedLastName  => normalize_and_hash($record->{lastName}),
                  # Country code and zip code are sent in plain text.
                  countryCode => $record->{countryCode},
                  postalCode  => $record->{postalCode},
                })}));
      }
    }

    # If the user_identifiers array is not empty, create a new
    # OfflineUserDataJobOperation and add the UserData to it.
    if (@$user_identifiers) {
      my $user_data = Google::Ads::GoogleAds::V23::Common::UserData->new({
          userIdentifiers => [$user_identifiers]});
      push(
        @$operations,
        Google::Ads::GoogleAds::V23::Services::OfflineUserDataJobService::OfflineUserDataJobOperation
          ->new({
            create => $user_data
          }));
    }
  }
      

কার্ল

ধাপ ৩: তালিকা আপলোড এবং ম্যাচ রেট যাচাই করুন

OfflineUserDataJob এর স্ট্যাটাস SUCCESS হয়ে গেলে, আনুমানিক ম্যাচ রেটটি operation_metadata.match_rate_range ফিল্ডে পাওয়া যায়। জবটি সম্পন্ন হওয়ার আগে আপনি যদি এই ফিল্ডটি কোয়েরি করেন, তাহলে এর মান শূন্য হতে পারে। আপনার ম্যাচ রেট যাচাইয়ের জন্য এবং তালিকাটি টার্গেটিংয়ের জন্য প্রস্তুত আছে কিনা তা নিশ্চিত করতে, আমরা জবটি সম্পন্ন হয়েছে কিনা তা পোল করার পরামর্শ দিই। জবটি সম্পন্ন হতে সর্বনিম্ন ১০ মিনিট থেকে সর্বোচ্চ ২৪ ঘণ্টা পর্যন্ত সময় লাগতে পারে।

কাজের অবস্থা পরীক্ষা করার কোড উদাহরণ

জাভা

private void checkJobStatus(
    GoogleAdsClient googleAdsClient, long customerId, String offlineUserDataJobResourceName) {
  try (GoogleAdsServiceClient googleAdsServiceClient =
      googleAdsClient.getLatestVersion().createGoogleAdsServiceClient()) {
    String query =
        String.format(
            "SELECT offline_user_data_job.resource_name, "
                + "offline_user_data_job.id, "
                + "offline_user_data_job.status, "
                + "offline_user_data_job.type, "
                + "offline_user_data_job.failure_reason, "
                + "offline_user_data_job.customer_match_user_list_metadata.user_list "
                + "FROM offline_user_data_job "
                + "WHERE offline_user_data_job.resource_name = '%s'",
            offlineUserDataJobResourceName);
    // Issues the query and gets the GoogleAdsRow containing the job from the response.
    GoogleAdsRow googleAdsRow =
        googleAdsServiceClient
            .search(Long.toString(customerId), query)
            .iterateAll()
            .iterator()
            .next();
    OfflineUserDataJob offlineUserDataJob = googleAdsRow.getOfflineUserDataJob();
    System.out.printf(
        "Offline user data job ID %d with type '%s' has status: %s%n",
        offlineUserDataJob.getId(), offlineUserDataJob.getType(), offlineUserDataJob.getStatus());
    OfflineUserDataJobStatus jobStatus = offlineUserDataJob.getStatus();
    if (OfflineUserDataJobStatus.SUCCESS == jobStatus) {
      // Prints information about the user list.
      printCustomerMatchUserListInfo(
          googleAdsClient,
          customerId,
          offlineUserDataJob.getCustomerMatchUserListMetadata().getUserList());
    } else if (OfflineUserDataJobStatus.FAILED == jobStatus) {
      System.out.printf("  Failure reason: %s%n", offlineUserDataJob.getFailureReason());
    } else if (OfflineUserDataJobStatus.PENDING == jobStatus
        || OfflineUserDataJobStatus.RUNNING == jobStatus) {
      System.out.println();
      System.out.printf(
          "To check the status of the job periodically, use the following GAQL query with"
              + " GoogleAdsService.search:%n%s%n",
          query);
    }
  }
}

      

সি#

private static void CheckJobStatusAndPrintResults(GoogleAdsClient client, long customerId,
    string offlineUserDataJobResourceName)
{
    // Get the GoogleAdsService.
    GoogleAdsServiceClient service = client.GetService(Services.V23.GoogleAdsService);

    string query = "SELECT offline_user_data_job.resource_name, " +
        "offline_user_data_job.id, offline_user_data_job.status, " +
        "offline_user_data_job.type, offline_user_data_job.failure_reason, " +
        "offline_user_data_job.customer_match_user_list_metadata.user_list " +
        "FROM offline_user_data_job WHERE " +
        $"offline_user_data_job.resource_name = '{offlineUserDataJobResourceName}'";

    // Issues the query and gets the GoogleAdsRow containing the job from the response.
    GoogleAdsRow googleAdsRow = service.Search(customerId.ToString(), query).First();

    OfflineUserDataJob offlineUserDataJob = googleAdsRow.OfflineUserDataJob;
    Console.WriteLine($"Offline user data job ID {offlineUserDataJob.Id} with type " +
        $"'{offlineUserDataJob.Type}' has status: {offlineUserDataJob.Status}");

    switch (offlineUserDataJob.Status)
    {
        case OfflineUserDataJobStatus.Success:
            // Prints information about the user list.
            PrintCustomerMatchUserListInfo(client, customerId,
                offlineUserDataJob.CustomerMatchUserListMetadata.UserList);
            break;

        case OfflineUserDataJobStatus.Failed:
            Console.WriteLine($"  Failure reason: {offlineUserDataJob.FailureReason}");
            break;

        case OfflineUserDataJobStatus.Pending:
        case OfflineUserDataJobStatus.Running:
            Console.WriteLine("To check the status of the job periodically, use the " +
                $"following GAQL query with GoogleAdsService.search:\n\n{query}");
            break;
    }
}
      

পিএইচপি

private static function checkJobStatus(
    GoogleAdsClient $googleAdsClient,
    int $customerId,
    string $offlineUserDataJobResourceName
) {
    $googleAdsServiceClient = $googleAdsClient->getGoogleAdsServiceClient();

    // Creates a query that retrieves the offline user data job.
    $query = "SELECT offline_user_data_job.resource_name, "
          . "offline_user_data_job.id, "
          . "offline_user_data_job.status, "
          . "offline_user_data_job.type, "
          . "offline_user_data_job.failure_reason, "
          . "offline_user_data_job.customer_match_user_list_metadata.user_list "
          . "FROM offline_user_data_job "
          . "WHERE offline_user_data_job.resource_name = '$offlineUserDataJobResourceName'";

    // Issues a search request to get the GoogleAdsRow containing the job from the response.
    /** @var GoogleAdsRow $googleAdsRow */
    $googleAdsRow =
        $googleAdsServiceClient->search(SearchGoogleAdsRequest::build($customerId, $query))
            ->getIterator()
            ->current();
    $offlineUserDataJob = $googleAdsRow->getOfflineUserDataJob();

    // Prints out some information about the offline user data job.
    $offlineUserDataJobStatus = $offlineUserDataJob->getStatus();
    printf(
        "Offline user data job ID %d with type '%s' has status: %s.%s",
        $offlineUserDataJob->getId(),
        OfflineUserDataJobType::name($offlineUserDataJob->getType()),
        OfflineUserDataJobStatus::name($offlineUserDataJobStatus),
        PHP_EOL
    );

    if ($offlineUserDataJobStatus === OfflineUserDataJobStatus::SUCCESS) {
        // Prints information about the user list.
        self::printCustomerMatchUserListInfo(
            $googleAdsClient,
            $customerId,
            $offlineUserDataJob->getCustomerMatchUserListMetadata()->getUserList()
        );
    } elseif ($offlineUserDataJobStatus === OfflineUserDataJobStatus::FAILED) {
        printf("  Failure reason: %s.%s", $offlineUserDataJob->getFailureReason(), PHP_EOL);
    } elseif (
        $offlineUserDataJobStatus === OfflineUserDataJobStatus::PENDING
        || $offlineUserDataJobStatus === OfflineUserDataJobStatus::RUNNING
    ) {
        printf(
            '%1$sTo check the status of the job periodically, use the following GAQL query with'
            . ' GoogleAdsService.search:%1$s%2$s%1$s',
            PHP_EOL,
            $query
        );
    }
}
      

পাইথন

def check_job_status(
    client: GoogleAdsClient,
    customer_id: str,
    offline_user_data_job_resource_name: str,
) -> None:
    """Retrieves, checks, and prints the status of the offline user data job.

    If the job is completed successfully, information about the user list is
    printed. Otherwise, a GAQL query will be printed, which can be used to
    check the job status at a later date.

    Offline user data jobs may take 6 hours or more to complete, so checking the
    status periodically, instead of waiting, can be more efficient.

    Args:
        client: The Google Ads client.
        customer_id: The ID for the customer that owns the user list.
        offline_user_data_job_resource_name: The resource name of the offline
            user data job to get the status of.
    """
    query: str = f"""
        SELECT
          offline_user_data_job.resource_name,
          offline_user_data_job.id,
          offline_user_data_job.status,
          offline_user_data_job.type,
          offline_user_data_job.failure_reason,
          offline_user_data_job.customer_match_user_list_metadata.user_list
        FROM offline_user_data_job
        WHERE offline_user_data_job.resource_name =
          '{offline_user_data_job_resource_name}'
        LIMIT 1"""

    # Issues a search request using streaming.
    google_ads_service: GoogleAdsServiceClient = client.get_service(
        "GoogleAdsService"
    )
    results: SearchGoogleAdsStreamResponse = google_ads_service.search(
        customer_id=customer_id, query=query
    )
    offline_user_data_job_result: OfflineUserDataJob = next(
        iter(results)
    ).offline_user_data_job
    status_name: str = offline_user_data_job_result.status.name
    user_list_resource_name: str = (
        offline_user_data_job_result.customer_match_user_list_metadata.user_list
    )

    print(
        f"Offline user data job ID '{offline_user_data_job_result.id}' with type "
        f"'{offline_user_data_job_result.type_.name}' has status: {status_name}"
    )

    if status_name == "SUCCESS":
        print_customer_match_user_list_info(
            client, customer_id, user_list_resource_name
        )
    elif status_name == "FAILED":
        print(
            f"\tFailure Reason: {offline_user_data_job_result.failure_reason}"
        )
    elif status_name in ("PENDING", "RUNNING"):
        print(
            "To check the status of the job periodically, use the following "
            f"GAQL query with GoogleAdsService.Search: {query}"
        )
      

রুবি

def check_job_status(client, customer_id, offline_user_data_job)
  query = <<~QUERY
    SELECT
      offline_user_data_job.id,
      offline_user_data_job.status,
      offline_user_data_job.type,
      offline_user_data_job.failure_reason,
      offline_user_data_job.customer_match_user_list_metadata.user_list
    FROM
      offline_user_data_job
    WHERE
      offline_user_data_job.resource_name = '#{offline_user_data_job}'
  QUERY

  row = client.service.google_ads.search(
    customer_id: customer_id,
    query: query,
  ).first

  job = row.offline_user_data_job
  puts "Offline user data job ID #{job.id} with type '#{job.type}' has status: #{job.status}."

  case job.status
  when :SUCCESS
    print_customer_match_user_list(client, customer_id, job.customer_match_user_list_metadata.user_list)
  when :FAILED
    puts "  Failure reason: #{job.failure_reason}"
  else
    puts "  To check the status of the job periodically, use the following GAQL " \
      "query with GoogleAdsService.search:"
    puts query
  end
end
      

পার্ল

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

  my $search_query =
    "SELECT offline_user_data_job.resource_name, " .
    "offline_user_data_job.id, offline_user_data_job.status, " .
    "offline_user_data_job.type, offline_user_data_job.failure_reason, " .
    "offline_user_data_job.customer_match_user_list_metadata.user_list " .
    "FROM offline_user_data_job " .
    "WHERE offline_user_data_job.resource_name = " .
    "'$offline_user_data_job_resource_name' LIMIT 1";

  my $search_request =
    Google::Ads::GoogleAds::V23::Services::GoogleAdsService::SearchGoogleAdsRequest
    ->new({
      customerId => $customer_id,
      query      => $search_query
    });

  # Get the GoogleAdsService.
  my $google_ads_service = $api_client->GoogleAdsService();

  my $iterator = Google::Ads::GoogleAds::Utils::SearchGoogleAdsIterator->new({
    service => $google_ads_service,
    request => $search_request
  });

  # The results have exactly one row.
  my $google_ads_row        = $iterator->next;
  my $offline_user_data_job = $google_ads_row->{offlineUserDataJob};
  my $status                = $offline_user_data_job->{status};

  printf
    "Offline user data job ID %d with type %s has status: %s.\n",
    $offline_user_data_job->{id},
    $offline_user_data_job->{type},
    $status;

  if ($status eq SUCCESS) {
    print_customer_match_user_list_info($api_client, $customer_id,
      $offline_user_data_job->{customerMatchUserListMetadata}{userList});
  } elsif ($status eq FAILED) {
    print "Failure reason: $offline_user_data_job->{failureReason}";
  } elsif (grep /$status/, (PENDING, RUNNING)) {
    print
      "To check the status of the job periodically, use the following GAQL " .
      "query with the GoogleAdsService->search() method:\n$search_query\n";
  }

  return 1;
}
      

কার্ল

তালিকার আকার যাচাই করতে, আপনি user_list রিসোর্সটি কোয়েরি করতে পারেন।

user_list রিসোর্সটি কোয়েরি করার কোড উদাহরণ

জাভা

try (GoogleAdsServiceClient googleAdsServiceClient =
    googleAdsClient.getLatestVersion().createGoogleAdsServiceClient()) {
  // Creates a query that retrieves the user list.
  String query =
      String.format(
          "SELECT user_list.size_for_display, user_list.size_for_search "
              + "FROM user_list "
              + "WHERE user_list.resource_name = '%s'",
          userListResourceName);

  // Constructs the SearchGoogleAdsStreamRequest.
  SearchGoogleAdsStreamRequest request =
      SearchGoogleAdsStreamRequest.newBuilder()
          .setCustomerId(Long.toString(customerId))
          .setQuery(query)
          .build();

  // Issues the search stream request.
  ServerStream<SearchGoogleAdsStreamResponse> stream =
      googleAdsServiceClient.searchStreamCallable().call(request);
      

সি#

 // Get the GoogleAdsService.
 GoogleAdsServiceClient service =
     client.GetService(Services.V23.GoogleAdsService);

 // Creates a query that retrieves the user list.
 string query =
     "SELECT user_list.size_for_display, user_list.size_for_search " +
     "FROM user_list " +
     $"WHERE user_list.resource_name = '{userListResourceName}'";
 // Issues a search stream request.
 service.SearchStream(customerId.ToString(), query,
    delegate (SearchGoogleAdsStreamResponse resp)
    {
        // Display the results.
        foreach (GoogleAdsRow userListRow in resp.Results)
        {
            UserList userList = userListRow.UserList;
            Console.WriteLine("The estimated number of users that the user list " +
                $"'{userList.ResourceName}' has is {userList.SizeForDisplay}" +
                $" for Display and {userList.SizeForSearch} for Search.");
        }
    }
);
      

পিএইচপি

$googleAdsServiceClient = $googleAdsClient->getGoogleAdsServiceClient();

// Creates a query that retrieves the user list.
$query =
    "SELECT user_list.size_for_display, user_list.size_for_search " .
    "FROM user_list " .
    "WHERE user_list.resource_name = '$userListResourceName'";

// Issues a search stream request.
/** @var GoogleAdsServerStreamDecorator $stream */
$stream = $googleAdsServiceClient->searchStream(
    SearchGoogleAdsStreamRequest::build($customerId, $query)
);
      

পাইথন

googleads_service_client: GoogleAdsServiceClient = client.get_service(
    "GoogleAdsService"
)

# Creates a query that retrieves the user list.
query: str = f"""
    SELECT
      user_list.size_for_display,
      user_list.size_for_search
    FROM user_list
    WHERE user_list.resource_name = '{user_list_resource_name}'"""

# Issues a search request.
search_results: SearchGoogleAdsStreamResponse = (
    googleads_service_client.search(customer_id=customer_id, query=query)
)
      

রুবি

query = <<~EOQUERY
  SELECT user_list.size_for_display, user_list.size_for_search
  FROM user_list
  WHERE user_list.resource_name = #{user_list}
EOQUERY

response = client.service.google_ads.search_stream(
  customer_id: customer_id,
  query: query,
)
      

পার্ল

# Create a query that retrieves the user list.
my $search_query =
  "SELECT user_list.size_for_display, user_list.size_for_search " .
  "FROM user_list " .
  "WHERE user_list.resource_name = '$user_list_resource_name'";

# Create a search Google Ads stream request that will retrieve the user list.
my $search_stream_request =
  Google::Ads::GoogleAds::V23::Services::GoogleAdsService::SearchGoogleAdsStreamRequest
  ->new({
    customerId => $customer_id,
    query      => $search_query,
  });

# Get the GoogleAdsService.
my $google_ads_service = $api_client->GoogleAdsService();

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

কার্ল

গোপনীয়তার স্বার্থে, তালিকায় কমপক্ষে ১০০ জন সদস্য না হওয়া পর্যন্ত ব্যবহারকারীর তালিকার আকার শূন্য দেখানো হয়। এরপর, আকারটিকে নিকটতম দুটি সার্থক অঙ্কে পূর্ণসংখ্যায় রূপান্তর করা হয়।

একটি OfflineUserDataJob নির্বাহ করার সময়কার ত্রুটিগুলো Google Ads Query Language ব্যবহার করে offline_user_data_job রিসোর্সের মাধ্যমে সংগ্রহ করা যেতে পারে। তবে, মনে রাখবেন যে এই রিপোর্টে কোনো ব্যর্থ ম্যাচ সম্পর্কিত তথ্য থাকে না, কারণ ম্যাচ করার সময় শুধুমাত্র হ্যাশ তুলনা করা হয়। আপনার গ্রাহক তালিকা নিয়ে কোনো সমস্যা হলে ট্রাবলশুটিং গাইডটি দেখুন।

গুগল অ্যাডস UI এর সাথে তুলনা করুন

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

যেহেতু একটি তালিকা সদস্যদের দ্বারা পূর্ণ হতে ২৪ ঘণ্টা পর্যন্ত সময় লাগতে পারে, তাই আপনি যদি প্রতি ১২ ঘণ্টায় একবারের চেয়ে বেশি ঘন ঘন কোনো অডিয়েন্স তালিকায় আপলোড করেন, তাহলে Google Ads UI-তে ' In Progress স্ট্যাটাস দেখতে পারেন।

ধাপ ৪: আপনার তালিকাটিকে লক্ষ্য করুন

আপনি অ্যাড গ্রুপ লেভেলে অথবা ক্যাম্পেইন লেভেলে আপনার লিস্টকে টার্গেট করতে পারেন। এই প্রক্রিয়াটি API-এর অন্যান্য ধরনের টার্গেটিং ক্রাইটেরিয়ার মতোই।

অ্যাড গ্রুপে ব্যবহারকারীদের তালিকায় বিজ্ঞাপন টার্গেট করার কোড উদাহরণ

জাভা

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

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

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

      

সি#

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

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

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

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

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

পিএইচপি

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

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

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

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

    return $adGroupCriterionResourceName;
}
      

পাইথন

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

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

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

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

রুবি

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

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

  ad_group_criterion_resource_name
end
      

পার্ল

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

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

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

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

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

  return $ad_group_criterion_resource_name;
}
      

কার্ল

একাধিক গ্রাহক তালিকা লক্ষ্য করুন

একটি crm_based_user_list শুধুমাত্র একটি logical_user_list ব্যবহার করার সময় অন্য একটি crm_based_user_list সাথে একত্রিত করা যেতে পারে। crm_based_user_list জন্য প্রযোজ্য সমস্ত নীতিমালা ফলস্বরূপ ব্যবহারকারী তালিকাটির উপর প্রযোজ্য হবে।

আপনার তালিকাগুলি পরিচালনা ও হালনাগাদ করুন

আপনার গ্রাহক তালিকা তৈরি করার পরে, গ্রাহক সংখ্যায় পরিবর্তন প্রতিফলিত করতে আপনাকে সম্ভবত পর্যায়ক্রমে সেগুলি আপডেট করতে হবে। গুগল অ্যাডস এপিআই আপনাকে সদস্য যোগ বা অপসারণ করে আপনার বিদ্যমান তালিকাগুলি পরিচালনা করার সুযোগ দেয়।

আপনার তালিকা আপডেট করার জন্য প্রধান কার্যক্রমগুলো হলো:

  • নতুন ব্যবহারকারী যুক্ত করুন: বিদ্যমান তালিকায় নতুন গ্রাহকের তথ্য যোগ করুন।
  • নির্দিষ্ট ব্যবহারকারীদের অপসারণ করুন: শনাক্তকারীর ভিত্তিতে তালিকা থেকে স্বতন্ত্র ব্যবহারকারীদের অপসারণ করুন।
  • সকল সদস্য প্রতিস্থাপন করুন: বিদ্যমান তালিকাটি খালি করুন এবং এর সমস্ত বিষয়বস্তু সম্পূর্ণরূপে প্রতিস্থাপন করুন, যদিও এর পরিবর্তে নতুন সদস্য যুক্ত করা এবং অপসারণ করার পরামর্শ দেওয়া হয়।

গ্রাহক তালিকা পরিচালনা দেখুন।