First-party data

[GA4] अपनी वेबसाइट में कोड स्निपेट जोड़ना (gtag.js)

यह सुविधा सबके लिए उपलब्ध बीटा वर्शन में है और इसमें बदलाव हो सकते हैं.

यहां दिए गए निर्देश उन एडमिन और एडिटर के लिए हैं जो उपयोगकर्ता से मिले डेटा को इकट्ठा करने की सुविधा सेट अप कर रहे हैं. साथ ही, gtag.js का इस्तेमाल करके अपनी वेबसाइट में कोड स्निपेट को सेट अप करने का तरीका जानना चाहते हैं. अपनी वेबसाइट का कोड अपडेट करने से यह पक्का होता है कि जब Analytics, उपयोगकर्ता से मिले डेटा को पेज से इकट्ठा करता है, तब उस पेज पर ईमेल पते, फ़ोन नंबर, पते, और/या नाम जैसी जानकारी उपलब्ध हो.

खास जानकारी

अपनी वेबसाइट का कोड अपडेट करने के लिए आपको gtag( ) फ़ंक्शन का इस्तेमाल करके event, config या set कमांड में, उपयोगकर्ता से मिले डेटा के हर फ़ील्ड के साथ-साथ user_data की वैल्यू सेट करनी होगी.

अगर दो या उससे ज़्यादा टाइप के कमांड में एक ही तरह का डेटा पास किया जाता है, तो config कमांड को event कमांड ओवरराइड करेगी और set कमांड को config कमांड ओवरराइड करेगी. Google टैग के पैरामीटर की प्राथमिकता के बारे में जानें.

आपको उन सभी पेजों का कोड अपडेट करना होगा जिनसे उपयोगकर्ता से मिले डेटा को इकट्ठा किया जाता है. जैसे, साइन अप पेज, लीड जनरेशन पेज, चेकआउट पेज या इनसे मिलते-जुलते पेज. आपके पास एक सेशन में, डेटा को Analytics पर एक से ज़्यादा बार भेजने का विकल्प होता है. इससे यह पक्का होता है कि Analytics पर डेटा भेज दिया गया है.

शुरू करने से पहले

आगे बताए गए निर्देशों का पालन करने से पहले, आपको इन ज़रूरी शर्तों को पूरा करना होगा:

  • आपके पास अपनी वेबसाइट के सोर्स कोड का ऐक्सेस हो
  • आपने उपयोगकर्ता से मिले डेटा को इकट्ठा करने की सुविधा चालू की हो और उस डेटा को इस्तेमाल करने की अनुमति दी हो

Hashing the data

You can send hashed or unhashed data from a website. If you send unhashed data, Google normalizes and hashes the data before the data reaches Google's servers. To ensure Analytics interprets the data correctly and to comply with the User-provided data policy, you must use the correct key name (in the next section).

To hash the data:

To normalize the data:

  • Remove leading or trailing whitespaces.
  • Convert the text to lowercase.
  • Format phone numbers according to the E.164 standard.

Defining the fields in your code

You must provide at least one of these fields:

  • Email (preferred).
  • Address (first name, last name, postal code, and country are required). You can optionally provide street address, city, and region as additional match keys.
  • A phone number can also be provided along with an email or full name and address.

Make sure the data is available when the Google tag fires. If the data is collected on a previous page, make sure it’s available in your code on the current page so you can configure the field.

Fields to set

The following table describes each field you can set. The key name shows how you must reference the field in your code. You must pass the data as a String type. When defining name and address, make sure to define each component as an individual variable (for example, first name, last name, and so on).

Note: If you want to send unhashed data and let Google normalize and hash the data, use the first key name for each data field. For example, email in the Email address data field below. If you want to send hashed data, use the key name that begins with sha256_.

Data Field Key Name Description
Email address email

User email.

Example: ‘jdoe@example.com’

sha256_email_address

Hashed user email.

Example:

‘a8af8341993604f29cd4e0e5a5a4b5d48c575436c38b28abbfd7d481f345d5db’

Phone number phone_number

User phone number. Must be in E.164 format, which means it must be 11 to 15 digits including a plus sign (+) prefix and country code with no dashes, parentheses, or spaces.

Example: ‘+11231234567’

sha256_phone_number

Hashed user phone number.

Example:

‘e9d3eef677f9a3b19820f92696be53d646ac4cea500e5f8fd08b00bc6ac773b1’

First name address.first_name

User first name.

Example: 'John'

address.sha256_first_name

Hashed user first name.

Example:

‘96d9632f363564cc3032521409cf22a852f2032eec099ed5967c0d000cec607a’

Surname address.last_name

User last name.

Example: 'Doe'

address.sha256_last_name

Hashed user last name.

Example:

