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

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

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

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

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

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

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

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

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

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

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

การตั้งค่าฟิลด์ใดฟิลด์หนึ่งในออบเจ็กต์ 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 จะเพิ่มหรือนำสมาชิกออกจากรายการได้เท่านั้น การส่งคำขอเดียวที่พยายามทำทั้ง 2 อย่างจะทำให้เกิดข้อผิดพลาด INVALID_ARGUMENT

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

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']
);