Kullanıcı listesini güncelle

Mevcut bir kitledeki kullanıcıları güncellemek için editCustomerMatchMembers isteği kullanın. Bu yöntemle yeni kullanıcılar ekleyebilir veya mevcut kullanıcıları kaldırabilirsiniz.

Posta adresi verilerini kullanarak mevcut bir kitleye yeni kullanıcı eklemek için:

Java

// Provide the parent advertiser ID of the audience.
long advertiserId = advertiser-id;

// Provide the ID of the audience to update.
long audienceId = audience-id;

// Provide the signals of consent for the customer.
String adUserDataConsent = ad-user-data-consent;
String adPersonalizationConsent = ad-personalization-consent;

// Provide the hashed first and last names of the customer.
String hashedFirstName = hashed-first-name;
String hashedLastName = hashed-last-name;

// Provide the zip and country code of the customer.
String zipCode = zip-code;
String countryCode = country-code;

// Build list of ContactInfo objects.
List<ContactInfo> contactInfos = new ArrayList<>();
contactInfos.add(
    new ContactInfo()
        .setHashedFirstName(hashedFirstName)
        .setHashedLastName(hashedLastName)
        .setCountryCode(countryCode)
        .setZipCodes(Arrays.asList(zipCode)));

EditCustomerMatchMembersRequest editCustomerMatchMembersRequest =
    new EditCustomerMatchMembersRequest()
        .setAdvertiserId(advertiserId)
        .setAddedContactInfoList(
            new ContactInfoList()
                .setContactInfos(contactInfos)
                .setConsent(
                    new Consent()
                        .setAdUserData(adUserDataConsent)
                        .setAdPersonalization(adPersonalizationConsent)));

// Update the audience membership.
EditCustomerMatchMembersResponse response =
    service
        .firstPartyAndPartnerAudiences()
        .editCustomerMatchMembers(audienceId, editCustomerMatchMembersRequest)
        .execute();

// Display ID of the updated the customer match audience ID.
System.out.printf(
    "Updated the membership of the Customer Match audience with ID %s.",
    response.getFirstPartyAndPartnerAudienceId());

Python

# Provide the parent advertiser ID of the audience.
advertiser_id = advertiser-id

# Provide the ID of the audience to update.
audience_id = audience-id

# Provide the signals of consent for the customer.
ad_user_data_consent = ad-user-data-consent
ad_personalization_consent = ad-personalization-consent

# Provide the hashed first and last names of the customer.
hashed_first_name = hashed-first-name
hashed_last_name = hashed-last-name

# Provide the zip and country code of the customer.
zip_code = zip-code
country_code = country-code

# Create the edit members object.
edit_members_request_obj = {
    "advertiserId": advertiser_id,
    "addedContactInfoList": {
        "contactInfos": [{
            "hashedFirstName": hashed_first_name,
            "hashedLastName": hashed_last_name,
            "countryCode": country_code,
            "zipCodes": [zip_code],
        }],
        "consent": {
            "adUserData": ad_user_data_consent,
            "adPersonalization": ad_personalization_consent,
        },
    },
}

# Build and execute request.
edit_members_response = (
    service.firstPartyAndPartnerAudiences()
    .editCustomerMatchMembers(
        firstPartyAndPartnerAudienceId=audience_id,
        body=edit_members_request_obj,
    )
    .execute()
)

# Print ID of updated audience.
print(
    f"Updated the membership of the Customer Match audience with ID "
    f'{edit_members_response["firstPartyAndPartnerAudienceId"]}.'
)

PHP

// Provide the parent advertiser ID to create the audience under.
$advertiserId = advertiser-id;

// Provide the ID of the audience to update.
$audienceId = audience-id;

// Provide the signals of consent for the customer.
$adUserDataConsent = ad-user-data-consent;
$adPersonalizationConsent = ad-personalization-consent;

// Provide the hashed first and last names of the customer.
$hashedFirstName = hashed-first-name;
$hashedLastName = hashed-last-name;

// Provide the zip and country code of the customer.
$zipCode = zip-code;
$countryCode = country-code;

// Build the ContactInfo object.
$contactInfos = array();
$contactInfo = new Google_Service_DisplayVideo_ContactInfo();
$contactInfo->setHashedFirstName($hashedFirstName);
$contactInfo->setHashedLastName($hashedLastName);
$contactInfo->setCountryCode($countryCode);
$contactInfo->setZipCodes(array($zipCode));
$contactInfos[] = $contactInfo;

$consent = new Google_Service_DisplayVideo_Consent();
$consent->setAdUserData($adUserDataConsent);
$consent->setAdPersonalization($adPersonalizationConsent);

$contactInfoList = new Google_Service_DisplayVideo_ContactInfoList();
$contactInfoList->setContactInfos($contactInfos);
$contactInfoList->setConsent($consent);

// Build the edit request
$editCustomerMatchAudienceRequest = new Google_Service_DisplayVideo_EditCustomerMatchMembersRequest();
$editCustomerMatchAudienceRequest->setAdvertiserId($advertiserId);
$editCustomerMatchAudienceRequest->setAddedContactInfoList($contactInfoList);

// Call the API, updating the audience.
try {
    $result = $this->service->firstPartyAndPartnerAudiences->editCustomerMatchMembers($audienceId,$editCustomerMatchAudienceRequest);
} catch (\Exception $e) {
    $this->renderError($e);
    return;
}

// Print the ID of the updated audience.
printf(
    '<p>The membership of Customer Match audience %s was updated.</p>',
    $result['firstPartyAndPartnerAudienceId']);