অফলাইন রূপান্তর পরিচালনা করুন

আপনি গুগল অ্যাডস এপিআই (Google Ads API) ব্যবহার করে অফলাইন কনভার্সনগুলো গুগল অ্যাডস-এ ইম্পোর্ট করতে পারেন, যার মাধ্যমে অফলাইন জগতে (যেমন ফোনে বা কোনো সেলস প্রতিনিধির মাধ্যমে) বিক্রি হওয়া বিজ্ঞাপনগুলো ট্র্যাক করা যায়।

In order to fully take advantage of the benefits of importing conversion data, we recommend implementing enhanced conversions for leads, which leverages GCLIDs and user-provided data to maximize durability and performance.

উন্নত রূপান্তর

Enhanced conversions help you to improve the accuracy of your conversion measurement by supplementing your conversions with first-party conversion data, like email address, phone number, and mailing address.

উন্নত রূপান্তর দুই প্রকারের হয়। আরও বিস্তারিত জানতে, ‘উন্নত রূপান্তর সম্পর্কে’ দেখুন।

নিম্নলিখিত বিভাগে অফলাইন রূপান্তর কীভাবে উন্নত করা যায় তা ব্যাখ্যা করা হয়েছে, এই বৈশিষ্ট্যটি লিডের জন্য উন্নত রূপান্তর হিসাবেও পরিচিত।

লিডের জন্য বর্ধিত রূপান্তর বলতে কী বোঝায়?

লিডের জন্য উন্নত কনভার্সন হলো অফলাইন কনভার্সন ইম্পোর্টের একটি আপগ্রেড সংস্করণ, যা নির্ভুলতা এবং বিডিং পারফরম্যান্স উন্নত করার জন্য ইম্পোর্ট করা অফলাইন কনভার্সন ডেটার পরিপূরক হিসেবে ব্যবহারকারীর দেওয়া ডেটা, যেমন ইমেল অ্যাড্রেস, ব্যবহার করে। আপনি যখন আপনার অফলাইন কনভার্সন ইম্পোর্ট করেন, তখন প্রদত্ত হ্যাশ করা গ্রাহক ডেটা আপনার ওয়েবসাইটে সংগৃহীত একই ডেটার (যেমন একটি লিড ফর্ম) সাথে এবং আপনার বিজ্ঞাপনের সাথে যুক্ত হওয়া সাইন-ইন করা গ্রাহকদের সাথে মিলিয়ে গুগল অ্যাডস ক্যাম্পেইনের সাথে সংযুক্ত করতে ব্যবহৃত হয়। আরও তথ্যের জন্য, ‘লিডের জন্য উন্নত কনভার্সন সম্পর্কে’ দেখুন।

There are two ways to implement enhanced conversions for leads depending on whether you use the Google tag to track form submission events on your webpage. For the best performance and durability, we recommend using Google tag for enhanced conversions for leads.

  • আপনি যদি একেবারে শুরু থেকে শুরু করেন, তাহলে পূর্বশর্ত অংশটি দিয়ে শুরু করুন।
  • আপনার যদি ইতিমধ্যেই অফলাইন কনভার্সন ইম্পোর্ট সেট আপ করা থাকে এবং আপনি লিডগুলির জন্য উন্নত কনভার্সনে আপগ্রেড করতে চান, তাহলে আমরা ট্যাগিং কনফিগার করুন (Configure tagging) বিভাগটি দিয়ে শুরু করার পরামর্শ দিই।
  • যদি আপনি ইতিমধ্যেই গুগল ট্যাগ সেট আপ করে থাকেন, অথবা গুগল ট্যাগ ব্যবহার করার পরিকল্পনা না থাকে এবং আপনার গুগল অ্যাডস এপিআই ইন্টিগ্রেশনের কাজ শুরু করতে চলেছেন, তাহলে সরাসরি এপিআই ইমপ্লিমেন্টেশন বিভাগে চলে যান।
  • যদি আপনি ব্যবহারকারী-প্রদত্ত ডেটা ইম্পোর্ট করতে না পারেন, অথবা আপনার রূপান্তরের জন্য বাহ্যিক অ্যাট্রিবিউশনের উপর নির্ভর করেন, তাহলে লিগ্যাসি অফলাইন কনভার্সন ইমপোর্টস গাইডটি দেখুন।

