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

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

นี้

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

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

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

กลุ่มเป้าหมายการจับคู่ข้อมูลลูกค้าบางกลุ่มสร้างขึ้นโดยใช้ข้อมูลติดต่อของลูกค้าที่ละเอียดอ่อน 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

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

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(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.
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': 540,
    '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(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->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']
);