ग्राहक मिलान वाली ऑडियंस अपलोड करें

Display & Video 360 API का इस्तेमाल करके, अपलोड की गई ग्राहक की संपर्क जानकारी या मोबाइल डिवाइस आईडी का इस्तेमाल करके, कस्टमर मैच ऑडियंस बनाई जा सकती हैं. इस पेज पर बताया गया है कि Display & Video 360 API का इस्तेमाल करके, कस्टमर मैच वाली शुरुआती ऑडियंस कैसे बनाई जाती है. साथ ही, मौजूदा ऑडियंस में नए ग्राहक का डेटा कैसे जोड़ा जाता है.

उपयोगकर्ता का डेटा तैयार करना

कस्टमर मैच ऑडियंस को पॉप्युलेट करने के लिए इस्तेमाल किया जाने वाला उपयोगकर्ता का डेटा संवेदनशील होता है. इसलिए, इसे अपलोड करने से पहले सही तरीके से तैयार करना ज़रूरी है.

संवेदनशील जानकारी को हैश करना

कस्टमर मैच की कुछ ऑडियंस, ग्राहक की संवेदनशील संपर्क जानकारी का इस्तेमाल करके बनाई जाती हैं. Display & Video 360 के लिए, संवेदनशील डेटा को अपलोड करने से पहले, SHA256 एल्गोरिदम का इस्तेमाल करके हैश करना ज़रूरी है. अपलोड करने से पहले, इन डेटा फ़ील्ड को हैश करना ज़रूरी है:

  • नाम
  • उपनाम
  • ईमेल पते
  • फ़ोन नंबर

अपलोड करने से पहले, पिन कोड और देश के कोड हैश नहीं किए जाने चाहिए. बिना हैश किए गए ग्राहक डेटा को अपलोड करने पर गड़बड़ी होती है.

डेटा को हैश करने से पहले, पक्का करें कि ये शर्तें पूरी हों:

  • पहले नाम, सरनेम, और ईमेल पते की वैल्यू से सभी खाली जगहें हटाई जानी चाहिए.
  • सभी वैल्यू को लोअरकेस में होना चाहिए.
  • सभी फ़ोन नंबर, E.164 फ़ॉर्मैट में होने चाहिए. साथ ही, उनमें देश का कॉलिंग कोड भी शामिल होना चाहिए.

उपयोगकर्ता का डेटा अपलोड करते समय, दिए गए ContactInfoList या MobileDeviceIdList ऑब्जेक्ट में मौजूद consent फ़ील्ड का इस्तेमाल करें. इससे, शामिल किए गए उपयोगकर्ताओं की दी गई सहमति के सिग्नल पास किए जा सकेंगे.

Consent ऑब्जेक्ट में किसी भी फ़ील्ड को CONSENT_STATUS_DENIED पर सेट करने से गड़बड़ी होती है.

सहमति के सिग्नल, एक ही firstPartyAndPartnerAudiences.create या firstPartyAndPartnerAudiences.editCustomerMatchMembers अनुरोध में जोड़े गए सभी उपयोगकर्ताओं के लिए सेट किए जाते हैं. सहमति के अलग-अलग सिग्नल वाले उपयोगकर्ताओं के डेटा को अलग-अलग अनुरोधों में अपलोड किया जाना चाहिए.

कस्टमर मैच के लिए ऑडियंस बनाना

कस्टमर मैच ऑडियंस को firstPartyAndPartnerAudiences.create तरीके का इस्तेमाल करके बनाया जा सकता है. ऑडियंस को पहले पक्ष की ऑडियंस के तौर पर घोषित किया जाना चाहिए. साथ ही, उसके पास audienceType का CUSTOMER_MATCH_CONTACT_INFO या CUSTOMER_MATCH_DEVICE_ID होना चाहिए. कस्टमर मैच डेटा, यूनियन फ़ील्ड members में मौजूद सही फ़ील्ड का इस्तेमाल करके दिया जाना चाहिए.

यहां हैश किए गए फ़ोन नंबर की दी गई सूची का इस्तेमाल करके, 540 दिनों की सदस्यता अवधि वाली संपर्क जानकारी के आधार पर कस्टमर मैच वाली नई ऑडियंस बनाने का तरीका बताया गया है:

Java

// Create Customer Match audience object.
FirstPartyAndPartnerAudience customerMatchAudience =
    new FirstPartyAndPartnerAudience()
        .setDisplayName(display-name)
        .setFirstPartyAndPartnerAudienceType(
            "FIRST_AND_THIRD_PARTY_AUDIENCE_TYPE_FIRST_PARTY"
        )
        .setAudienceType("CUSTOMER_MATCH_CONTACT_INFO")
        .setMembershipDurationDays(540L);

