আপনি Google Ads API ব্যবহার করে অফলাইন কনভার্সন Google Ads-এ ইমপোর্ট করতে পারবেন। এর ফলে, আপনি সেইসব বিজ্ঞাপন ট্র্যাক করতে পারবেন যেগুলি অফলাইন দুনিয়ায় বিক্রি বাড়াতে সাহায্য করেছে, যেমন ফোন বা বিক্রয় প্রতিনিধির মাধ্যমে।
কনভার্সন ডেটা ইমপোর্ট করার সুবিধা সম্পূর্ণভাবে উপভোগ করতে, আমরা লিডের জন্য Enhanced Conversions প্রয়োগ করার সাজেশন দিই, যা স্থায়িত্ব ও পারফর্ম্যান্স সর্বাধিক করতে GCLID এবং ব্যবহারকারীর প্রদান করা ডেটা ব্যবহার করে।
উন্নত কনভার্সন
Enhanced conversions, ইমেল আইডি, ফোন নম্বর ও মেইলিং অ্যাড্রেসের মতো ফার্স্ট-পার্টি কনভার্সন ডেটার সাথে আপনার কনভার্সন যোগ করে, কনভার্সন ট্র্যাক করার ক্ষেত্রে নির্ভুলতা আরও উন্নত করতে সাহায্য করে।
Enhanced conversions দুই ধরনের হয়। আরও জানতে, Enhanced conversions সম্পর্কে দেখুন।
নিম্নলিখিত বিভাগে অফলাইন কনভার্সন কীভাবে উন্নত করা যায় তা ব্যাখ্যা করা হয়েছে, এই ফিচারকে লিডের জন্য উন্নত কনভার্সনও বলা হয়।
লিডের জন্য Enhanced Conversions কী?
লিডের জন্য উন্নত কনভার্সন হল অফলাইন কনভার্সন ইম্পোর্টের একটি আপগ্রেড করা ভার্সন যা ব্যবহারকারীর দেওয়া ডেটা, যেমন ইমেল আইডি ব্যবহার করে, যাতে ইম্পোর্ট করা অফলাইন কনভার্সন ডেটা আরও নিখুঁত হয় এবং বিডিং পারফর্ম্যান্স উন্নত হয়। আপনি অফলাইন কনভার্সন ইম্পোর্ট করলে, আপনার ওয়েবসাইটে সংগ্রহ করা একই ডেটার সাথে ম্যাচ করে Google Ads ক্যাম্পেনে অ্যাট্রিবিউট করার জন্য গ্রাহকের হ্যাশ করা ডেটা ব্যবহার করা হয়। যেমন, লিড ফর্ম এবং আপনার বিজ্ঞাপনের সাথে ইন্টার্যাক্ট করা সাইন-ইন করা গ্রাহক। আরও তথ্যের জন্য, লিডের জন্য উন্নত কনভার্সন সম্পর্কে দেখুন।
আপনার ওয়েবপেজে ফর্ম জমা দেওয়ার ইভেন্ট ট্র্যাক করার জন্য Google ট্যাগ ব্যবহার করেন কিনা তার উপর নির্ভর করে, লিডের জন্য উন্নত কনভার্সন প্রয়োগ করার দুটি উপায় আছে। সেরা পারফর্ম্যান্স ও স্থায়িত্বের জন্য, লিডের উন্নত কনভার্সনের জন্য আমরা Google ট্যাগ ব্যবহার করার সাজেশন দিই।
- আপনি যদি একদম শুরু থেকে শুরু করেন, তাহলে প্রয়োজনীয়তা বিভাগ থেকে শুরু করুন।
- আপনি যদি আগে থেকেই অফলাইন কনভার্সন ইমপোর্ট সেট-আপ করে থাকেন এবং লিডের জন্য উন্নত কনভার্সনে আপগ্রেড করতে চান, তাহলে আমরা ট্যাগিং কনফিগার করুন বিভাগ থেকে শুরু করার সাজেশন দিই।
- আপনি যদি আগে থেকেই Google ট্যাগ সেট-আপ করে থাকেন অথবা Google ট্যাগ ব্যবহার করার পরিকল্পনা না করেন, এবং আপনার Google Ads API ইন্টিগ্রেশনের কাজ শুরু করেন, তাহলে API প্রয়োগ বিভাগে যান।
- আপনি ব্যবহারকারীর প্রদান করা ডেটা ইম্পোর্ট করতে না পারলে অথবা আপনার কনভার্সনের জন্য এক্সটার্নাল অ্যাট্রিবিউশনের উপর নির্ভর করলে, পুরনো অফলাইন কনভার্সন ইম্পোর্ট সংক্রান্ত গাইড দেখুন।
পূর্বশর্ত
প্রথমে, আমাদের শুরু করা যাক বিভাগে উল্লেখ করা ধাপগুলি সম্পূর্ণ করেছেন কিনা তা যাচাই করুন।
লিডের জন্য উন্নত কনভার্সন ব্যবহার করার আগে আপনাকে উন্নত কনভার্সন চালু করতে হবে এবং গ্রাহক ডেটা সংক্রান্ত শর্তাবলীতে সম্মতি জানাতে হবে। Google Ads কনভার্সন কাস্টমারকে নিম্নলিখিত কোয়েরি ইস্যু করে আপনি যাচাই করতে পারবেন যে এইসব প্রয়োজনীয়তা আগে থেকেই পূরণ করা হয়েছে কিনা:
SELECT
customer.id,
customer.conversion_tracking_setting.accepted_customer_data_terms,
customer.conversion_tracking_setting.enablement_setting,
customer.conversion_tracking_setting.effective_enablement_setting
FROM customer
accepted_customer_data_terms যদি false হয় অথবা enablement_setting
(বা ক্রস-অ্যাকাউন্ট কনভার্সন ট্র্যাকিং ব্যবহার করার সময় effective_enablement_setting)
যদি ON না হয়, তাহলে এইসব পূর্বশর্ত পূরণ করতে
নতুন কনভার্সন অ্যাকশন তৈরি করুন লিঙ্কে দেওয়া
নির্দেশাবলী অনুসরণ করুন।
ট্যাগিং কনফিগার করুন
Google ট্যাগ সেটিংস কনফিগার করুন সংক্রান্ত নির্দেশাবলী অনুসরণ করে লিডের জন্য উন্নত কনভার্সন চালু করতে Google ট্যাগ কনফিগার করুন। Google Tag Manager-এর মাধ্যমে লিডের জন্য উন্নত কনভার্সন সেট-আপ করতে, এইসব Google Tag Manager সংক্রান্ত নির্দেশাবলী অনুসরণ করুন।
API প্রয়োগ করা
Google Ads API ব্যবহার করে লিডের জন্য উন্নত কনভার্সন ইম্পোর্ট করার সামগ্রিক ফ্লো এখানে দেওয়া হল।
ইমেল আইডি ও ফোন নম্বরের মতো ব্যবহারকারীর প্রদান করা ডেটা নরমালাইজ ও হ্যাশ করুন।
ClickConversionঅবজেক্ট ব্যবহারকারীর দেওয়া নরমালাইজড ও হ্যাশ করা ডেটা দিয়ে ভরে দিন।ConversionUploadServiceব্যবহার করে Google Ads API-তেClickConversionটি অবজেক্ট ইম্পোর্ট করুন। আরও বিবরণের জন্যUploadClickConversionsদেখুন।
Request and ClickConversion স্কিমা সংক্রান্ত সারসংক্ষেপ
লিডের জন্য উন্নত কনভার্সনের ক্ষেত্রে
UploadClickConversionsRequest এবং
ClickConversion-এর মূল ফিল্ডের বিবরণ নিচে দেওয়া হল (সম্পূর্ণ ফিল্ডের বিবরণ জানতে
ClickConversion অবজেক্ট পপুলেট করুন এবং
অনুরোধ তৈরি করুন দেখুন):
| খেতের মধ্য দিয়ে রাস্তা | এই ব্যাজ অর্জন করার জন্য প্রয়োজনীয় যোগ্যতা | ফর্ম্যাট ও সীমাবদ্ধতা |
|---|---|---|
customer_id |
প্রয়োজনীয় | হাইফেন ছাড়া Google Ads কনভার্সন কাস্টমার আইডি (google_ads_conversion_customer-এর মধ্যে customer.conversion_tracking_setting) হিসেবে সেট করুন। |
partial_failure |
প্রয়োজনীয় | এটি true-এ সেট করতে হবে যাতে সঠিক কনভার্সন ইমপোর্ট করা যায় এবং সারি-লেভেল সমস্যা partial_failure_error-এ ফেরত পাঠানো যায়। |
validate_only |
ঐচ্ছিক | true হলে, কনভার্সন ইমপোর্ট না করেই অনুরোধ যাচাই করে (partial_failure_error-এ যাচাইকরণ সংক্রান্ত কোনও সমস্যা থাকলে তা দেখায়)। |
job_id |
ঐচ্ছিক | job_summaries-এ একটি লজিক্যাল কাজের অধীনে একাধিক অনুরোধ গ্রুপ করতে পজিটিভ int32 (1 থেকে 2^31 - 1)। |
conversions[].conversion_action |
প্রয়োজনীয় | type = UPLOAD_CLICKS সহ ENABLED কনভার্সন অ্যাকশনের রিসোর্স নাম (customers/{conversion_customer_id}/conversionActions/{action_id})। |
conversions[].conversion_date_time |
প্রয়োজনীয় | ক্লিক করার সময়ের পরে হতে হবে এবং টাইমজোন অফসেট অন্তর্ভুক্ত করতে হবে: yyyy-mm-dd HH:mm:ss+|-HH:mm (যেমন, 2026-06-01 14:30:00-04:00)। |
conversions[].conversion_value ও currency_code |
সাজেস্ট করা হয়েছে | সংখ্যাসূচক কনভার্সন ভ্যালু (double) এবং ৩-অক্ষরের ISO 4217 মুদ্রার কোড (যেমন, USD)। |
conversions[].order_id |
সাজেস্ট করা হয়েছে | ডুপ্লিকেট ইম্পোর্ট প্রতিরোধ করতে এবং ভবিষ্যতে অ্যাডজাস্টমেন্ট করার জন্য প্রতিটি কনভার্সন অ্যাকশনের জন্য অনন্য ট্রানজ্যাকশন আইডি। |
conversions[].gclid / gbraid / wbraid |
উপলভ্য হলে সাজেস্ট করা হয় | ল্যান্ডিং পৃষ্ঠার URL থেকে ক্লিক শনাক্তকারী ক্যাপচার করা হয়েছে। আপনার ক্যাপচার করা প্রতিটি শনাক্তকারী সেট করুন। একাধিক শনাক্তকারী থাকলে, Google Ads প্রথমে gclid, তারপর wbraid এবং তারপর gbraid ব্যবহার করে। user_identifiers উপলভ্য হলে তার সাথে gclid অন্তর্ভুক্ত করুন। আপনি gclid ছাড়া wbraid বা gbraid সেট করলে, Google Ads user_identifiers ফিল্ডটি উপেক্ষা করে। |
conversions[].user_identifiers[] |
লিডের জন্য উন্নত কনভার্সনের ক্ষেত্রে প্রয়োজন | কনভার্সন প্রতি এক থেকে পাঁচটি UserIdentifier অবজেক্ট। ঐচ্ছিক user_identifier_source ফিল্ড (যেমন FIRST_PARTY) এবং hashed_email ফিল্ড (ট্রিম করা, ছোট হাতের অক্ষরে, gmail.com ও googlemail.com-এর জন্য @-এর আগে ডট ও + প্রত্যয় সরিয়ে দেওয়া, SHA-256 হেক্স) অথবা hashed_phone_number ফিল্ড (E.164 ফর্ম্যাট, SHA-256 হেক্স) সেট করুন। ব্যবহারকারীর দেওয়া ডেটা নরমালাইজ ও হ্যাশ করা দেখুন। address_info ফিল্ড কাজ করে না। |
conversions[].consent.ad_user_data |
সাজেস্ট করা হয়েছে | Consent অবজেক্টে GRANTED বা DENIED-এ সেট করুন। (ad_personalization ফিল্ডটি শুধুমাত্র OfflineUserDataJobService এবং UserDataService পরিষেবায় কাজ করে।) |
conversions[].custom_variables ও external_attribution_data |
user_identifiers-এর সাথে সেট করবেন না |
user_identifiers আছে এমন কনভার্সনে custom_variables বা external_attribution_data ফিল্ড সেট করবেন না, অন্যথায় Google Ads ব্যবহারকারীর প্রদান করা ডেটা উপেক্ষা করবে। এক্সটার্নাল অ্যাট্রিবিউশন কনভার্সন অ্যাকশনের জন্য শুধু user_identifiers সহ কনভার্সন EXTERNALLY_ATTRIBUTED_CONVERSION_ACTION_NOT_PERMITTED_WITH_USER_IDENTIFIER সমস্যার মেসেজ দেখায়। |
আপনার কনভার্সন অ্যাকশন রিসোর্সের নাম ফিরিয়ে আনুন
কনভার্সন আপলোড করতে, আপনাকে অবশ্যই
ConversionAction-এর রিসোর্স নাম উল্লেখ করতে হবে যা আপনি ক্লিক কনভার্সন ইমপোর্ট করার জন্য Google Ads-এ সেট-আপ করেছেন। আপনি নিম্নলিখিত GAQL কোয়েরি ব্যবহার করে
conversion_action রিসোর্স কোয়েরি করার মাধ্যমে রিসোর্সের নাম খুঁজে পেতে পারেন:
SELECT
customer.id,
conversion_action.id,
conversion_action.name,
conversion_action.type,
conversion_action.resource_name
FROM conversion_action
WHERE conversion_action.type = 'UPLOAD_CLICKS'
AND conversion_action.status = 'ENABLED'
ব্যবহারকারীর দেওয়া ডেটা নরমালাইজ ও হ্যাশ করা
গোপনীয়তার কথা মাথায় রেখে, ইমপোর্ট করার আগে নিম্নলিখিত ডেটা SHA-256 ব্যবহার করে হ্যাশ করতে হবে:
- ইমেল আইডি
- ফোন নম্বর
- নাম (Data Manager API এবং
ConversionAdjustmentUploadServiceপরিষেবার জন্য) - পদবি (Data Manager API এবং
ConversionAdjustmentUploadServiceপরিষেবার জন্য) - রাস্তার ঠিকানা (Data Manager API এবং
ConversionAdjustmentUploadServiceপরিষেবার জন্য)
নিম্নলিখিত ডাক ঠিকানার ফিল্ডগুলি হ্যাশ করবেন না (Data Manager API এবং ConversionAdjustmentUploadService পরিষেবার সাথে ব্যবহার করা হয়):
- দেশ
- রাজ্য
- শহর
- পিন কোড
হ্যাশ ফলাফল স্ট্যান্ডার্ডাইজ করতে, এই প্রতিটি ভ্যালু হ্যাশ করার আগে নিম্নলিখিত কাজগুলি করুন:
- শুরু ও শেষের হোয়াইটস্পেস সরিয়ে দিন।
- টেক্সট ছোট হাতের অক্ষরে পরিবর্তন করুন।
- E.164 স্ট্যান্ডার্ড অনুযায়ী ফোন নম্বর ফর্ম্যাট করুন।
Enhanced Conversions-এর জন্য ইমেল আইডি ফর্ম্যাট করা
উন্নত কনভার্সনের জন্য সর্বোচ্চ ম্যাচ রেট নিশ্চিত করতে, আপনাকে অবশ্যই নিম্নলিখিত ধাপগুলি ব্যবহার করে ইমেল আইডি সঠিকভাবে ফর্ম্যাট এবং হ্যাশ করতে হবে:
স্ট্যান্ডার্ড নরমালাইজেশন প্রয়োগ করুন (সব ইমেল আইডি):
- ASCII হোয়াইটস্পেসের শুরুতে ও শেষে থাকা যেকোনও অক্ষর সরিয়ে দিন।
- ইমেল আইডির সব অক্ষর ছোট হাতের অক্ষরে লিখুন।
ডোমেন-নির্দিষ্ট নরমালাইজেশন (শুধুমাত্র
gmail.comএবংgooglemail.com) প্রয়োগ করুন:- ইমেল আইডি ছোট হাতের অক্ষরে লেখার পরে, ডোমেন (
@চিহ্নের পরে)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করা হয়েছে।
- যেমন:
- ইমেল আইডি ছোট হাতের অক্ষরে লেখার পরে, ডোমেন (
নর্মালাইজ করা ইমেল আইডি হ্যাশ করুন:
- নর্মালাইজ করা ইমেল স্ট্রিং UTF-8 বাইট হিসেবে এনকোড করুন।
- SHA-256 অ্যালগরিদম ব্যবহার করে UTF-8 বাইট হ্যাশ করুন।
- ফলাফল হিসেবে পাওয়া ডাইজেস্টকে ছোট হাতের হেক্সাডেসিমাল স্ট্রিং (৬৪টি অক্ষর) হিসেবে ফর্ম্যাট করুন।
import hashlib
import re
def normalize_and_hash_email(email: str) -> str:
"""Normalizes and SHA-256 hashes an email address for enhanced conversions."""
normalized = email.strip().lower()
parts = normalized.split("@")
if len(parts) != 2:
raise ValueError("Invalid email address format.")
username, domain = parts
if domain in ("gmail.com", "googlemail.com"):
username = username.replace(".", "")
username = re.sub(r"\+.*$", "", username)
normalized = f"{username}@{domain}"
return hashlib.sha256(normalized.encode("utf-8")).hexdigest()
কোডের উদাহরণ
ব্যবহারকারীর দেওয়া ডেটা কীভাবে নর্ম্যালাইজ ও হ্যাশ করতে হয় তা এই উদাহরণে দেখানো হয়েছে।
Java
private String normalizeAndHash(MessageDigest digest, String s) throws UnsupportedEncodingException { // Normalizes by first converting all characters to lowercase, then trimming spaces. String normalized = s.toLowerCase(); // Removes leading, trailing, and intermediate spaces. normalized = normalized.replaceAll("\\s+", ""); // Hashes the normalized string using the hashing algorithm. byte[] hash = digest.digest(normalized.getBytes("UTF-8")); StringBuilder result = new StringBuilder(); for (byte b : hash) { result.append(String.format("%02x", b)); } return result.toString(); } /** * Returns the result of normalizing and hashing an email address. For this use case, Google Ads * requires removal of any '.' characters or trailing '+' and characters that follow it from the * username portion of the email address if the domain is {@code gmail.com} or {@code * googlemail.com}. * * @param digest the digest to use to hash the normalized string. * @param emailAddress the email address to normalize and hash. */ private String normalizeAndHashEmailAddress(MessageDigest digest, String emailAddress) throws UnsupportedEncodingException { // Removes all whitespace (leading, trailing, and intermediate) from the email address. String normalizedEmail = emailAddress.toLowerCase().replaceAll("\\s+", ""); String[] emailParts = normalizedEmail.split("@", 2); if (emailParts.length == 2 && emailParts[1].matches("^(gmail|googlemail)\\.com$")) { // Removes any '.' characters from the portion of the email address before the domain if the // domain is gmail.com or googlemail.com. emailParts[0] = emailParts[0].replaceAll("\\.", ""); // Removes any '+' and all characters that follow it from the portion of the email address // before the domain if the domain is gmail.com or googlemail.com. emailParts[0] = emailParts[0].replaceAll("\\+.*", ""); normalizedEmail = String.format("%s@%s", emailParts[0], emailParts[1]); } return normalizeAndHash(digest, normalizedEmail); } /** * Returns the result of normalizing and hashing a phone number. For this use case, Google Ads * requires phone numbers to be in E.164 format. * * @param digest the digest to use to hash the normalized string. * @param phoneNumber the phone number to normalize and hash. */ private String normalizeAndHashPhoneNumber(MessageDigest digest, String phoneNumber) throws UnsupportedEncodingException { // Removes non-digit characters and prepends a leading '+' sign. String digitsOnly = phoneNumber.replaceAll("[^0-9]", ""); String formattedPhone = "+" + digitsOnly; if (!formattedPhone.matches("^\\+[1-9]\\d{6,14}$")) { throw new IllegalArgumentException("Phone number must be in E.164 format: " + phoneNumber); } return normalizeAndHash(digest, formattedPhone); }
C#
/// <summary> /// Normalizes the email address and hashes it. For this use case, Google Ads requires /// removal of any '.' characters preceding <code>gmail.com</code> or /// <code>googlemail.com</code>. /// </summary> /// <param name="emailAddress">The email address.</param> /// <returns>The hash code.</returns> private string NormalizeAndHashEmailAddress(string emailAddress) { string normalizedEmail = emailAddress.ToLower(); string[] emailParts = normalizedEmail.Split('@'); if (emailParts.Length > 1 && (emailParts[1] == "gmail.com" || emailParts[1] == "googlemail.com")) { // Removes any '.' characters from the portion of the email address before // the domain if the domain is gmail.com or googlemail.com. emailParts[0] = emailParts[0].Replace(".", ""); normalizedEmail = $"{emailParts[0]}@{emailParts[1]}"; } return NormalizeAndHash(normalizedEmail); } /// <summary> /// Normalizes and hashes a string value. /// </summary> /// <param name="value">The value to normalize and hash.</param> /// <returns>The normalized and hashed value.</returns> private static string NormalizeAndHash(string value) { return ToSha256String(digest, ToNormalizedValue(value)); } /// <summary> /// Hash a string value using SHA-256 hashing algorithm. /// </summary> /// <param name="digest">Provides the algorithm for SHA-256.</param> /// <param name="value">The string value (e.g. an email address) to hash.</param> /// <returns>The hashed value.</returns> private static string ToSha256String(SHA256 digest, string value) { byte[] digestBytes = digest.ComputeHash(Encoding.UTF8.GetBytes(value)); // Convert the byte array into an unhyphenated hexadecimal string. return BitConverter.ToString(digestBytes).Replace("-", string.Empty); } /// <summary> /// Removes leading and trailing whitespace and converts all characters to /// lower case. /// </summary> /// <param name="value">The value to normalize.</param> /// <returns>The normalized value.</returns> private static string ToNormalizedValue(string value) { return value.Trim().ToLower(); }
PHP
private static function normalizeAndHash(string $hashAlgorithm, string $value): string { // Normalizes by first converting all characters to lowercase, then trimming spaces. $normalized = strtolower($value); // Removes leading, trailing, and intermediate spaces. $normalized = str_replace(' ', '', $normalized); return hash($hashAlgorithm, strtolower(trim($normalized))); } /** * Returns the result of normalizing and hashing an email address. For this use case, Google * Ads requires removal of any '.' characters preceding "gmail.com" or "googlemail.com". * * @param string $hashAlgorithm the hash algorithm to use * @param string $emailAddress the email address to normalize and hash * @return string the normalized and hashed email address */ private static function normalizeAndHashEmailAddress( string $hashAlgorithm, string $emailAddress ): string { $normalizedEmail = strtolower($emailAddress); $emailParts = explode("@", $normalizedEmail); if ( count($emailParts) > 1 && preg_match('/^(gmail|googlemail)\.com\s*/', $emailParts[1]) ) { // Removes any '.' characters from the portion of the email address before the domain // if the domain is gmail.com or googlemail.com. $emailParts[0] = str_replace(".", "", $emailParts[0]); $normalizedEmail = sprintf('%s@%s', $emailParts[0], $emailParts[1]); } return self::normalizeAndHash($hashAlgorithm, $normalizedEmail); }
Python
def normalize_and_hash_email_address(email_address: str) -> str: """Returns the result of normalizing and hashing an email address. For this use case, Google Ads requires removal of any '.' characters preceding "gmail.com" or "googlemail.com" Args: email_address: An email address to normalize. Returns: A normalized (lowercase, removed whitespace) and SHA-265 hashed string. """ normalized_email: str = email_address.strip().lower() email_parts: list[str] = normalized_email.split("@") # Check that there are at least two segments if len(email_parts) > 1: # Removes any '.' and '+' characters from the portion of the email address # before the domain chars_to_remove = ".+" translation_table = str.maketrans("", "", chars_to_remove) email_parts[0] = email_parts[0].translate(translation_table) normalized_email = "@".join(email_parts) return normalize_and_hash(normalized_email) def normalize_and_hash(s: str) -> str: """Normalizes and hashes a string with SHA-256. Private customer data must be hashed during upload, as described at: https://support.google.com/google-ads/answer/7474263 Args: s: The string to perform this operation on. Returns: A normalized (lowercase, removed whitespace) and SHA-256 hashed string. """ return hashlib.sha256(s.strip().lower().encode()).hexdigest()
Ruby
# Returns the result of normalizing and then hashing the string using the # provided digest. Private customer data must be hashed during upload, as # described at https://support.google.com/google-ads/answer/7474263. def normalize_and_hash(str) # Remove leading and trailing whitespace and ensure all letters are lowercase # before hashing. Digest::SHA256.hexdigest(str.strip.downcase) end # Returns the result of normalizing and hashing an email address. For this use # case, Google Ads requires removal of any '.' characters preceding 'gmail.com' # or 'googlemail.com'. def normalize_and_hash_email(email) email_parts = email.downcase.split("@") # Removes any '.' characters from the portion of the email address before the # domain if the domain is gmail.com or googlemail.com. if email_parts.last =~ /^(gmail|googlemail)\.com\s*/ email_parts[0] = email_parts[0].gsub('.', '') end normalize_and_hash(email_parts.join('@')) end
Perl
sub normalize_and_hash { my $value = shift; # Removes leading, trailing, and intermediate spaces. $value =~ s/\s+//g; return sha256_hex(lc $value); } # Returns the result of normalizing and hashing an email address. For this use # case, Google Ads requires removal of any '.' characters preceding 'gmail.com' # or 'googlemail.com'. sub normalize_and_hash_email_address { my $email_address = shift; my $normalized_email = lc $email_address; my @email_parts = split('@', $normalized_email); if (scalar @email_parts > 1 && $email_parts[1] =~ /^(gmail|googlemail)\.com\s*/) { # Remove any '.' characters from the portion of the email address before the # domain if the domain is 'gmail.com' or 'googlemail.com'. $email_parts[0] =~ s/\.//g; $normalized_email = sprintf '%s@%s', $email_parts[0], $email_parts[1]; } return normalize_and_hash($normalized_email); }
কার্ল
ClickConversion অবজেক্ট পপুলেট করুন
আপনার UploadClickConversionsRequest-এ ClickConversion অবজেক্টের সংগ্রহ
আপনি যে কনভার্সনের সেট ইমপোর্ট করতে চান
তার প্রতিনিধিত্ব করে। ClickConversion
অবজেক্ট তৈরি করার সময় নিম্নলিখিত বিবরণ মনে রাখবেন:
gclidGCLID হল শনাক্তকারী যা URL প্যারামিটার থেকে ক্যাপচার করা হয় যখন কোনও ব্যক্তি আপনার বিজ্ঞাপনে ক্লিক করেন এবং আপনার ওয়েবসাইটে নেভিগেট করেন।
gbraidgbraidহল একটি URL প্যারামিটার যা কোনও ব্যবহারকারী ওয়েবে কোনও বিজ্ঞাপনে ক্লিক করে আপনার iOS অ্যাপে রিডাইরেক্ট হলে উপস্থিত থাকে।wbraidwbraidহল একটি URL প্যারামিটার যা কোনও ব্যবহারকারী iOS অ্যাপে কোনও বিজ্ঞাপনে ক্লিক করলে এবং আপনার ওয়েবপেজে নির্দেশিত হলে উপস্থিত থাকে।
cart_data- কনভার্সন সম্পর্কে আইটেম-লেভেল বিবরণ থাকে। Google Ads UI-তে বাস্কেট ডেটা—যেমন কেনা আইটেম, দাম এবং
পরিমাণ—রিপোর্ট করার জন্য
cart_dataফিল্ডটি পূরণ করতে হবে। প্রয়োজনীয় স্ট্রাকচারের জন্যCartDataঅবজেক্টের সংজ্ঞা দেখুন এবং কার্ট ডেটার মাধ্যমে কনভার্সন সম্পর্কে আরও জানুন। Google Adscart_data-কে সাপোর্ট করে না যখনwbraidবাgbraid-কেgclidছাড়াই ব্যবহার করা হয়। user_identifiersলিডের জন্য উন্নত কনভার্সন ব্যবহার করার সময়, আপনাকে অবশ্যই
user_identifiersফিল্ডে ব্যবহারকারীর দেওয়া ডেটা নরমালাইজ ও হ্যাশ করে পূরণ করতে হবে। আপনার কাছে একাধিক ইউজার আইডেন্টিফায়ার থাকলে, সর্বাধিক পাঁচটি আইডেন্টিফায়ার পর্যন্ত, প্রত্যেকটির জন্য আলাদাUserIdentifierতৈরি করুন।conversion_date_timeকনভার্সনের তারিখ ও সময়।
ভ্যালুতে অবশ্যই টাইমজোন উল্লেখ করতে হবে এবং ফর্ম্যাটটি অবশ্যই
yyyy-mm-dd HH:mm:ss+|-HH:mmহতে হবে, যেমন:2022-01-01 19:32:45-05:00(ডেলাইট সেভিং টাইম উপেক্ষা করে) .টাইমজোন যেকোনও সঠিক ভ্যালুর জন্য হতে পারে: এটি অ্যাকাউন্টের টাইমজোনের সাথে মিলতে হবে না। তবে, আপনি যদি Google Ads UI-তে থাকা ডেটার সাথে আপনার ইম্পোর্ট করা কনভার্সন ডেটার তুলনা করার পরিকল্পনা করেন, তাহলে আমরা আপনার Google Ads অ্যাকাউন্টের মতো একই টাইমজোন ব্যবহার করার সাজেশন দিই যাতে কনভার্সনের সংখ্যা মিলে যায়। আপনি ইমপোর্ট করার জন্য ডেটা প্রস্তুত করুন বিকল্পে আরও বিবরণ ও উদাহরণ দেখতে পাবেন এবং বৈধ টাইমজোন আইডির তালিকা পেতে কোড ও ফর্ম্যাট চেক করুন।
conversion_actionঅফলাইন কনভার্সনের জন্য
ConversionAction-এর রিসোর্স নাম।কনভার্সন অ্যাকশনের
type-এর মানUPLOAD_CLICKSহতে হবে এবং এটি অবশ্যই ক্লিকের সাথে যুক্ত Google Ads অ্যাকাউন্টের Google Ads কনভার্সন কাস্টমারে থাকতে হবে।conversion_valueকনভার্সনের ভ্যালু।
currency_codeconversion_value-এর কারেন্সি কোড।consentClickConversionঅবজেক্টেরconsentফিল্ডে তথ্য পূরণ করার জন্য বিশেষভাবে সাজেস্ট করা হচ্ছে। সেট না করা হলে, আপনার কনভার্সন অ্যাট্রিবিউট করা নাও যেতে পারে।order_idকনভার্সনের জন্য ট্রানজ্যাকশন আইডি হিসেবেও পরিচিত। এই ফিল্ডটি ঐচ্ছিক, তবে এটি ব্যবহার করার জন্য বিশেষভাবে সাজেস্ট করা হয়, কারণ এটি অ্যাডজাস্টমেন্ট করার সময় ইম্পোর্ট করা কনভার্সন রেফারেন্স করা সহজ করে তোলে। আপনি যদি ইম্পোর্ট করার সময় এটি সেট করেন, তাহলে যেকোনও অ্যাডজাস্টমেন্টের জন্য আপনাকে এটি ব্যবহার করতে হবে। ডুপ্লিকেট কনভার্সন কমাতে কীভাবে ট্রানজ্যাকশন আইডি ব্যবহার করবেন সেই সম্পর্কে আরও জানতে, ডুপ্লিকেট কনভার্সন কমাতে ট্রানজ্যাকশন আইডি ব্যবহার করুন নিবন্ধটি দেখুন।
custom_variablesকাস্টম কনভার্সন ভেরিয়েবল-এর ভ্যালু।
gclidছাড়াwbraidবাgbraidব্যবহার করা হলে, Google Ads কাস্টম কনভার্সন ভেরিয়েবলকে সাপোর্ট করে না।conversion_environmentএই কনভার্সনটি কোন এনভায়রনমেন্টে রেকর্ড করা হয়েছে তা দেখায়। যেমন,
APPবাWEB।
session_attributes_encodedওsession_attributes_key_value_pairsসেশন অ্যাট্রিবিউট কনভার্সন অ্যাট্রিবিউশনের জন্য ব্যবহৃত অ্যাগ্রিগেট করা শনাক্তকারীকে বোঝায়। এগুলি GCLID এবং URL প্যারামিটার (যেমন, GBRAID) এবং ব্যবহারকারীর প্রদান করা ডেটার সাথে কাজ করে, যা লিডের জন্য উন্নত কনভার্সনের ক্ষেত্রে গুরুত্বপূর্ণ। সেশন অ্যাট্রিবিউট ইমপোর্ট করার দুটি উপায় আছে: ব্রাউজারে আমাদের জাভাস্ক্রিপ্ট কোড দ্বারা তৈরি করা এনকোড করা টোকেন প্রদান করে অথবা প্রতিটি শনাক্তকারীর জন্য আলাদা কী-ভ্যালু পেয়ার প্রদান করে।
আপনার ক্যাম্পেনের পারফর্ম্যান্স সর্বাধিক করতে, আমরা ক্লিক শনাক্তকারী, ব্যবহারকারীর প্রদান করা ডেটা এবং সেশন অ্যাট্রিবিউট আপনার সব কনভার্সনের সাথে ইমপোর্ট করার সাজেশন দিই, যদি সম্ভব হয়।
Java
// Sets one of the sessionAttributesEncoded or sessionAttributesKeyValuePairs if either is // provided. The session attribute fields are only available to allowlisted users. // To include these fields in conversion imports, upgrade to the Data Manager API. if (rawRecord.containsKey("sessionAttributesEncoded")) { clickConversionBuilder.setSessionAttributesEncoded( ByteString.copyFromUtf8(rawRecord.get("sessionAttributesEncoded"))); } else if (rawRecord.containsKey("sessionAttributesMap")) { List<String> pairings = Arrays.stream(rawRecord.get("sessionAttributesMap").split(" ")) .map(String::trim) .collect(Collectors.toList()); SessionAttributesKeyValuePairs.Builder sessionAttributePairs = SessionAttributesKeyValuePairs.newBuilder(); for (String pair : pairings) { String[] parts = pair.split("=", 2); if (parts.length != 2) { throw new IllegalArgumentException( "Failed to read the sessionAttributesMap. SessionAttributesMap must use a" + " space-delimited list of session attribute key value pairs. Each pair should" + " be separated by an equal sign, for example: 'gad_campaignid=12345" + " gad_source=1'"); } sessionAttributePairs.addKeyValuePairs( SessionAttributeKeyValuePair.newBuilder() .setSessionAttributeKey(parts[0]) .setSessionAttributeValue(parts[1]) .build()); } clickConversionBuilder.setSessionAttributesKeyValuePairs(sessionAttributePairs.build()); }
C#
// The session attribute fields are only available to allowlisted users. To // include these fields in conversion imports, upgrade to the Data Manager API. if (!string.IsNullOrEmpty(sessionAttributesEncoded)) { clickConversion.SessionAttributesEncoded = ByteString.CopyFrom(sessionAttributesEncoded, Encoding.Unicode); } else if (!string.IsNullOrEmpty(sessionAttributes)) { IEnumerable<SessionAttributeKeyValuePair> parsedSessionAttributes = sessionAttributes.Split(';').Select(pair => { string[] split = pair.Split('='); return new SessionAttributeKeyValuePair() { SessionAttributeKey = split[0], SessionAttributeValue = split[1] }; }); clickConversion.SessionAttributesKeyValuePairs = new SessionAttributesKeyValuePairs(); clickConversion.SessionAttributesKeyValuePairs.KeyValuePairs .AddRange(parsedSessionAttributes); }
PHP
// Set one of the sessionAttributesEncoded or // SessionAttributeKeyValuePair fields if either are provided. The session attribute // fields are only available to allowlisted users. To include these fields in conversion // imports, upgrade to the Data Manager API. if (!empty($sessionAttributesEncoded)) { $clickConversion->setSessionAttributesEncoded($sessionAttributesEncoded); } elseif (!empty($sessionAttributesDict)) { // Create a new container object to hold key-value pairs. $sessionAttributesKeyValuePairs = new SessionAttributesKeyValuePairs(); // Initialize an array to hold individual key-value pair messages. $keyValuePairs = []; // Append each key-value pair provided to the $keyValuePairs array foreach ($sessionAttributesDict as $key => $value) { $pair = new SessionAttributeKeyValuePair(); $pair->setSessionAttributeKey($key); $pair->setSessionAttributeValue($value); $keyValuePairs[] = $pair; } // Set the the full list of key-value pairs on the container object. $sessionAttributesKeyValuePairs->setKeyValuePairs($keyValuePairs); // Attach the container of key-value pairs to the ClickConversion object. $clickConversion->setSessionAttributesKeyValuePairs($sessionAttributesKeyValuePairs); }
Python
# Set one of the session_attributes_encoded or # session_attributes_key_value_pairs fields if either are provided. # The session attribute fields are only available to allowlisted users. # To include these fields in conversion imports, upgrade to the Data Manager API. if session_attributes_encoded: click_conversion.session_attributes_encoded = session_attributes_encoded elif session_attributes_dict: for key, value in session_attributes_dict.items(): pair: SessionAttributeKeyValuePair = client.get_type( "SessionAttributeKeyValuePair" ) pair.session_attribute_key = key pair.session_attribute_value = value click_conversion.session_attributes_key_value_pairs.key_value_pairs.append( pair )
Ruby
# Set one of the session_attributes_encoded or # session_attributes_key_value_pairs fields if either are provided. # The session attribute fields are only available to allowlisted users. # To include these fields in conversion imports, upgrade to the Data Manager API. if session_attributes_encoded != nil cc.class.module_eval { attr_accessor :session_attributes_encoded} cc.session_attributes_encoded = session_attributes_encoded elsif session_attributes_hash != nil # Add new attribute to click conversion object cc.class.module_eval { attr_accessor :session_attributes_key_value_pairs} cc.session_attributes_key_value_pairs = ::Google::Ads::GoogleAds::V19::Services::SessionAttributesKeyValuePairs.new # Loop thru inputted session_attributes_hash to populate session_attributes_key_value_pairs session_attributes_hash.each do |key, value| pair = ::Google::Ads::GoogleAds::V19::Services::SessionAttributeKeyValuePair.new pair.session_attribute_key = key pair.session_attribute_value = value cc.session_attributes_key_value_pairs.key_value_pairs << pair end end
Perl
# Set one of the session_attributes_encoded or session_attributes_key_value_pairs # fields if either are provided. if (defined $session_attributes_encoded) { $click_conversion->{sessionAttributesEncoded} = $session_attributes_encoded; } elsif (defined $session_attributes_hash) { while (my ($key, $value) = each %$session_attributes_hash) { my $pair = Google::Ads::GoogleAds::V26::Services::ConversionUploadService::SessionAttributeKeyValuePair ->new({sessionAttributeKey => $key, sessionAttributeValue => $value}); push @{$click_conversion->{sessionAttributesKeyValuePairs}{keyValuePairs} }, $pair; } }
কার্ল
user_ip_addressবিজ্ঞাপনে ক্লিক করার পরে এবং কনভার্সন ইভেন্টের আগে গ্রাহক যখন ল্যান্ডিং পৃষ্ঠায় পৌঁছান, তখন তার IP অ্যাড্রেস। এটি গ্রাহকের ডিভাইসের IP অ্যাড্রেস, বিজ্ঞাপনদাতার সার্ভারের নয়।
এই ফিল্ডটি হল একটি স্ট্রিং যা IPv4 বা IPv6 ফর্ম্যাটে একটি IP অ্যাড্রেসকে উপস্থাপন করে। যেমন:
- IPv4:
"192.0.2.0" - IPv6:
"2001:0DB8:1234:5678:9999:1111:0000:0001"
- IPv4:
কোডের উদাহরণ
এই উদাহরণে দেখানো হয়েছে যে কীভাবে আপনার নর্ম্যালাইজ ও হ্যাশ করা ব্যবহারকারীর প্রদান করা ডেটা
একটি ClickConversion অবজেক্টে সেট করবেন।
Java
// Creates an empty builder for constructing the click conversion. ClickConversion.Builder clickConversionBuilder = ClickConversion.newBuilder(); // Extracts user email and phone from the raw data, normalizes and hashes it, then wraps it in // UserIdentifier objects. // Creates a separate UserIdentifier object for each. The data in this example is hardcoded, but // in your application you might read the raw data from an input file. // 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(); ImmutableMap.Builder<String, String> rawRecordBuilder = ImmutableMap.<String, String>builder() .put("email", "alex.2+myalias@gmail.com") // Phone number to be converted to E.164 format, with a leading '+' as required. .put("phone", "+1 (800) 555-0102") // This example lets you put conversion details as arguments, but in reality you might // store this data alongside other user data, so we include it in this sample user // record. .put("conversionActionId", Long.toString(conversionActionId)) .put("conversionDateTime", conversionDateTime) .put("conversionValue", Double.toString(conversionValue)) .put("currencyCode", "USD"); // Adds entries for the optional fields. if (orderId != null) { rawRecordBuilder.put("orderId", orderId); } if (gclid != null) { rawRecordBuilder.put("gclid", gclid); } if (adUserDataConsent != null) { rawRecordBuilder.put("adUserDataConsent", adUserDataConsent.name()); } if (sessionAttributesEncoded != null) { rawRecordBuilder.put("sessionAttributesEncoded", sessionAttributesEncoded); } if (sessionAttributesMap != null) { rawRecordBuilder.put("sessionAttributesMap", sessionAttributesMap); } // Builds the map representing the record. Map<String, String> rawRecord = rawRecordBuilder.build(); // Creates a SHA256 message digest for hashing user identifiers in a privacy-safe way, as // described at https://support.google.com/google-ads/answer/9888656. MessageDigest sha256Digest = MessageDigest.getInstance("SHA-256"); // Creates a list for the user identifiers. List<UserIdentifier> userIdentifiers = new ArrayList<>(); // Creates a user identifier using the hashed email address, using the normalize and hash method // specifically for email addresses. UserIdentifier emailIdentifier = UserIdentifier.newBuilder() // Optional: specify the user identifier source. .setUserIdentifierSource(UserIdentifierSource.FIRST_PARTY) // Uses the normalize and hash method specifically for email addresses. .setHashedEmail(normalizeAndHashEmailAddress(sha256Digest, rawRecord.get("email"))) .build(); userIdentifiers.add(emailIdentifier); // Creates a user identifier using normalized and hashed phone info. UserIdentifier hashedPhoneNumberIdentifier = UserIdentifier.newBuilder() .setHashedPhoneNumber(normalizeAndHashPhoneNumber(sha256Digest, rawRecord.get("phone"))) .build(); // Adds the hashed phone number identifier to the UserData object's list. userIdentifiers.add(hashedPhoneNumberIdentifier); // Adds the user identifiers to the conversion. clickConversionBuilder.addAllUserIdentifiers(userIdentifiers);
C#
// Adds a user identifier using the hashed email address, using the normalize // and hash method specifically for email addresses. clickConversion.UserIdentifiers.Add(new UserIdentifier() { HashedEmail = NormalizeAndHashEmailAddress("alex.2@example.com"), // Optional: Specifies the user identifier source. UserIdentifierSource = UserIdentifierSource.FirstParty }); // Adds a user identifier using normalized and hashed phone info. clickConversion.UserIdentifiers.Add(new UserIdentifier() { HashedPhoneNumber = NormalizeAndHash("+1 800 5550102"), // Optional: Specifies the user identifier source. UserIdentifierSource = UserIdentifierSource.FirstParty }); // Adds a user identifier with all the required mailing address elements. clickConversion.UserIdentifiers.Add(new UserIdentifier() { AddressInfo = new OfflineUserAddressInfo() { // FirstName and LastName must be normalized and hashed. HashedFirstName = NormalizeAndHash("Alex"), HashedLastName = NormalizeAndHash("Quinn"), // CountryCode and PostalCode are sent in plain text. CountryCode = "US", PostalCode = "94045" } });
PHP
// Creates a click conversion with the specified attributes. $clickConversion = new ClickConversion(); // Extract user email and phone from the raw data, normalize and hash it, then wrap it in // UserIdentifier objects. Creates a separate UserIdentifier object for each. // The data in this example is hardcoded, but in your application you might read the raw // data from an input file. // 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. // // $incorrectlyPopulatedUserIdentifier = new UserIdentifier([ // 'hashed_email' => '...', // 'hashed_phone_number' => '...' // ]); $rawRecord = [ // Email address that includes a period (.) before the Gmail domain. 'email' => 'alex.2@example.com', // Phone number to be converted to E.164 format, with a leading '+' as required. 'phone' => '+1 800 5550102', // This example lets you input conversion details as arguments, but in reality you might // store this data alongside other user data, so we include it in this sample user // record. 'orderId' => $orderId, 'gclid' => $gclid, 'conversionActionId' => $conversionActionId, 'conversionDateTime' => $conversionDateTime, 'conversionValue' => $conversionValue, 'currencyCode' => 'USD', 'adUserDataConsent' => $adUserDataConsent, 'sessionAttributesEncoded' => $sessionAttributesEncoded, 'sessionAttributesDict' => $sessionAttributesDict ]; // Creates a list for the user identifiers. $userIdentifiers = []; // Uses the SHA-256 hash algorithm for hashing user identifiers in a privacy-safe way, as // described at https://support.google.com/google-ads/answer/9888656. $hashAlgorithm = "sha256"; // Creates a user identifier using the hashed email address, using the normalize and hash // method specifically for email addresses. $emailIdentifier = new UserIdentifier( [ // Uses the normalize and hash method specifically for email addresses. 'hashed_email' => self::normalizeAndHashEmailAddress( $hashAlgorithm, $rawRecord['email'] ), // Optional: Specifies the user identifier source. 'user_identifier_source' => UserIdentifierSource::FIRST_PARTY ] ); $userIdentifiers[] = $emailIdentifier; // 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( $hashAlgorithm, $rawRecord['phone'], true ) ] ); // Adds the hashed email identifier to the user identifiers list. $userIdentifiers[] = $hashedPhoneNumberIdentifier; } // Adds the user identifiers to the conversion. $clickConversion->setUserIdentifiers($userIdentifiers);
Python
# Extract user email and phone from the raw data, normalize and hash it, # then wrap it in UserIdentifier objects. Create a separate UserIdentifier # object for each. The data in this example is hardcoded, but in your # application you might read the raw data from an input file. # 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: # # incorrectly_populated_user_identifier = client.get_type("UserIdentifier") # incorrectly_populated_user_identifier.hashed_email = "..."" # incorrectly_populated_user_identifier.hashed_phone_number = "..."" raw_record: Dict[str, Union[str, float]] = { # Email address that includes a period (.) before the Gmail domain. "email": "alex.2@example.com", # Phone number to be converted to E.164 format, with a leading '+' as # required. "phone": "+1 800 5550102", # This example lets you input conversion details as arguments, # but in reality you might store this data alongside other user data, # so we include it in this sample user record. "order_id": order_id, "gclid": gclid, "conversion_action_id": conversion_action_id, "conversion_date_time": conversion_date_time, "conversion_value": conversion_value, "currency_code": "USD", "ad_user_data_consent": ad_user_data_consent, } # Constructs the click conversion. click_conversion: ClickConversion = client.get_type("ClickConversion") # Creates a user identifier using the hashed email address, using the # normalize and hash method specifically for email addresses. email_identifier: UserIdentifier = client.get_type("UserIdentifier") # Optional: Specifies the user identifier source. email_identifier.user_identifier_source = ( client.enums.UserIdentifierSourceEnum.FIRST_PARTY ) # Uses the normalize and hash method specifically for email addresses. email_identifier.hashed_email = normalize_and_hash_email_address( raw_record["email"] ) # Adds the user identifier to the conversion. click_conversion.user_identifiers.append(email_identifier) # Checks if the record has a phone number, and if so, adds a UserIdentifier # for it. if raw_record.get("phone") is not None: phone_identifier: UserIdentifier = client.get_type("UserIdentifier") phone_identifier.hashed_phone_number = normalize_and_hash( raw_record["phone"] ) # Adds the phone identifier to the conversion adjustment. click_conversion.user_identifiers.append(phone_identifier)
Ruby
# Extract user email and phone from the raw data, normalize and hash it, # then wrap it in UserIdentifier objects. Create a separate UserIdentifier # object for each. The data in this example is hardcoded, but in your # application you might read the raw data from an input file. # 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: # # incorrectly_populated_user_identifier.hashed_email = "..."" # incorrectly_populated_user_identifier.hashed_phone_number = "..."" raw_record = { # Email address that includes a period (.) before the Gmail domain. "email" => "alex.2@example.com", # Phone number to be converted to E.164 format, with a leading '+' as # required. "phone" => "+1 800 5550102", # This example lets you input conversion details as arguments, # but in reality you might store this data alongside other user data, # so we include it in this sample user record. "order_id" => order_id, "gclid" => gclid, "conversion_action_id" => conversion_action_id, "conversion_date_time" => conversion_date_time, "conversion_value" => conversion_value, "currency_code" => "USD", "ad_user_data_consent" => ad_user_data_consent, "session_attributes_encoded" => session_attributes_encoded, "session_attributes_hash" => session_attributes_hash } click_conversion = client.resource.click_conversion do |cc| cc.conversion_action = client.path.conversion_action(customer_id, conversion_action_id) cc.conversion_date_time = conversion_date_time cc.conversion_value = conversion_value.to_f cc.currency_code = 'USD' unless order_id.nil? cc.order_id = order_id end unless raw_record["gclid"].nil? cc.gclid = gclid end # Specifies whether user consent was obtained for the data you are # uploading. For more details, see: # https://www.google.com/about/company/user-consent-policy unless raw_record["ad_user_data_consent"].nil? cc.consent = client.resource.consent do |c| c.ad_user_data = ad_user_data_consent end end # Set one of the session_attributes_encoded or # session_attributes_key_value_pairs fields if either are provided. # The session attribute fields are only available to allowlisted users. # To include these fields in conversion imports, upgrade to the Data Manager API. if session_attributes_encoded != nil cc.class.module_eval { attr_accessor :session_attributes_encoded} cc.session_attributes_encoded = session_attributes_encoded elsif session_attributes_hash != nil # Add new attribute to click conversion object cc.class.module_eval { attr_accessor :session_attributes_key_value_pairs} cc.session_attributes_key_value_pairs = ::Google::Ads::GoogleAds::V19::Services::SessionAttributesKeyValuePairs.new # Loop thru inputted session_attributes_hash to populate session_attributes_key_value_pairs session_attributes_hash.each do |key, value| pair = ::Google::Ads::GoogleAds::V19::Services::SessionAttributeKeyValuePair.new pair.session_attribute_key = key pair.session_attribute_value = value cc.session_attributes_key_value_pairs.key_value_pairs << pair end end # Creates a user identifier using the hashed email address, using the # normalize and hash method specifically for email addresses. # If using a phone number, use the normalize_and_hash method instead. cc.user_identifiers << client.resource.user_identifier do |ui| ui.hashed_email = normalize_and_hash_email(raw_record["email"]) # Optional: Specifies the user identifier source. ui.user_identifier_source = :FIRST_PARTY end # Checks if the record has a phone number, and if so, adds a UserIdentifier # for it. unless raw_record["phone"].nil? cc.user_identifiers << client.resource.user_identifier do |ui| ui.hashed_phone_number = normalize_and_hash(raw_record["phone"]) end end end
Perl
# Create an empty click conversion. my $click_conversion = Google::Ads::GoogleAds::V26::Services::ConversionUploadService::ClickConversion ->new({}); # Extract user email and phone from the raw data, normalize and hash it, # then wrap it in UserIdentifier objects. Create a separate UserIdentifier # object for each. # The data in this example is hardcoded, but in your application # you might read the raw data from an input file. # # 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::V26::Common::UserIdentifier->new({ # hashedEmail => '...', # hashedPhoneNumber => '...', # }); my $raw_record = { # Email address that includes a period (.) before the Gmail domain. email => 'alex.2@example.com', # Phone number to be converted to E.164 format, with a leading '+' as # required. phone => '+1 800 5550102', # This example lets you input conversion details as arguments, # but in reality you might store this data alongside other user data, # so we include it in this sample user record. orderId => $order_id, gclid => $gclid, conversionActionId => $conversion_action_id, conversionDateTime => $conversion_date_time, conversionValue => $conversion_value, currencyCode => "USD", adUserDataConsent => $ad_user_data_consent }; my $user_identifiers = []; # Create a user identifier using the hashed email address, using the normalize # and hash method specifically for email addresses. my $hashed_email = normalize_and_hash_email_address($raw_record->{email}); push( @$user_identifiers, Google::Ads::GoogleAds::V26::Common::UserIdentifier->new({ hashedEmail => $hashed_email, # Optional: Specify the user identifier source. userIdentifierSource => FIRST_PARTY })); # Create a user identifier using normalized and hashed phone info. my $hashed_phone = normalize_and_hash($raw_record->{phone}); push( @$user_identifiers, Google::Ads::GoogleAds::V26::Common::UserIdentifier->new({ hashedPhone => $hashed_phone, # Optional: Specify the user identifier source. userIdentifierSource => FIRST_PARTY })); # Add the user identifiers to the conversion. $click_conversion->{userIdentifiers} = $user_identifiers;
কার্ল
এই উদাহরণে দেখানো হয়েছে কীভাবে ClickConversion
অবজেক্টে অন্যান্য প্রয়োজনীয় ফিল্ড সেট করতে হয়।
Java
// Adds details of the conversion. clickConversionBuilder.setConversionAction( ResourceNames.conversionAction( customerId, Long.parseLong(rawRecord.get("conversionActionId")))); clickConversionBuilder.setConversionDateTime(rawRecord.get("conversionDateTime")); clickConversionBuilder.setConversionValue(Double.parseDouble(rawRecord.get("conversionValue"))); clickConversionBuilder.setCurrencyCode(rawRecord.get("currencyCode")); // Sets the order ID if provided. if (rawRecord.containsKey("orderId")) { clickConversionBuilder.setOrderId(rawRecord.get("orderId")); } // Sets the Google click ID (gclid) if provided. if (rawRecord.containsKey("gclid")) { clickConversionBuilder.setGclid(rawRecord.get("gclid")); } // Sets the consent information, if provided. if (rawRecord.containsKey("adUserDataConsent")) { // Specifies whether user consent was obtained for the data you are uploading. See // https://www.google.com/about/company/user-consent-policy for details. clickConversionBuilder.setConsent( Consent.newBuilder() .setAdUserData(ConsentStatus.valueOf(rawRecord.get("adUserDataConsent")))); } // Sets one of the sessionAttributesEncoded or sessionAttributesKeyValuePairs if either is // provided. The session attribute fields are only available to allowlisted users. // To include these fields in conversion imports, upgrade to the Data Manager API. if (rawRecord.containsKey("sessionAttributesEncoded")) { clickConversionBuilder.setSessionAttributesEncoded( ByteString.copyFromUtf8(rawRecord.get("sessionAttributesEncoded"))); } else if (rawRecord.containsKey("sessionAttributesMap")) { List<String> pairings = Arrays.stream(rawRecord.get("sessionAttributesMap").split(" ")) .map(String::trim) .collect(Collectors.toList()); SessionAttributesKeyValuePairs.Builder sessionAttributePairs = SessionAttributesKeyValuePairs.newBuilder(); for (String pair : pairings) { String[] parts = pair.split("=", 2); if (parts.length != 2) { throw new IllegalArgumentException( "Failed to read the sessionAttributesMap. SessionAttributesMap must use a" + " space-delimited list of session attribute key value pairs. Each pair should" + " be separated by an equal sign, for example: 'gad_campaignid=12345" + " gad_source=1'"); } sessionAttributePairs.addKeyValuePairs( SessionAttributeKeyValuePair.newBuilder() .setSessionAttributeKey(parts[0]) .setSessionAttributeValue(parts[1]) .build()); } clickConversionBuilder.setSessionAttributesKeyValuePairs(sessionAttributePairs.build()); } // Calls build to build the conversion. ClickConversion clickConversion = clickConversionBuilder.build();
C#
// Adds details of the conversion. clickConversion.ConversionAction = ResourceNames.ConversionAction(customerId, conversionActionId); clickConversion.ConversionDateTime = conversionDateTime; clickConversion.ConversionValue = conversionValue; clickConversion.CurrencyCode = "USD"; // Sets the order ID if provided. if (!string.IsNullOrEmpty(orderId)) { clickConversion.OrderId = orderId; } // Sets the Google click ID (gclid) if provided. if (!string.IsNullOrEmpty(gclid)) { clickConversion.Gclid = gclid; } // The session attribute fields are only available to allowlisted users. To // include these fields in conversion imports, upgrade to the Data Manager API. if (!string.IsNullOrEmpty(sessionAttributesEncoded)) { clickConversion.SessionAttributesEncoded = ByteString.CopyFrom(sessionAttributesEncoded, Encoding.Unicode); } else if (!string.IsNullOrEmpty(sessionAttributes)) { IEnumerable<SessionAttributeKeyValuePair> parsedSessionAttributes = sessionAttributes.Split(';').Select(pair => { string[] split = pair.Split('='); return new SessionAttributeKeyValuePair() { SessionAttributeKey = split[0], SessionAttributeValue = split[1] }; }); clickConversion.SessionAttributesKeyValuePairs = new SessionAttributesKeyValuePairs(); clickConversion.SessionAttributesKeyValuePairs.KeyValuePairs .AddRange(parsedSessionAttributes); }
PHP
// Adds details of the conversion. $clickConversion->setConversionAction( ResourceNames::forConversionAction($customerId, $rawRecord['conversionActionId']) ); $clickConversion->setConversionDateTime($rawRecord['conversionDateTime']); $clickConversion->setConversionValue($rawRecord['conversionValue']); $clickConversion->setCurrencyCode($rawRecord['currencyCode']); // Sets the order ID if provided. if (!empty($rawRecord['orderId'])) { $clickConversion->setOrderId($rawRecord['orderId']); } // Sets the Google click ID (gclid) if provided. if (!empty($rawRecord['gclid'])) { $clickConversion->setGclid($rawRecord['gclid']); } // Sets the ad user data consent if provided. if (!empty($rawRecord['adUserDataConsent'])) { // Specifies whether user consent was obtained for the data you are uploading. See // https://www.google.com/about/company/user-consent-policy for details. $clickConversion->setConsent( new Consent(['ad_user_data' => $rawRecord['adUserDataConsent']]) ); } // Set one of the sessionAttributesEncoded or // SessionAttributeKeyValuePair fields if either are provided. The session attribute // fields are only available to allowlisted users. To include these fields in conversion // imports, upgrade to the Data Manager API. if (!empty($sessionAttributesEncoded)) { $clickConversion->setSessionAttributesEncoded($sessionAttributesEncoded); } elseif (!empty($sessionAttributesDict)) { // Create a new container object to hold key-value pairs. $sessionAttributesKeyValuePairs = new SessionAttributesKeyValuePairs(); // Initialize an array to hold individual key-value pair messages. $keyValuePairs = []; // Append each key-value pair provided to the $keyValuePairs array foreach ($sessionAttributesDict as $key => $value) { $pair = new SessionAttributeKeyValuePair(); $pair->setSessionAttributeKey($key); $pair->setSessionAttributeValue($value); $keyValuePairs[] = $pair; } // Set the the full list of key-value pairs on the container object. $sessionAttributesKeyValuePairs->setKeyValuePairs($keyValuePairs); // Attach the container of key-value pairs to the ClickConversion object. $clickConversion->setSessionAttributesKeyValuePairs($sessionAttributesKeyValuePairs); }
Python
# Add details of the conversion. # Gets the conversion action resource name. conversion_action_service: ConversionActionServiceClient = ( client.get_service("ConversionActionService") ) click_conversion.conversion_action = ( conversion_action_service.conversion_action_path( customer_id, raw_record["conversion_action_id"] ) ) click_conversion.conversion_date_time = raw_record["conversion_date_time"] click_conversion.conversion_value = raw_record["conversion_value"] click_conversion.currency_code = raw_record["currency_code"] # Sets the order ID if provided. if raw_record.get("order_id"): click_conversion.order_id = raw_record["order_id"] # Sets the gclid if provided. if raw_record.get("gclid"): click_conversion.gclid = raw_record["gclid"] # Specifies whether user consent was obtained for the data you are # uploading. For more details, see: # https://www.google.com/about/company/user-consent-policy if raw_record["ad_user_data_consent"]: click_conversion.consent.ad_user_data = client.enums.ConsentStatusEnum[ raw_record["ad_user_data_consent"] ] # Set one of the session_attributes_encoded or # session_attributes_key_value_pairs fields if either are provided. # The session attribute fields are only available to allowlisted users. # To include these fields in conversion imports, upgrade to the Data Manager API. if session_attributes_encoded: click_conversion.session_attributes_encoded = session_attributes_encoded elif session_attributes_dict: for key, value in session_attributes_dict.items(): pair: SessionAttributeKeyValuePair = client.get_type( "SessionAttributeKeyValuePair" ) pair.session_attribute_key = key pair.session_attribute_value = value click_conversion.session_attributes_key_value_pairs.key_value_pairs.append( pair )
Ruby
cc.conversion_action = client.path.conversion_action(customer_id, conversion_action_id) cc.conversion_date_time = conversion_date_time cc.conversion_value = conversion_value.to_f cc.currency_code = 'USD' unless order_id.nil? cc.order_id = order_id end unless raw_record["gclid"].nil? cc.gclid = gclid end # Specifies whether user consent was obtained for the data you are # uploading. For more details, see: # https://www.google.com/about/company/user-consent-policy unless raw_record["ad_user_data_consent"].nil? cc.consent = client.resource.consent do |c| c.ad_user_data = ad_user_data_consent end end # Set one of the session_attributes_encoded or # session_attributes_key_value_pairs fields if either are provided. # The session attribute fields are only available to allowlisted users. # To include these fields in conversion imports, upgrade to the Data Manager API. if session_attributes_encoded != nil cc.class.module_eval { attr_accessor :session_attributes_encoded} cc.session_attributes_encoded = session_attributes_encoded elsif session_attributes_hash != nil # Add new attribute to click conversion object cc.class.module_eval { attr_accessor :session_attributes_key_value_pairs} cc.session_attributes_key_value_pairs = ::Google::Ads::GoogleAds::V19::Services::SessionAttributesKeyValuePairs.new # Loop thru inputted session_attributes_hash to populate session_attributes_key_value_pairs session_attributes_hash.each do |key, value| pair = ::Google::Ads::GoogleAds::V19::Services::SessionAttributeKeyValuePair.new pair.session_attribute_key = key pair.session_attribute_value = value cc.session_attributes_key_value_pairs.key_value_pairs << pair end end
Perl
# Add details of the conversion. $click_conversion->{conversionAction} = Google::Ads::GoogleAds::V26::Utils::ResourceNames::conversion_action( $customer_id, $raw_record->{conversionActionId}); $click_conversion->{conversionDateTime} = $raw_record->{conversionDateTime}; $click_conversion->{conversionValue} = $raw_record->{conversionValue}; $click_conversion->{currencyCode} = $raw_record->{currencyCode}; # Set the order ID if provided. if (defined $raw_record->{orderId}) { $click_conversion->{orderId} = $raw_record->{orderId}; } # Set the Google click ID (gclid) if provided. if (defined $raw_record->{gclid}) { $click_conversion->{gclid} = $raw_record->{gclid}; } # Set the consent information, if provided. if (defined $raw_record->{adUserDataConsent}) { $click_conversion->{consent} = Google::Ads::GoogleAds::V26::Common::Consent->new({ adUserData => $raw_record->{adUserDataConsent}}); } # Set one of the session_attributes_encoded or session_attributes_key_value_pairs # fields if either are provided. if (defined $session_attributes_encoded) { $click_conversion->{sessionAttributesEncoded} = $session_attributes_encoded; } elsif (defined $session_attributes_hash) { while (my ($key, $value) = each %$session_attributes_hash) { my $pair = Google::Ads::GoogleAds::V26::Services::ConversionUploadService::SessionAttributeKeyValuePair ->new({sessionAttributeKey => $key, sessionAttributeValue => $value}); push @{$click_conversion->{sessionAttributesKeyValuePairs}{keyValuePairs} }, $pair; } }
কার্ল
অনুরোধ তৈরি করুন
আপনার ClickConversion অবজেক্ট কনফিগার করা এবং UploadClickConversionsRequest অবজেক্টের
conversions ফিল্ডে যোগ করা হয়ে গেলে, নিম্নলিখিত ফিল্ড সেট করুন এবং
ConversionUploadService-এ UploadClickConversions পদ্ধতিতে অনুরোধ পাঠান।
customer_id- এটি সেই অ্যাকাউন্টের Google Ads কনভার্সন কাস্টমার হিসেবে সেট করুন যা
ক্লিকের সোর্স। কোন অ্যাকাউন্টটি সঠিক তা নিশ্চিত না হলে,
শুরু করা বিভাগের উদাহরণ কোয়েরিতে
customer.conversion_tracking_setting.google_ads_conversion_customerফিল্ডটি দেখুন। job_idঅফলাইন ডেটা ডায়াগনস্টিক-এ প্রতি-জব তথ্যের সাথে আপনার ইম্পোর্ট সংক্রান্ত অনুরোধ অ্যাসোসিয়েট করার জন্য একটি মেকানিজম প্রদান করে।
আপনি এই ফিল্ড সেট না করলে, Google Ads API প্রতিটি অনুরোধকে
[2^31, 2^63)-এর রেঞ্জে একটি অনন্য ভ্যালু অ্যাসাইন করে। আপনি যদি একাধিক অনুরোধকে একটি লজিক্যাল জবে গ্রুপ করতে চান, তাহলে আপনার জবের প্রতিটি অনুরোধে এই ফিল্ডটি[1, 2^31)রেঞ্জের মধ্যে একই ভ্যালুতে সেট করুন।উত্তরে
job_id-এ অনুরোধের জন্য জব আইডি থাকে, আপনি কোনও ভ্যালু নির্দিষ্ট করেছেন কিনা বা Google Ads API-কে কোনও ভ্যালু অ্যাসাইন করতে দিয়েছেন কিনা তা নির্বিশেষে।partial_failureকনভার্সন ইম্পোর্ট করার সময় এই ফিল্ডটি অবশ্যই
true-এ সেট করতে হবে। উত্তর প্রসেস করার সময় আংশিক ব্যর্থতা সংক্রান্ত নির্দেশিকা অনুসরণ করুন।
অনুরোধ ইমপোর্ট করুন
আপনার ClickConversion অবজেক্ট পপুলেট করা এবং অনুরোধ তৈরি করা হয়ে গেলে,
আপনি ইমপোর্ট জমা দিতে পারবেন।
Java
// Creates the conversion upload service client. try (ConversionUploadServiceClient conversionUploadServiceClient = googleAdsClient.getLatestVersion().createConversionUploadServiceClient()) { // Uploads the click conversion. Partial failure should always be set to true. // NOTE: This request contains a single conversion as a demonstration. However, if you have // multiple conversions to upload, it's best to upload multiple conversions per request // instead of sending a separate request per conversion. See the following for per-request // limits: // https://developers.google.com/google-ads/api/docs/best-practices/quotas#conversion_upload_service UploadClickConversionsResponse response = conversionUploadServiceClient.uploadClickConversions( UploadClickConversionsRequest.newBuilder() .setCustomerId(Long.toString(customerId)) .addConversions(clickConversion) // Enables partial failure (must be true). .setPartialFailure(true) .build());
C#
// Uploads the click conversion. Partial failure should always be set to true. // NOTE: This request contains a single conversion as a demonstration. // However, if you have multiple conversions to upload, it's best to upload multiple // conversions per request instead of sending a separate request per conversion. // See the following for per-request limits: // https://developers.google.com/google-ads/api/docs/best-practices/quotas#conversion_upload UploadClickConversionsResponse response = conversionUploadService.UploadClickConversions( new UploadClickConversionsRequest() { CustomerId = customerId.ToString(), Conversions = { clickConversion }, // Enables partial failure (must be true). PartialFailure = true });
PHP
// Issues a request to upload the click conversion. $conversionUploadServiceClient = $googleAdsClient->getConversionUploadServiceClient(); // NOTE: This request contains a single conversion as a demonstration. However, if you have // multiple conversions to upload, it's best to upload multiple conversions per request // instead of sending a separate request per conversion. See the following for per-request // limits: // https://developers.google.com/google-ads/api/docs/best-practices/quotas#conversion_upload_service $response = $conversionUploadServiceClient->uploadClickConversions( // Enables partial failure (must be true). UploadClickConversionsRequest::build($customerId, [$clickConversion], true) );
Python
# Creates the conversion upload service client. conversion_upload_service: ConversionUploadServiceClient = ( client.get_service("ConversionUploadService") ) # Uploads the click conversion. Partial failure should always be set to # True. # NOTE: This request only uploads a single conversion, but if you have # multiple conversions to upload, it's most efficient to upload them in a # single request. See the following for per-request limits for reference: # https://developers.google.com/google-ads/api/docs/best-practices/quotas#conversion_upload_service response: UploadClickConversionsResponse = ( conversion_upload_service.upload_click_conversions( customer_id=customer_id, conversions=[click_conversion], # Enables partial failure (must be true). partial_failure=True, ) )
Ruby
response = client.service.conversion_upload.upload_click_conversions( customer_id: customer_id, conversions: [click_conversion], # Partial failure must be true. partial_failure: true, ) if response.partial_failure_error puts "Partial failure encountered: #{response.partial_failure_error.message}" else result = response.results.first puts "Uploaded click conversion that happened at #{result.conversion_date_time} " \ "to #{result.conversion_action}." end
Perl
# Upload the click conversion. Partial failure should always be set to true. # # NOTE: This request contains a single conversion as a demonstration. # However, if you have multiple conversions to upload, it's best to # upload multiple conversions per request instead of sending a separate # request per conversion. See the following for per-request limits: # https://developers.google.com/google-ads/api/docs/best-practices/quotas#conversion_upload_service my $response = $api_client->ConversionUploadService()->upload_click_conversions({ customerId => $customer_id, conversions => [$click_conversion], # Enable partial failure (must be true). partialFailure => "true" });
কার্ল
REST অনুরোধ ও উত্তর স্ট্রাকচার
REST-এর মাধ্যমে
ConversionUploadService.UploadClickConversions কল করার সময়,
partialFailure-কে true-এ সেট করে POST অনুরোধ পাঠান:
POST https://googleads.googleapis.com/v26/customers/{customer_id}:uploadClickConversions
{
"partialFailure": true,
"jobId": 1001,
"conversions": [
{
"conversionAction": "customers/{customer_id}/conversionActions/{conversion_action_id}",
"conversionDateTime": "2026-06-01 14:30:00-04:00",
"conversionValue": 125.50,
"currencyCode": "USD",
"orderId": "ORDER-2026-0001",
"gclid": "EAIaIQobChMI...",
"consent": {
"adUserData": "GRANTED"
},
"userIdentifiers": [
{
"userIdentifierSource": "FIRST_PARTY",
"hashedEmail": "f660ab912ec121d1b1e928a0bb4bc61b15f5ad44d5efdc4e1c92a25e99b8e44a"
},
{
"userIdentifierSource": "FIRST_PARTY",
"hashedPhoneNumber": "42975f8f9e46c2e13c1a2294957e5cb8d8e6f4f7341a036c6e595bc9f5e24621"
}
]
},
{
"conversionAction": "customers/{customer_id}/conversionActions/{conversion_action_id}",
"conversionDateTime": "2026-06-01 14:35:00-04:00",
"conversionValue": 80.00,
"currencyCode": "USD",
"orderId": "ORDER-2026-0002",
"gclid": "EAIaIQobChMI_expired...",
"consent": {
"adUserData": "GRANTED"
}
}
]
}
এই দুটি-কনভার্সন ব্যাচে যেখানে দ্বিতীয় আইটেমটি ব্যর্থ হয়, সফল সারিগুলি results[]-এ পপুলেট করা ClickConversionResult এন্ট্রি রিটার্ন করে, যেখানে
ব্যর্থ সারিগুলি results[]-এ খালি {} অবজেক্ট রিটার্ন করে, সাথে
UploadClickConversionsResponse-এ partialFailureError-এ ত্রুটির বিবরণ থাকে:
{
"results": [
{
"conversionAction": "customers/{customer_id}/conversionActions/{conversion_action_id}",
"conversionDateTime": "2026-06-01 14:30:00-04:00",
"gclid": "EAIaIQobChMI...",
"userIdentifiers": [
{
"userIdentifierSource": "FIRST_PARTY",
"hashedEmail": "f660ab912ec121d1b1e928a0bb4bc61b15f5ad44d5efdc4e1c92a25e99b8e44a"
},
{
"userIdentifierSource": "FIRST_PARTY",
"hashedPhoneNumber": "42975f8f9e46c2e13c1a2294957e5cb8d8e6f4f7341a036c6e595bc9f5e24621"
}
]
},
{}
],
"jobId": "1001",
"partialFailureError": {
"code": 3,
"message": "The imported event can't be recorded because its click occurred before this conversion's click-through window. Make sure you import the most recent data., at conversions[1].gclid",
"details": [
{
"@type": "type.googleapis.com/google.ads.googleads.v26.errors.GoogleAdsFailure",
"errors": [
{
"errorCode": {
"conversionUploadError": "EXPIRED_EVENT"
},
"message": "The imported event can't be recorded because its click occurred before this conversion's click-through window. Make sure you import the most recent data.",
"location": {
"fieldPathElements": [
{
"fieldName": "conversions",
"index": 1
},
{
"fieldName": "gclid"
}
]
}
}
]
}
]
}
}
আপনার ইমপোর্ট পর্যালোচনা করুন
আপনার সাম্প্রতিক ইম্পোর্টের সামগ্রিক স্বাস্থ্য পর্যালোচনা করতে লিডের জন্য উন্নত কনভার্সন ডায়াগনস্টিক রিপোর্ট ব্যবহার করুন।
GAQL-এর মাধ্যমে আপলোড ডায়াগনস্টিক কোয়েরি করা
এছাড়াও, আপনি কনভার্সন কাস্টমার আইডির জন্য
offline_conversion_upload_client_summary কোয়েরি করে
অ্যাকাউন্ট-লেভেল আপলোড হেলথ, সাম্প্রতিক জব কাউন্ট এবং সমস্যার
অ্যালার্ট প্রোগ্রাম্যাটিক্যালি চেক করতে পারেন:
SELECT
customer.id,
offline_conversion_upload_client_summary.client,
offline_conversion_upload_client_summary.status,
offline_conversion_upload_client_summary.total_event_count,
offline_conversion_upload_client_summary.successful_event_count,
offline_conversion_upload_client_summary.success_rate,
offline_conversion_upload_client_summary.pending_event_count,
offline_conversion_upload_client_summary.pending_rate,
offline_conversion_upload_client_summary.last_upload_date_time,
offline_conversion_upload_client_summary.alerts,
offline_conversion_upload_client_summary.daily_summaries,
offline_conversion_upload_client_summary.job_summaries
FROM offline_conversion_upload_client_summary
ইম্পোর্ট করা কনভার্সন, ইম্পোর্ট করার অনুরোধের তারিখ বা
ClickConversion-এর conversion_date_time-এর তারিখের পরিবর্তে
আসল ক্লিকে ইম্প্রেশনের তারিখের জন্য রিপোর্টে
দেখানো হয়।
শেষ-ক্লিক অ্যাট্রিবিউশনের জন্য আপনার Google Ads অ্যাকাউন্টে ইমপোর্ট করা কনভার্সন পরিসংখ্যান দেখতে তিন ঘণ্টা পর্যন্ত সময় লাগে। অন্যান্য সার্চ অ্যাট্রিবিউশন মডেলের ক্ষেত্রে, তিন ঘণ্টার বেশি সময় লাগতে পারে। আরও তথ্যের জন্য ডেটা ফ্রেশনেস গাইড দেখুন।
আপনার ক্যাম্পেনের কনভার্সন মেট্রিক্সের ব্যাপারে রিপোর্ট করার সময়, Google Ads API রিপোর্টিং ফিল্ডের সাথে Google Ads UI মেট্রিক্সের সম্পর্ক স্থাপন করতে
ইউজার ইন্টারফেস মেট্রিক্স ম্যাপ করা দেখুন। এছাড়াও, আপনি
conversion_action রিসোর্স কোয়েরি করে কোনও নির্দিষ্ট কনভার্সন অ্যাকশনের জন্য মোট কনভার্সনের সংখ্যা এবং মোট কনভার্সন ভ্যালু দেখতে পারেন।
পেশাদার পদ্ধতি
লিডের জন্য উন্নত কনভার্সন প্রয়োগ করার সময় নিম্নলিখিত পেশাদার পদ্ধতিগুলি মনে রাখবেন।
সম্পূর্ণতা নির্বিশেষে সব কনভার্সন ডেটা পাঠান
সম্পূর্ণ ও সঠিক কনভার্সন রিপোর্টিং নিশ্চিত করতে, উপলভ্য সব অফলাইন কনভার্সন ইভেন্ট ইম্পোর্ট করুন, এমনকি Google Ads থেকে আসেনি এমন ইভেন্টও। যেসব কনভার্সনে শুধু ব্যবহারকারীর দেওয়া ডেটা অন্তর্ভুক্ত থাকে সেগুলি এখনও উপযোগী এবং Google Ads ক্যাম্পেন অপ্টিমাইজেশনে ইতিবাচক অবদান রাখতে পারে।
আপনি কোনও কনভার্সনে order_id অ্যাসাইন করলে, আমরা সেটি যোগ করার সাজেশন দিই। আপনার কাছে
কোনও কনভার্সনের GCLID থাকলে, আরও ভালো পারফর্ম্যান্সের জন্য user_identifiers-এর সাথে এটিও পাঠানোর
সাজেশন আমরা দিই। এছাড়াও, কনভার্সনের জন্য আপনার কাছে একাধিক UserIdentifier থাকলে, ম্যাচ করার সম্ভাবনা উন্নত করতে ClickConversion অবজেক্টে
সেগুলির সবকটি অন্তর্ভুক্ত করুন।
একটি অনুরোধে একাধিক কনভার্সন ব্যাচ করুন
আপনার কাছে ইমপোর্ট করার জন্য একাধিক কনভার্সন থাকলে, প্রতিটি কনভার্সনের জন্য ইমপোর্ট করার অনুরোধ পাঠানোর পরিবর্তে,
কনভার্সনগুলিকে একটি
UploadClickConversionsRequest-এ ব্যাচ করুন।
প্রতি অনুরোধে কনভার্সনের সংখ্যার সীমার জন্য কোটা নির্দেশিকা চেক করুন।
আপনি যদি চান যে অফলাইন ডেটা ডায়াগনস্টিক একই লজিক্যাল কাজের অধীনে অনুরোধের একটি সেট
গ্রুপ করুক, তাহলে সব অনুরোধের job_id একই ভ্যালুতে
সেট করুন। আপনার যদি একটি কাজ বা প্রসেস থাকে যা একাধিক অনুরোধ ব্যবহার করে প্রচুর সংখ্যক কনভার্সন ইমপোর্ট করে, তাহলে এটি উপযোগী হতে পারে। আপনি
যদি এই প্রতিটি অনুরোধের job_id একই ভ্যালুতে সেট করেন, তাহলে আপনি
job_summaries থেকে কাজের জন্য একটি এন্ট্রি ফিরিয়ে আনতে পারবেন।
পরিবর্তে, আপনি যদি Google Ads API-কে প্রতিটি অনুরোধের job_id-এ সিস্টেম-জেনারেটেড মান অ্যাসাইন করতে দেন,
তাহলে job_summaries-এ প্রতিটি অনুরোধের জন্য একটি আলাদা এন্ট্রি থাকে,
যা আপনার কাজের সামগ্রিক স্বাস্থ্য বিশ্লেষণ করা আরও চ্যালেঞ্জিং করে তুলতে পারে।
এক্সটার্নাল অ্যাট্রিবিউশন ডেটা ব্যবহার করবেন না
লিডের জন্য উন্নত কনভার্সন ব্যবহার করার সময়, ClickConversion-এ external_attribution_data সেট করবেন না অথবা এক্সটার্নাল অ্যাট্রিবিউশন মডেল ব্যবহার করে এমন conversion_action উল্লেখ করবেন না। ব্যবহারকারীর প্রদান করা ডেটা ব্যবহার করে ইম্পোর্ট করার জন্য Google Ads এক্সটার্নাল অ্যাট্রিবিউশন কনভার্সন
সাপোর্ট করে না।
কাস্টম ভেরিয়েবেল অন্তর্ভুক্ত করবেন না
লিডের জন্য উন্নত কনভার্সন ব্যবহার করার সময়, কোনও
custom_variables অন্তর্ভুক্ত করবেন না। কনভার্সন ইম্পোর্টে ব্যবহারকারীর প্রদান করা ডেটার সাথে কাস্টম ভেরিয়েবল
ব্যবহার করার সুবিধা Google Ads-এ নেই। আপনি কাস্টম ভেরিয়েবল অন্তর্ভুক্ত করলে, Google Ads ব্যবহারকারীর দেওয়া ডেটা উপেক্ষা করে।
সমস্যার সমাধান
অফলাইন ডেটা ডায়াগনস্টিক আপনার ইম্পোর্টের সামগ্রিক স্বাস্থ্য
চলমান ভিত্তিতে পর্যালোচনা করার জন্য একটি একক রিসোর্স প্রদান করে। তবে,
প্রয়োগ করার সময়, আপনি এই বিভাগে দেওয়া তথ্য ব্যবহার করে
উত্তরের partial_failure_error
ফিল্ডে রিপোর্ট করা যেকোনও সমস্যা তদন্ত করতে পারবেন।
কনভার্সন অ্যাকশন ইম্পোর্ট করার সময় সবচেয়ে সাধারণ কিছু সমস্যা হল
অনুমোদন সংক্রান্ত সমস্যা, যেমন USER_PERMISSION_DENIED। আপনার অনুরোধে Google Ads কনভার্সন কাস্টমারের জন্য সেট করা কাস্টমার আইডি আছে কিনা তা ডবল চেক করুন,
যেটি কনভার্সন অ্যাকশনের মালিক। আরও তথ্যের জন্য আমাদের অনুমোদন সংক্রান্ত নির্দেশিকা
দেখুন এবং এইসব বিভিন্ন সমস্যার ডিবাগ কীভাবে করবেন সেই সম্পর্কে পরামর্শ পেতে
আমাদের সাধারণ সমস্যা সংক্রান্ত নির্দেশিকা দেখুন।
সাধারণ সমস্যার সমাধান করা
নিচে দেওয়া নির্দেশিকা আপনাকে লিডের জন্য উন্নত কনভার্সন সংক্রান্ত সাধারণ সমস্যার ডায়াগনসিস করতে ও তা সমাধান করতে সাহায্য করে।
| সমস্যা | |
|---|---|
NO_CONVERSION_ACTION_FOUND
|
নির্দিষ্ট করা কনভার্সন অ্যাকশন চালু করা নেই অথবা অনুরোধের অনুরোধে উল্লেখ করা কনভার্সন অ্যাকশনে অ্যাক্সেস নেই এমন কোনও ক্লায়েন্ট অ্যাকাউন্টের সাথে অনুরোধে উল্লেখ করা GCLID সম্পর্কিত হলে,
এই সমস্যা হতে পারে। আপনি |
INVALID_CONVERSION_ACTION_TYPE
|
নির্দিষ্ট করা কনভার্সন অ্যাকশনের ধরন লিডের জন্য এনহ্যান্সড কনভার্সনের ক্ষেত্রে
উপযুক্ত নয়। আপনার আপলোড করার অনুরোধে উল্লেখ করা ConversionAction-এর
ধরন UPLOAD_CLICKS কিনা তা নিশ্চিত করুন।
|
CUSTOMER_NOT_ENABLED_ENHANCED_CONVERSIONS_FOR_LEADS
|
আপনার কনভার্সন সেটিংসে লিডের জন্য Enhanced Conversions চালু করেছেন কিনা তা নিশ্চিত করুন। প্রয়োজনীয়তা সংক্রান্ত নির্দেশিকায় এই বিষয়ে নির্দেশাবলী দেখুন। |
DUPLICATE_ORDER_ID
|
ইম্পোর্ট করা ইভেন্টে একই অর্ডার আইডি সহ একাধিক কনভার্সন রয়েছে এবং সেগুলি প্রসেস করা হয়নি। অর্ডার আইডি অনন্য কিনা তা ভাল করে দেখে নিয়ে আবার চেষ্টা করুন। |
CLICK_NOT_FOUND
|
প্রদান করা ইউজার আইডেন্টিফায়ারের সাথে ম্যাচ করে এমন কোনও ক্লিক খুঁজে পাওয়া যায়নি।
কোনও কনভার্সনে এই সতর্কতা দেখা গেলে, Google Ads API
আপনার অফলাইন ডেটা ডায়াগনস্টিক-এর ক্লিকটি Google Ads ক্যাম্পেন থেকে না হলে এই সমস্যা দেখা যেতে পারে। যেমন, এটি SA360 বা DV360 থেকে আসতে পারে। অন্যান্য সম্ভাব্য কারণগুলি নিচে উল্লেখ করা হল:
কিছু বিরল ক্ষেত্রে, যেখানে আপলোড করা গ্রাহক Google Ads কনভার্সন গ্রাহকের থেকে আলাদা, সেখানে এই সমস্যার অর্থ হতে পারে যে আপলোড করা গ্রাহক গ্রাহক ডেটা সংক্রান্ত শর্তাবলীতে সম্মতি দিয়েছেন, কিন্তু পরিষেবা প্রদানকারী গ্রাহক দেননি। কোনও অ্যাকাউন্ট গ্রাহক ডেটা সংক্রান্ত শর্তাবলীতে সম্মতি জানিয়েছে কিনা তা আপনিcustomer রিসোর্স কোয়েরি করে এবং
customer.conversion_tracking_setting.accepted_customer_data_terms ফিল্ড চেক করে নির্ধারণ করতে পারবেন।
|