পূর্বশর্ত

প্রথমে, আমাদের 'শুরু করার নির্দেশিকা' বিভাগে দেওয়া ধাপগুলো আপনি সম্পন্ন করেছেন কিনা তা যাচাই করে নিন।

You must opt in to enhanced conversions for leads and accept the customer data terms before you can use enhanced conversions for leads. You can verify whether these prerequisites are already met by issuing the following query to the Google Ads conversion customer:

SELECT
  customer.id,
  customer.conversion_tracking_setting.accepted_customer_data_terms,
  customer.conversion_tracking_setting.enhanced_conversions_for_leads_enabled
FROM customer

যদি accepted_customer_data_terms অথবা enhanced_conversions_for_leads_enabled এর কোনো একটি false হয়, তাহলে এই পূর্বশর্তগুলো সম্পূর্ণ করতে Create a new conversion action- এর নির্দেশাবলী অনুসরণ করুন।

ট্যাগিং কনফিগার করুন

Configure the Google tag to enable enhanced conversions for leads by following the instructions to Configure Google tag settings . To set up enhanced conversions for leads with Google Tag Manager, follow these instructions .

এপিআই বাস্তবায়ন

গুগল অ্যাডস এপিআই ব্যবহার করে লিডগুলোর জন্য উন্নত কনভার্সন ইম্পোর্ট করার সামগ্রিক কার্যপ্রবাহ নিচে দেওয়া হলো।

  1. ব্যবহারকারীর দেওয়া ডেটা, যেমন ইমেল ঠিকানা, ফোন নম্বর এবং ডাক ঠিকানা, স্বাভাবিক করুন এবং হ্যাশ করুন

  2. ClickConversion অবজেক্টগুলি পূরণ করুন

    স্বাভাবিকীকৃত এবং হ্যাশ করা ব্যবহারকারী-প্রদত্ত ডেটা সহ

  3. ConversionUploadService ব্যবহার করে Google Ads API-তে ClickConversion অবজেক্টগুলো ইম্পোর্ট করুন । আরও বিস্তারিত জানতে UploadClickConversions দেখুন।

  4. আপনার আমদানিগুলো পর্যালোচনা করুন

আপনার রূপান্তর ক্রিয়া রিসোর্সের নাম পুনরুদ্ধার করুন

To upload conversions, you must specify the resource name of the ConversionAction you've set up in Google Ads for importing click conversions. You can find the resource name by querying the conversion_action resource using the following GAQL query:

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 ব্যবহার করে হ্যাশ করতে হবে:

  • ইমেইল ঠিকানা
  • ফোন নম্বর
  • প্রথম নাম
  • শেষ নাম
  • রাস্তার ঠিকানা

হ্যাশ ফলাফলগুলোকে মানসম্মত করার জন্য, এই মানগুলোর প্রত্যেকটিকে হ্যাশ করার আগে নিম্নলিখিত কাজগুলো করুন:

  • শুরুতে ও শেষে থাকা অতিরিক্ত স্পেস মুছে ফেলুন।
  • লেখাটিকে ছোট হাতের অক্ষরে রূপান্তর করুন।
  • E164 স্ট্যান্ডার্ড অনুযায়ী ফোন নম্বর ফরম্যাট করুন।

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

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

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

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

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

      • উদাহরণ: Jane.Doe+Shopping@googlemail.com প্রথমে jane.doe+shopping@googlemail.com (ছোট হাতের অক্ষরে) হয়, এবং তারপর janedoe@googlemail.com হয় (Gmail/Googlemail-এর নির্দিষ্ট নিয়ম অনুযায়ী)।
    • Other domains: Email addresses from any domain other than gmail.com or googlemail.com should NOT have periods or plus suffixes removed from the username. Only apply the standard normalization (lowercase, trim whitespace) to these addresses.

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

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

