Tải các đối tượng So khớp khách hàng lên

Bạn có thể tạo đối tượng So khớp khách hàng bằng cách sử dụng thông tin liên hệ khách hàng đã tải lên hoặc mã thiết bị di động bằng thẻ Hiển thị API Video 360. Trang này mô tả cách để tạo đối tượng Đối sánh khách hàng ban đầu và thêm dữ liệu khách hàng mới vào đối tượng hiện tại bằng cách sử dụng API Video 360.

Chuẩn bị dữ liệu người dùng

Dữ liệu người dùng dùng để điền đối tượng So khớp khách hàng là dữ liệu nhạy cảm và cần được chuẩn bị kỹ lưỡng trước khi tải lên.

Hàm băm dữ liệu nhạy cảm

Một số đối tượng So khớp khách hàng được tạo bằng thông tin liên hệ nhạy cảm của khách hàng của bạn. Hiển thị và Video 360 yêu cầu dữ liệu nhạy cảm phải được băm bằng Thuật toán SHA256 trước khi được tải lên. Những trường dữ liệu sau đây phải được băm trước khi tải lên:

  • Tên
  • Họ
  • Địa chỉ email
  • Số điện thoại

Không được băm mã bưu chính và mã quốc gia trước khi tải lên. Đang cố gắng dẫn đến lỗi tải lên dữ liệu khách hàng chưa băm.

Trước khi băm dữ liệu, hãy đảm bảo các điều kiện sau:

  • Bạn phải xoá mọi khoảng trắng khỏi tên, họ và địa chỉ email giá trị.
  • Tất cả các giá trị phải được viết thường.
  • Tất cả số điện thoại phải được định dạng bằng định dạng E.164 và hãy thêm mã gọi điện quốc gia.

Khi tải dữ liệu người dùng lên, hãy sử dụng các trường consent trong ContactInfoList hoặc Các đối tượng MobileDeviceIdList để truyền tín hiệu về sự đồng ý được cấp bởi người dùng được bao gồm.

Đặt một trong hai trường trong đối tượng Consent thành CONSENT_STATUS_DENIED dẫn đến lỗi.

Các tín hiệu về sự đồng ý được thiết lập cho tất cả người dùng được thêm vào một firstAndThirdPartyAudiences.create hoặc firstAndThirdPartyAudiences.editCustomerMatchMembers của bạn. Người dùng có nhiều tín hiệu về sự đồng ý phải được tải lên riêng biệt yêu cầu.

Tạo đối tượng So khớp khách hàng

Bạn có thể tạo đối tượng Đối sánh khách hàng bằng cách sử dụng Phương thức firstAndThirdPartyAudiences.create. Đối tượng phải Bạn phải khai báo đối tượng của bên thứ nhất và audienceType / CUSTOMER_MATCH_CONTACT_INFO hoặc CUSTOMER_MATCH_DEVICE_ID. Dữ liệu So khớp khách hàng phải được cung cấp bằng cách sử dụng trường thích hợp trong trường hợp members.

Dưới đây là ví dụ về cách tạo thông tin liên hệ mới So khớp khách hàng đối tượng có thời hạn thành viên không giới hạn bằng cách sử dụng danh sách đối tượng đã băm số điện thoại:

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

Cập nhật tư cách thành viên của đối tượng So khớp khách hàng

Nếu bạn đã xác định thêm khách hàng mà bạn muốn nhắm mục tiêu, bạn cần gia hạn gói thuê bao của khách hàng tư cách thành viên hiện tại của đối tượng hoặc muốn xoá khách hàng từ một đối tượng, bạn có thể cập nhật dữ liệu khách hàng của một Khách hàng hiện tại Khớp đối tượng với firstAndThirdPartyAudiences.editCustomerMatchMembers . Bạn có thể thêm khách hàng vào danh sách bằng cách sử dụng trường liên kết added_members và xoá khách hàng khỏi có trường hợp removed_members.

Một firstAndThirdPartyAudiences.editCustomerMatchMembers yêu cầu chỉ có thể thêm hoặc xoá thành viên khỏi danh sách. Một yêu cầu duy nhất đang cố gắng thực hiện cả hai sẽ dẫn đến lỗi INVALID_ARGUMENT.

Sau đây là ví dụ về cách thêm một khách hàng làm thành viên cho một tài khoản khách hàng hiện tại thông tin liên hệ của đối tượng Đối sánh khách hàng sử dụng dữ liệu địa chỉ gửi thư được cung cấp:

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