อัปโหลดกลุ่มเป้าหมายในการจับคู่ข้อมูลลูกค้า

คุณสร้างกลุ่มเป้าหมายในการจับคู่ข้อมูลลูกค้าได้โดยใช้ข้อมูลติดต่อของลูกค้าที่อัปโหลดหรือรหัสอุปกรณ์เคลื่อนที่โดยใช้ Display & Video 360 API หน้านี้จะอธิบายวิธีสร้างกลุ่มเป้าหมายในการจับคู่ข้อมูลลูกค้าเริ่มต้นและเพิ่มข้อมูลลูกค้าใหม่ต่อท้ายกลุ่มเป้าหมายที่มีอยู่โดยใช้ API ของ Display & Video 360

เตรียมข้อมูลผู้ใช้

ข้อมูลผู้ใช้ที่ใช้ในการป้อนข้อมูลกลุ่มเป้าหมายในการจับคู่ข้อมูลลูกค้าเป็นข้อมูลที่ละเอียดอ่อนและต้องมีการเตรียมพร้อมอย่างถูกต้องก่อนที่จะอัปโหลด

ข้อมูลที่ละเอียดอ่อนแบบแฮช

กลุ่มเป้าหมายในการจับคู่ข้อมูลลูกค้าบางกลุ่มสร้างขึ้นโดยใช้ข้อมูลติดต่อของลูกค้าที่มีความละเอียดอ่อน Display & Video 360 กำหนดให้มีการแฮชข้อมูลที่ละเอียดอ่อนโดยใช้อัลกอริทึม SHA256 ก่อนที่จะอัปโหลด ต้องแฮชช่องข้อมูลต่อไปนี้ก่อนอัปโหลด

  • ชื่อ
  • นามสกุล
  • อีเมล
  • หมายเลขโทรศัพท์

ไม่ควรแฮชรหัสไปรษณีย์ก่อนอัปโหลด หากพยายามอัปโหลดข้อมูลลูกค้าที่ไม่ได้แฮชจะเกิดข้อผิดพลาด

ก่อนที่จะแฮชข้อมูล ให้ตรวจสอบเงื่อนไขต่อไปนี้

  • คุณต้องนำช่องว่างออกจากค่าชื่อ นามสกุล และอีเมล
  • ค่าทั้งหมดต้องเป็นตัวพิมพ์เล็ก
  • หมายเลขโทรศัพท์ทั้งหมดต้องอยู่ในรูปแบบรูปแบบ E.164 และมีรหัสประเทศรวมอยู่ด้วย

เมื่ออัปโหลดข้อมูลผู้ใช้ ให้ใช้ช่อง consent ในออบเจ็กต์ ContactInfoList หรือ MobileDeviceIdList ที่ให้ไว้เพื่อส่งสัญญาณความยินยอมจากผู้ใช้ที่รวมอยู่ในแคมเปญ

การตั้งค่าช่องใดช่องหนึ่งในออบเจ็กต์ Consent เป็น CONSENT_STATUS_DENIED จะเกิดข้อผิดพลาด

มีการตั้งค่าสัญญาณความยินยอมสำหรับผู้ใช้ทั้งหมดที่เพิ่มในคำขอ firstAndThirdPartyAudiences.create หรือ firstAndThirdPartyAudiences.editCustomerMatchMembers รายการเดียว ผู้ใช้ที่มีสัญญาณความยินยอมที่แตกต่างกันต้องได้รับการอัปโหลดในคำขอแยกกัน

สร้างกลุ่มเป้าหมายในการจับคู่ข้อมูลลูกค้า

คุณสร้างกลุ่มเป้าหมายในการจับคู่ข้อมูลลูกค้าได้โดยใช้เมธอด firstAndThirdPartyAudiences.create กลุ่มเป้าหมายต้องได้รับการประกาศว่าเป็นกลุ่มเป้าหมายบุคคลที่หนึ่งและมี audienceType เป็น CUSTOMER_MATCH_CONTACT_INFO หรือ CUSTOMER_MATCH_DEVICE_ID ต้องระบุข้อมูลการจับคู่ข้อมูลลูกค้าโดยใช้ช่องที่เหมาะสมในช่องการรวม members