নিম্নলিখিত ডেটা হ্যাশ করবেন না :

  • দেশ
  • রাজ্য
  • শহর
  • জিপ কোড

কোডের উদাহরণ

এই উদাহরণটি দেখায় কিভাবে ব্যবহারকারীর দেওয়া ডেটা নর্মালাইজ এবং হ্যাশ করতে হয়।

জাভা

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 preceding {@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 {
  String normalizedEmail = emailAddress.toLowerCase();
  String[] emailParts = normalizedEmail.split("@");
  if (emailParts.length > 1 && emailParts[1].matches("^(gmail|googlemail)\\.com\\s*")) {
    // 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("\\.", "");
    normalizedEmail = String.format("%s@%s", emailParts[0], emailParts[1]);
  }
  return normalizeAndHash(digest, normalizedEmail);
}
      

সি#

/// <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();
}
      

পিএইচপি

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);
}
      

পাইথন

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()
      

রুবি

# 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
      

পার্ল

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 অবজেক্টগুলি পূরণ করুন

The collection of ClickConversion objects in your UploadClickConversionRequest represents the set of conversions you want to import. Keep the following details in mind when creating ClickConversion objects:

gclid

যখন কোনো ব্যক্তি আপনার বিজ্ঞাপনে ক্লিক করে আপনার ওয়েবসাইটে প্রবেশ করে, তখন ইউআরএল প্যারামিটার থেকে GCLID-গুলো সংগ্রহ করা হয়।

gbraid

gbraid হলো একটি URL প্যারামিটার, যা তখন উপস্থিত থাকে যখন কোনো ব্যবহারকারী ওয়েবে কোনো বিজ্ঞাপনে ক্লিক করে আপনার iOS অ্যাপে চলে যান।

wbraid

wbraid হলো একটি URL প্যারামিটার, যা তখন উপস্থিত থাকে যখন কোনো ব্যবহারকারী একটি iOS অ্যাপে কোনো বিজ্ঞাপনে ক্লিক করে আপনার ওয়েবপেজে চলে যান।

cart_data

Contains item-level details about a conversion. Populating the cart_data field is required to report on basket data—such as items purchased, price, and quantity—in the Google Ads UI. See the CartData object definition for the required structure, and learn more About conversions with cart data .

user_identifiers

When using enhanced conversions for leads, you must populate the user_identifiers field with normalized and hashed user-provided data. If you have multiple user identifiers available, create a separate UserIdentifier for each one, up to five identifiers.

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_code

conversion_value এর মুদ্রা কোড

consent

ClickConversion অবজেক্টের consent ফিল্ডটি পূরণ করার জন্য বিশেষভাবে সুপারিশ করা হচ্ছে। এটি সেট করা না থাকলে, আপনার কনভার্সনগুলো অ্যাট্রিবিউটেবল নাও হতে পারে।

order_id

Also known as the transaction ID for the conversion. This field is optional, but strongly recommended, because it makes it simpler to reference imported conversions when making adjustments . If you set it during the import, you must use it for any adjustments. To learn more about how to use a transaction ID to minimize duplicate conversions, see this Help Center article .

custom_variables

কাস্টম রূপান্তর ভেরিয়েবলগুলোর মান।

Google Ads, wbraid বা gbraid সাথে কাস্টম কনভার্সন ভ্যারিয়েবল ব্যবহার সমর্থন করে না।

conversion_environment

যে পরিবেশে এই রূপান্তরটি রেকর্ড করা হয়েছিল তা নির্দেশ করে। উদাহরণস্বরূপ, APP বা WEB

session_attributes_encoded এবং session_attributes_key_value_pairs