// Build list of contact information objects.
ContactInfoList contactInfoList = new ContactInfoList();
ArrayList<ContactInfo> contactInfos = new ArrayList<ContactInfo>();
for (String hashedPhoneNumber : list-of-hashed-phone-numbers) {
  ContactInfo contactInfo = new ContactInfo();
  ArrayList<String> phoneNumberList = new ArrayList<String>();
  phoneNumberList.add(hashedPhoneNumber);
  contactInfo.setHashedPhoneNumbers(phoneNumberList);
  contactInfos.add(contactInfo);
}
contactInfoList.setContactInfos(contactInfos);

// Build consent object for passing consent if granted by the end user.
Consent consent =
    new Consent()
        .setAdUserData(ad-user-data-consent)
        .setAdPersonalization(ad-personalization-consent);
ContactInfoList.setConsent(consent);

// Assign contact info list to Customer Match audience.
customerMatchAudience.setContactInfoList(contactInfoList);

// Create Customer Match audience.
FirstPartyAndPartnerAudience response =
    service
        .firstPartyAndPartnerAudiences()
        .create(customerMatchAudience)
        .setAdvertiserId(advertiser-id)
        .execute();

// Display name of new audience.
System.out.printf(
    "Customer Match audience %s was created.",
    response.getName()
);

Python

# Build list of Contact Info objects
contact_infos = []
for hashed_phone_number in list-of-hashed-phone-numbers:
  contact_infos.append({'hashedPhoneNumbers': [hashed_phone_number]})

# Create a Customer Match first- and third-party audience object.
audience_obj = {
    'displayName': display-name,
    'firstPartyAndPartnerAudienceType':
        'FIRST_AND_THIRD_PARTY_AUDIENCE_TYPE_FIRST_PARTY',
    'audienceType': 'CUSTOMER_MATCH_CONTACT_INFO',
    'membershipDurationDays': 540,
    'contactInfoList': {
        'contactInfos': [
            contact_infos
        ],
        'consent': {
            'adUserData': ad-user-data-consent,
            'adPersonalization': ad-personalization-consent
        }
    }
}

# Build and execute request.
audience = service.firstPartyAndPartnerAudiences().create(
    advertiserId=advertiser-id,
    body=audience_obj
).execute()

# Display name of new audience.
print('Customer Match audience %s was created.' % audience["name"])

PHP

// Create a Customer Match first-party and partner audience object.
$audience = new Google_Service_DisplayVideo_FirstPartyAndPartnerAudience();
$audience->setDisplayName(display-name);
$audience->setFirstPartyAndPartnerAudienceType(
    'FIRST_AND_THIRD_PARTY_AUDIENCE_TYPE_FIRST_PARTY'
);
$audience->setAudienceType('CUSTOMER_MATCH_CONTACT_INFO');
$audience->setMembershipDurationDays(540);

// Build list of contact information objects.
$contactInfoList = new Google_Service_DisplayVideo_ContactInfoList();
$contactInfos = array();
foreach (list-of-hashed-phone-numbers as $hashedPhoneNumber) {
    $contactInfo = new Google_Service_DisplayVideo_ContactInfo();
    $contactInfo->setHashedPhoneNumbers(array($hashedPhoneNumber));
    $contactInfos[] = $contactInfo;
}
$contactInfoList->setContactInfos($contactInfos);

// Build consent object for passing consent if granted by the end user.
$consent = new Google_Service_DisplayVideo_Consent();
$consent->setAdUserData(ad-user-data-consent);
$consent->setAdPersonalization(ad-personalization-consent);
$contactInfoList->setConsent($consent);

// Assign contactInfoList to audience object.
$audience->setContactInfoList($contactInfoList);

// Call the API, creating the audience.
$result = $this->service->firstPartyAndPartnerAudiences->create(
    $audience,
    array('advertiserId' => advertiser-id)
);

// Display name of new audience.
printf('Customer Match audience %s was created.', $result['name']);

कस्टमर मैच ऑडियंस की सदस्यता अपडेट करना

अगर आपको ऐसे अतिरिक्त ग्राहकों की पहचान करनी है जिन्हें टारगेट करना है, ग्राहकों की मौजूदा ऑडियंस की सदस्यताएं रिन्यू करनी हैं या किसी ऑडियंस से ग्राहकों को हटाना है, तो firstPartyAndPartnerAudiences.editCustomerMatchMembers तरीके का इस्तेमाल करके, मौजूदा कस्टमर मैच ऑडियंस के ग्राहक डेटा को अपडेट किया जा सकता है. added_members यूनियन फ़ील्ड का इस्तेमाल करके, ग्राहकों को किसी सूची में जोड़ा जा सकता है. साथ ही, removed_members यूनियन फ़ील्ड का इस्तेमाल करके, ग्राहकों को किसी सूची से हटाया जा सकता है.