ต่อไปนี้คือตัวอย่างวิธีสร้างกลุ่มเป้าหมายในการจับคู่ข้อมูลลูกค้าใหม่สำหรับข้อมูลติดต่อที่มีระยะเวลาการเป็นสมาชิกไม่จำกัด โดยใช้รายการหมายเลขโทรศัพท์ที่แฮชที่ให้มา

Java

// Create Customer Match audience object.
FirstAndThirdPartyAudience customerMatchAudience =
    new FirstAndThirdPartyAudience()
        .setDisplayName(display-name)
        .setFirstAndThirdPartyAudienceType(
            "FIRST_AND_THIRD_PARTY_AUDIENCE_TYPE_FIRST_PARTY"
        )
        .setAudienceType("CUSTOMER_MATCH_CONTACT_INFO")
        .setMembershipDurationDays(10000L);

// 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.
FirstAndThirdPartyAudience response =
    service
        .firstAndThirdPartyAudiences()
        .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,
    'firstAndThirdPartyAudienceType':
        'FIRST_AND_THIRD_PARTY_AUDIENCE_TYPE_FIRST_PARTY',
    'audienceType': 'CUSTOMER_MATCH_CONTACT_INFO',
    'membershipDurationDays': 10000,
    'contactInfoList': {
        'contactInfos': [
            contact_infos
        ],
        'consent': {
            'adUserData': ad-user-data-consent,
            'adPersonalization': ad-personalization-consent
        }
    }
}

# Build and execute request.
audience = service.firstAndThirdPartyAudiences().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- and third-party audience object.
$audience = new Google_Service_DisplayVideo_FirstAndThirdPartyAudience();
$audience->setDisplayName(display-name);
$audience->setFirstAndThirdPartyAudienceType(
    'FIRST_AND_THIRD_PARTY_AUDIENCE_TYPE_FIRST_PARTY'
);
$audience->setAudienceType('CUSTOMER_MATCH_CONTACT_INFO');
$audience->setMembershipDurationDays(10000);

// 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->firstAndThirdPartyAudiences->create(
    $audience,
    array('advertiserId' => advertiser-id)
);

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

อัปเดตการเป็นสมาชิกของกลุ่มเป้าหมายในการจับคู่ข้อมูลลูกค้า

หากระบุลูกค้าเพิ่มเติมที่ต้องการกำหนดเป้าหมาย จำเป็นต้องต่ออายุการเป็นสมาชิกกลุ่มเป้าหมายที่มีอยู่ของลูกค้า หรือนำลูกค้าออกจากกลุ่มเป้าหมาย คุณจะอัปเดตข้อมูลลูกค้าของกลุ่มเป้าหมายในการจับคู่ข้อมูลลูกค้าได้โดยใช้วิธี firstAndThirdPartyAudiences.editCustomerMatchMembers คุณสามารถเพิ่มลูกค้าไปยังรายการได้โดยใช้ช่องสหภาพ added_members และนําลูกค้าออกจากรายการด้วยช่องสหภาพ removed_members

คำขอ firstAndThirdPartyAudiences.editCustomerMatchMembers รายการเดียวสามารถเพิ่มหรือนำสมาชิกออกจากรายการเท่านั้น คำขอเดียวที่พยายามทำทั้ง 2 อย่างจะทำให้เกิดข้อผิดพลาด 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
        .firstAndThirdPartyAudiences()
        .editCustomerMatchMembers(
            audience-id,
            editCustomerMatchMembersRequest
        )
        .execute();

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

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.firstAndThirdPartyAudiences().editCustomerMatchMembers(
    firstAndThirdPartyAudienceId=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["firstAndThirdPartyAudienceId"])

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
    ->firstAndThirdPartyAudiences
    ->editCustomerMatchMembers(
        audience-id,
        $editMemberRequest
    );

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