সেশন অ্যাট্রিবিউট হলো সমষ্টিগত শনাক্তকারী যা কনভার্সন অ্যাট্রিবিউশনের জন্য ব্যবহৃত হয়। এগুলো GCLID, URL প্যারামিটার (যেমন GBRAID) এবং ব্যবহারকারীর দেওয়া ডেটার পাশাপাশি কাজ করে, যা লিডদের জন্য উন্নত কনভার্সনের কেন্দ্রবিন্দু। সেশন অ্যাট্রিবিউট ইম্পোর্ট করার দুটি উপায় আছে: ব্রাউজারে আমাদের জাভাস্ক্রিপ্ট কোড দ্বারা তৈরি এনকোডেড টোকেন প্রদান করে, অথবা প্রতিটি শনাক্তকারীর জন্য আলাদা কী-ভ্যালু পেয়ার প্রদান করে।

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

জাভা

// 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());
}
      

সি#

// 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);
}
      

পিএইচপি

This example is not yet available in PHP; you can take a look at the other languages.
    

পাইথন

# 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
        )
      

রুবি

# 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    
      

পার্ল

# 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::V24::Services::ConversionUploadService::SessionAttributeKeyValuePair
      ->new({sessionAttributeKey => $key, sessionAttributeValue => $value});
    push @{$click_conversion->{sessionAttributesKeyValuePairs}{keyValuePairs}
    }, $pair;
  }
}
      

কার্ল

user_ip_address

The IP address of the customer when they arrived on the landing page after an ad click and before a conversion event. This is the IP address of the customer's device, not the advertiser's server.

এই ফিল্ডটি হলো একটি স্ট্রিং যা IPv4 অথবা IPv6 ফরম্যাটে একটি আইপি অ্যাড্রেসকে উপস্থাপন করে। উদাহরণস্বরূপ:

  • IPv4: "192.0.2.0"
  • IPv6: "2001:0DB8:1234:5678:9999:1111:0000:0001"

কোডের উদাহরণ

এই উদাহরণটি দেখায় কিভাবে আপনার নর্মালাইজড এবং হ্যাশ করা ব্যবহারকারী-প্রদত্ত ডেটা একটি ClickConversion অবজেক্টে সেট করতে হয়।

জাভা

// 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@example.com")
        // Phone number to be converted to E.164 format, with a leading '+' as required.
        .put("phone", "+1 800 5550102")
        // 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(normalizeAndHash(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);
      

সি#

// 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"
    }
});
      

পিএইচপি

// 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);
      

পাইথন

# 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)
      

রুবি

# 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
      

পার্ল

# Create an empty click conversion.
my $click_conversion =
  Google::Ads::GoogleAds::V24::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::V24::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::V24::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::V24::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 অবজেক্টে অন্যান্য প্রয়োজনীয় ফিল্ড সেট করতে হয়।

জাভা

// 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();
      

সি#

// 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);
}

      

পিএইচপি

// 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);
}
      

পাইথন

# 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
        )
      

রুবি

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    
      

পার্ল

# Add details of the conversion.
$click_conversion->{conversionAction} =
  Google::Ads::GoogleAds::V24::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::V24::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::V24::Services::ConversionUploadService::SessionAttributeKeyValuePair
      ->new({sessionAttributeKey => $key, sessionAttributeValue => $value});
    push @{$click_conversion->{sessionAttributesKeyValuePairs}{keyValuePairs}
    }, $pair;
  }
}
      

কার্ল

অনুরোধটি তৈরি করুন

Once your ClickConversion objects are configured and added to the conversions field of the UploadClickConversionRequest object, set the following fields and pass the request to the UploadClickConversions method on the ConversionUploadService .

customer_id
Set this to the Google Ads conversion customer of the account that is the source of the clicks. If you're unsure which account is the correct one, refer to the customer.conversion_tracking_setting.google_ads_conversion_customer field in the example query in the getting started section.
job_id

