# Prepare user data

> [!IMPORTANT]
> **Important:** [Upgrade your Customer Match workflows to the Data Manager
> API](https://developers.google.com/data-manager/api/devguides/audiences/display-video/customer-match/upgrade) for an improved developer experience and access to additional features. We don't recommend implementing new Customer Match workflows using the Display \& Video 360 API.

Upload collected customer data to create [Customer Match
audiences](https://support.google.com/displayvideo/answer/9539301). This is sensitive data. You must properly prepare
it before uploading.

## Format data

Format your raw data by doing the following:

- Take out any whitespace from first name, last name, and email address values.
- Make all string values lowercase.
- Format phone number value using the [E.164 format](https://en.wikipedia.org/wiki/E.164). Include the country code.

## Hash data

Hash raw data values of the following types using the SHA256 algorithm:

- First name
- Last name
- Email address
- Phone number

## Assign data

The data that you are using determines [audience type](https://developers.google.com/display-video/api/reference/rest/current/firstPartyAndPartnerAudiences#AudienceType). It also
determines the API object used to pass the data.

### Contact information

If you are using contact information to match users:

- Use the audience type `CUSTOMER_MATCH_CONTACT_INFO`.
- Pass the data in a [`ContactInfo`](https://developers.google.com/display-video/api/reference/rest/current/firstPartyAndPartnerAudiences#ContactInfo) object.

The selection of data provided for a customer determines the method used to
match them:

> [!NOTE]
> **Note:** One [`ContactInfo`](https://developers.google.com/display-video/api/reference/rest/current/firstPartyAndPartnerAudiences#ContactInfo) object represents one user.

| Matching method ||
|---|---|
| Email address matching | At least one value assigned to the [`hashedEmails`](https://developers.google.com/display-video/api/reference/rest/current/firstPartyAndPartnerAudiences#ContactInfo.FIELDS.hashed_emails) field. |
| Phone matching | At least one value assigned to the [`hashedPhoneNumbers`](https://developers.google.com/display-video/api/reference/rest/current/firstPartyAndPartnerAudiences#ContactInfo.FIELDS.hashed_phone_numbers) field. |
| Mailing address matching | Values assigned to [`hashedFirstName`](https://developers.google.com/display-video/api/reference/rest/current/firstPartyAndPartnerAudiences#ContactInfo.FIELDS.hashed_first_name), [`hashedLastName`](https://developers.google.com/display-video/api/reference/rest/current/firstPartyAndPartnerAudiences#ContactInfo.FIELDS.hashed_last_name), [`zipCodes`](https://developers.google.com/display-video/api/reference/rest/current/firstPartyAndPartnerAudiences#ContactInfo.FIELDS.zip_codes) and [`countryCode`](https://developers.google.com/display-video/api/reference/rest/current/firstPartyAndPartnerAudiences#ContactInfo.FIELDS.country_code) fields. |
| Combined email address, mailing address, and phone matching | Values assigned to [`hashedEmails`](https://developers.google.com/display-video/api/reference/rest/current/firstPartyAndPartnerAudiences#ContactInfo.FIELDS.hashed_emails), [`hashedPhoneNumbers`](https://developers.google.com/display-video/api/reference/rest/current/firstPartyAndPartnerAudiences#ContactInfo.FIELDS.hashed_phone_numbers), [`hashedFirstName`](https://developers.google.com/display-video/api/reference/rest/current/firstPartyAndPartnerAudiences#ContactInfo.FIELDS.hashed_first_name), [`hashedLastName`](https://developers.google.com/display-video/api/reference/rest/current/firstPartyAndPartnerAudiences#ContactInfo.FIELDS.hashed_last_name), [`zipCodes`](https://developers.google.com/display-video/api/reference/rest/current/firstPartyAndPartnerAudiences#ContactInfo.FIELDS.zip_codes) and [`countryCode`](https://developers.google.com/display-video/api/reference/rest/current/firstPartyAndPartnerAudiences#ContactInfo.FIELDS.country_code) fields. |

Include all [`ContactInfo`](https://developers.google.com/display-video/api/reference/rest/current/firstPartyAndPartnerAudiences#ContactInfo) objects for a single upload in a
[`ContactInfoList`](https://developers.google.com/display-video/api/reference/rest/current/firstPartyAndPartnerAudiences#ContactInfoList) object.

### Mobile device IDs

If you are using mobile device IDs to match users:

- Use the audience type `CUSTOMER_MATCH_DEVICE_ID`.
- Pass the data using a mobile device ID string.

Include all mobile device IDs for a single upload in a
[`MobileDeviceIdList`](https://developers.google.com/display-video/api/reference/rest/current/firstPartyAndPartnerAudiences#MobileDeviceIdList) object.

## Set user consent

Set the `consent` field in the relevant data object to pass signals of consent
granted by the included users.

Setting either field in the [`Consent`](https://developers.google.com/display-video/api/reference/rest/current/firstPartyAndPartnerAudiences#Consent) object to
`CONSENT_STATUS_DENIED` will return an error.

> [!WARNING]
> **Warning:** You must send consent signals when uploading European Economic Area (EEA) Customer Match data to adhere to the [EU User Consent
> Policy](https://www.google.com/about/company/user-consent-policy/) and use EEA user data in Customer Match audiences.

Consent signals apply to all users in a request. Use separate requests to upload
users with different consent signals.