एक firstPartyAndPartnerAudiences.editCustomerMatchMembers अनुरोध से, सिर्फ़ सूची में सदस्यों को जोड़ा या हटाया जा सकता है. एक ही अनुरोध में दोनों काम करने की कोशिश करने पर, INVALID_ARGUMENT गड़बड़ी होती है.

यहां एक उदाहरण दिया गया है. इसमें बताया गया है कि दिए गए डाक पते के डेटा का इस्तेमाल करके, किसी एक ग्राहक को संपर्क जानकारी वाली मौजूदा कस्टमर मैच ऑडियंस में सदस्य के तौर पर कैसे जोड़ा जाता है:

Java

// Create an edit members request object.
EditCustomerMatchMembersRequest editCustomerMatchMembersRequest =
    new EditCustomerMatchMembersRequest()
        .setAdvertiserId(advertiser-id);

// Build contact information object to add to audience.
ContactInfoList contactInfoList = new ContactInfoList();
ArrayList<ContactInfo> contactInfos = new ArrayList<ContactInfo>();
ContactInfo contactInfo =
    new ContactInfo()
        .setHashedFirstName(hashed-customer-first-name)
        .setHashedLastName(hashed-customer-last-name)
        .setZipCodes(customer-zip-codes-list)
        .setCountryCode(customer-country-code);
contactInfos.add(contactInfo);
contactInfoList.setContactInfos(contactInfos);

// Build consent object for passing consent if granted by the end user.
Consent consent =
    new Consent()
        .setAdUserData(ad-user-data-consent)
        .setAdPersonalization(ad-personalization-consent);
ContactInfoList.setConsent(consent);

// Assign contact info list to request body.
editCustomerMatchMembersRequest.setAddedContactInfoList(contactInfoList);

// Edit Customer Match audience membership.
EditCustomerMatchMembersResponse response =
    service
        .firstPartyAndPartnerAudiences()
        .editCustomerMatchMembers(
            audience-id,
            editCustomerMatchMembersRequest
        )
        .execute();

// Display ID of updated audience.
System.out.printf(
    "The membership of Customer Match audience ID %s was edited.",
    response.getFirstPartyAndPartnerAudienceId()
);

Python

# Create an edit members request object.
edit_member_request_obj = {
    'advertiserId': advertiser-id,
    'addedContactInfoList': {
        'contactInfos': [
            {
                'hashedFirstName': hashed-customer-first-name,
                'hashedLastName': hashed-customer-last-name,
                'countryCode': customer-country-code,
                'zipCodes': customer-zip-codes-list
            }
        ],
        'consent': {
          'adUserData': ad-user-data-consent,
          'adPersonalization': ad-personalization-consent
        }
    }
}

# Build and execute request.
response = service.firstPartyAndPartnerAudiences().editCustomerMatchMembers(
    firstPartyAndPartnerAudienceId=audience-id,
    body=edit_member_request_obj
).execute()

# Display ID of updated audience.
print('The membership of the Customer Match audience ID %s was updated.'
      % response["firstPartyAndPartnerAudienceId"])

PHP

// Create an edit members request object.
$editMemberRequest =
    new Google_Service_DisplayVideo_EditCustomerMatchMembersRequest();
$editMemberRequest->setAdvertiserId(advertiser-id);

// Build contact information object to add to audience.
$contactInfoList = new Google_Service_DisplayVideo_ContactInfoList();
$contactInfos = array();
$contactInfo = new Google_Service_DisplayVideo_ContactInfo();
$contactInfo->setHashedFirstName(hashed-customer-first-name);
$contactInfo->setHashedLastName(hashed-customer-last-name);
$contactInfo->setCountryCode(customer-country-code);
$contactInfo->setZipCodes(array(customer-zip-codes-list));
$contactInfos[] = $contactInfo;
$contactInfoList->setContactInfos($contactInfos);

// Build consent object for passing consent if granted by the end user.
$consent = new Google_Service_DisplayVideo_Consent();
$consent->setAdUserData(ad-user-data-consent);
$consent->setAdPersonalization(ad-personalization-consent);
$contactInfoList->setConsent($consent);

// Assign contactInfoList to edit members request body.
$editMemberRequest->setAddedContactInfoList($contactInfoList);

// Call the API, editing the audience membership.
$response = $this
    ->service
    ->firstPartyAndPartnerAudiences
    ->editCustomerMatchMembers(
        audience-id,
        $editMemberRequest
    );

// Display ID of updated audience.
printf(
    'The membership of Customer Match audience ID %s was edited',
    $result['firstPartyAndPartnerAudienceId']
);