অফলাইন ডেটা ডায়াগনস্টিক্সে প্রতিটি কাজের তথ্যের সাথে আপনার ইম্পোর্ট অনুরোধগুলিকে সংযুক্ত করার একটি পদ্ধতি প্রদান করে।

If you don't set this field, the Google Ads API assigns each request a unique value in the range of [2^31, 2^63) . If you would prefer to group multiple requests into a single logical job, set this field to the same value in the range [0, 2^31) on every request in your job.

আপনি কোনো মান নির্দিষ্ট করে দিন বা গুগল অ্যাডস এপিআই-কে মান নির্ধারণ করতে দিন, রেসপন্সের job_id তে অনুরোধটির জব আইডি থাকে।

partial_failure

রূপান্তর আমদানি করার সময় এই ফিল্ডটি অবশ্যই ' true সেট করতে হবে। প্রতিক্রিয়া প্রক্রিয়া করার সময় আংশিক ব্যর্থতা সংক্রান্ত নির্দেশিকা অনুসরণ করুন।

অনুরোধটি আমদানি করুন

একবার আপনি আপনার ClickConversion অবজেক্টগুলো পূরণ করে এবং আপনার অনুরোধটি তৈরি করে ফেললে, আপনি আপনার ইম্পোর্টটি জমা দিতে পারেন।

জাভা

// 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());
      

সি#

// 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
        });

      

পিএইচপি

// 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)
);
      

পাইথন

# 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,
    )
)
      

রুবি

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
      

পার্ল

# 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"
  });
      

কার্ল

আপনার আমদানি পর্যালোচনা করুন

আপনার সাম্প্রতিক ইম্পোর্টগুলোর সার্বিক অবস্থা পর্যালোচনা করতে লিড ডায়াগনস্টিকস রিপোর্টের উন্নত রূপান্তরগুলো ব্যবহার করুন।

Imported conversions are reflected in reports for the impression date of the original click , not the date of the import request or the date of the conversion_date_time of the ClickConversion .

It takes up to three hours for imported conversion statistics to appear in your Google Ads account for last-click attribution. For other search attribution models, it can take longer than three hours. Consult the data freshness guide for more information.

When reporting on conversion metrics for your campaigns, refer to Mapping user interface metrics to correlate Google Ads UI metrics with Google Ads API reporting fields. You can also query the conversion_action resource to view the total number of conversions and the total conversion value for a given conversion action.

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

লিডের রূপান্তর বৃদ্ধি করার সময় নিম্নলিখিত সর্বোত্তম অনুশীলনগুলি মনে রাখবেন।

সম্পূর্ণতা নির্বিশেষে সমস্ত রূপান্তর ডেটা পাঠান।

To ensure full and accurate conversion reporting, import all available offline conversion events, including those that might not have come from Google Ads. Conversions that include only user-provided data are still useful and can contribute positively to Google Ads campaign optimization.

If you assign an order_id to a conversion, we recommend including it. If you have the GCLID for a conversion, we recommend sending it in addition to the user_identifiers for improved performance. Furthermore, if you have more than one UserIdentifier for the conversion, include all of them on the ClickConversion object to improve the likelihood of a match.

একটি অনুরোধে একাধিক রূপান্তর একসাথে করুন

আপনার যদি একাধিক কনভার্সন ইম্পোর্ট করার থাকে, তবে প্রতিটি কনভার্সনের জন্য আলাদা ইম্পোর্ট রিকোয়েস্ট না পাঠিয়ে, সবগুলোকে একসাথে একটি UploadClickConversionsRequest এ যুক্ত করুন।

প্রতি অনুরোধে রূপান্তরের সংখ্যার সীমা জানতে কোটা নির্দেশিকা দেখুন।

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

বাহ্যিক অ্যাট্রিবিউশন ডেটা ব্যবহার করবেন না।

When using enhanced conversions for leads, don't set external_attribution_data on the ClickConversion or specify a conversion_action that uses an external attribution model. Google Ads doesn't support externally attributed conversions for imports using user-provided data.