‘799ef92a11af918e3fb741df42934f3b568ed2d93ac1df74f1b8d41a27932a6f’

Street address address.street User street address. Example: '123 New Rd'
City address.city User city name. Example: `Southampton’
Region address.region User province, state, or region. Example: `Hampshire’
Postal code address.postal_code User post code. Example: 'SO99 9XX'
Country address.country User country code. Example: 'UK'. Use 2-letter country codes, per the ISO 3166-1 alpha-2 standard.

अपने कोड में फ़ील्ड लागू करने के बारे में जानकारी

ग्राहक से जुड़े डेटा को इकट्ठा करने वाले हर पेज पर, हर उस फ़ील्ड के लिए user_data पैरामीटर को कॉन्फ़िगर करें जिसे आपको सेट करना है.

उदाहरण देखें

यहां दिए गए सैंपल में, ग्राहक से जुड़े डेटा के वैरिएबल के नाम शामिल हैं. पक्का करें कि आपके कोड में वैरिएबल के नाम, आपकी वेबसाइट के एट्रिब्यूट से मेल खाते हों. उदाहरण के लिए, अगर ईमेल को “email_address” नाम वाले वैरिएबल में स्टोर किया जाता है, तो आपको उसी नाम से स्निपेट को अपडेट करना होगा. जैसे, yourEmailVariable नाम वाला वैरिएबल.

आपके पास स्ट्रिंग का इस्तेमाल करके फ़ील्ड को हार्डकोड करने या वैरिएबल के बजाय फ़ंक्शन का इस्तेमाल करने का विकल्प भी होता है.

// Implement

<script>
gtag('set', 'user_data', {
"email": yourEmailVariable, ***Change yourEmailVariable to the actual Javascript variable name where you are storing the user’s email data. Do the same for the other variables below. Make sure the values aren't hashed.
"phone_number": yourPhoneVariable,
"address": {
"first_name": yourFirstNameVariable,
"last_name": yourLastNameVariable,
"street": yourStreetAddressVariable,
"city":yourCityVariable,
"region": yourRegionVariable,
"postal_code": yourPostalCodeVariable,
"country": yourCountryVariable
}
});
</script>

यह फ़ोन नंबर E.164 फ़ॉर्मैट में होना चाहिए. इसका मतलब है कि यह 11 से 15 अंकों का होना चाहिए. इसमें सबसे पहले प्रीफ़िक्स यानी प्लस का निशान (+) और फिर देश का कोड होना चाहिए. इसमें कोई खाली जगह, ब्रैकेट या डैश नहीं होना चाहिए.

खाली फ़ील्ड हटाने के बारे में जानकारी

अगर आपने पिछले सैंपल कोड से कुछ फ़ील्ड के डेटा को इकट्ठा नहीं किया है, तो उन फ़ील्ड को खाली छोड़ने के बजाय कोड से हटाएं. उदाहरण के लिए, यहां दिखाया गया है कि सिर्फ़ ईमेल पते और फ़ोन नंबर इकट्ठा करने वाली वेबसाइट कैसी दिखेगी:

// Implement
<script>
gtag('set', 'user_data', {
"email": {{ yourEmailVariable }},
"phone_number": {{ yourPhoneVariable }}
});
</script>

कई वैल्यू जोड़ने के बारे में जानकारी

आपके पास एक ऐरे का इस्तेमाल करके कई वैल्यू जोड़ने का विकल्प है. वैल्यू के तौर पर, ज़्यादा से ज़्यादा तीन फ़ोन नंबर और ईमेल पते के साथ-साथ, दो पते जोड़े जा सकते हैं. अगर एक से ज़्यादा वैल्यू कैप्चर की जाती हैं, तो मैच होने की संभावना बढ़ जाएगी.

<script>
gtag('set', 'user_data', {
"email": [yourEmailVariable1, yourEmailVariable2],
"phone_number": [yourPhoneVariable1, yourPhoneVariable2],
"address": [
{
  first_name: yourFirstNameVariable,
  last_name: yourLastNameVariable,
  street: yourStreetAddressVariable,
  city: yourCityVariable,
  region: yourRegionVariable,
  postal_code: yourPostalCodeVariable
},
{
  first_name: yourFirstNameVariable,
  last_name: yourLastNameVariable,
  street: yourStreetAddressVariable,
  city: yourCityVariable2,
  region: yourRegionVariable2,
  postal_code: yourPostalCodeVariable2
}
]
});
</script>

क्या यह उपयोगी था?

हम उसे किस तरह बेहतर बना सकते हैं?
false
खोजें
खोज हटाएं
खोज बंद करें
Google ऐप
मुख्य मेन्यू
2077480162957337271
true
खोज मदद केंद्र
false
true
true
true
true
true
69256
false
false
false
false