কাস্টম ভেরিয়েবল অন্তর্ভুক্ত করবেন না।

When using enhanced conversions for leads, don't include any custom_variables . Google Ads doesn't support the use of custom variables with user-provided data in conversion imports. If custom variables are included with conversions that contain user-provided data, those conversions will be considered invalid and dropped.

সমস্যা সমাধান

Offline data diagnostics provide a single resource for reviewing the overall health of your imports on an ongoing basis. However, during implementation you can use the information in this section to investigate any errors reported in the partial_failure_error field of the response.

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

সাধারণ ত্রুটিগুলি ডিবাগ করুন

ত্রুটি
NO_CONVERSION_ACTION_FOUND

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

অনুরোধে থাকা GCLID যদি এমন কোনো ক্লায়েন্ট অ্যাকাউন্টের হয়, যেটির অনুরোধে উল্লেখিত রূপান্তর ক্রিয়াটিতে অ্যাক্সেস নেই, তাহলেও এই ত্রুটিটি ঘটতে পারে। আপনি click_view রিসোর্স ব্যবহার করে একটি GCLID কোনো ক্লায়েন্ট অ্যাকাউন্টের কিনা তা যাচাই করতে পারেন। এর জন্য আপনাকে click_view.gclid এবং segments.date দ্বারা ফিল্টার করে একটি কোয়েরি জমা দিতে হবে, যেখানে date হলো ক্লিকটি সংঘটিত হওয়ার তারিখ।

INVALID_CONVERSION_ACTION_TYPE নির্দিষ্ট কনভার্সন অ্যাকশনটির টাইপটি লিডের এনহ্যান্সড কনভার্সনের জন্য বৈধ নয়। নিশ্চিত করুন যে আপনার আপলোড রিকোয়েস্টে নির্দিষ্ট করা ConversionAction টাইপ UPLOAD_CLICKS
CUSTOMER_NOT_ENABLED_ENHANCED_CONVERSIONS_FOR_LEADS আপনার কনভার্সন সেটিংসে লিডদের জন্য এনহ্যান্সড কনভার্সন চালু করা আছে কিনা, তা নিশ্চিত করুন। এর জন্য নির্দেশাবলী পূর্বশর্ত নির্দেশিকায় খুঁজুন।
DUPLICATE_ORDER_ID ইম্পোর্ট করা ইভেন্টগুলোতে একই অর্ডার আইডি সহ একাধিক কনভার্সন রয়েছে যা প্রসেস করা হয়নি। অর্ডার আইডিগুলো যেন অনন্য হয় তা নিশ্চিত করুন এবং আবার চেষ্টা করুন।
CLICK_NOT_FOUND প্রদত্ত ব্যবহারকারী শনাক্তকারীর সাথে মেলে এমন কোনো ক্লিক খুঁজে পাওয়া যায়নি। Google Ads API শুধুমাত্র তখনই এই ত্রুটিটি ফেরত দেয়, যখন UploadClickConversionsRequestdebug_enabled true থাকে।

If a conversion encounters this warning, the Google Ads API includes it in the successful_event_count of your offline data diagnostics . The Google Ads API includes an entry for CLICK_NOT_FOUND in the alerts collection so you can monitor the frequency of this warning.

This error is expected if the click is not from a Google Ads campaign. For example it may come from SA360 or DV360 . Other possible causes are as follows:

বিরল কিছু ক্ষেত্রে, যখন আপলোডকারী গ্রাহক এবং গুগল অ্যাডস কনভার্সন গ্রাহক ভিন্ন হন, তখন এই ত্রুটির অর্থ হতে পারে যে আপলোডকারী গ্রাহক গ্রাহক ডেটার শর্তাবলী গ্রহণ করেছেন, কিন্তু পরিষেবা প্রদানকারী গ্রাহক তা করেননি।

You can determine if an account has accepted the customer data terms by querying the customer resource and checking the customer.offline_conversion_tracking_info.accepted_customer_data_terms field.