Create a Customer Match audience by sending a
CreateUserListRequest.
Construct the request body
Create a UserList
resource. Here are the common fields to set.
displayName- Required The display name of the list. The name must be unique among all of the lists owned by the account.
description- A brief description of the list.
integrationCode- An ID from your system.
membershipDurationThe duration an audience member remains in the list after added. The value must correspond to whole days. If not set, defaults to the maximum.
If using JSON, calculate the number of seconds by multiplying the duration days by
86400(the number of seconds per day). Then set the value to the multiplication result, followed bys. For example, if you want a membership duration of 90 days, use the value7776000ssince90 * 86400 = 7776000.If using the protocol buffer format, use the convenience method for constructing a
Durationobject based on the number of days, if such a convenience method exists. For example, theprotobuf-java-utillibrary for Java has afromDays()convenience method. Otherwise, calculate the number of seconds by multiplying the duration days by86400(the number of seconds per day), and use the result to set thesecondsfield of theDurationobject.
Required fields for Customer Match
The ingestedUserListInfo field is required for a Customer Match audience.
Here are the fields to set on the
IngestedUserListInfo
based on the type of data you want to use to add audience members to the list.
Contact information list
Set the following fields if you want to use contact information (hashed email addresses, phone numbers, or addresses) to define your audience members:
uploadKeyTypesSet to a list containing the
CONTACT_IDupload key type.The
uploadKeyTypeslist must contain only one entry.contactIdInfoSet to a
ContactIdInfomessage with thedataSourceTypeset to the appropriate value from theDataSourceTypeenum.
Mobile ID list
Set the following fields if you want to use mobile IDs to define your audience members:
uploadKeyTypesSet to a list containing the
MOBILE_IDupload key type.The
uploadKeyTypeslist must contain only one entry.mobileIdInfoSet to a
MobileIdInfomessage:Set the
dataSourceTypeto the appropriate value from theDataSourceTypeenum.Set the
keySpacetoIOSorANDROID.Set the
appIdto the string that uniquely identifies the mobile application from which the data was collected.For iOS, the ID string is the 9 digit string that appears at the end of the App Store URL. For example,
476943146for the "Flood-It!" app with App Store link https://apps.apple.com/us/app/flood-it/id476943146.For Android, the ID string is the application's package name. For example,
com.labpixies.floodfor the "Flood-It!" app with Google Play link https://play.google.com/store/apps/details?id=com.labpixies.flood.
Construct the request
To create a Customer Match audience, construct a create
request for the UserList resource.
Set the
parentfield to the resource name of the account. The resource name must follow the formataccountTypes/{accountType}/accounts/{account_id}.Use the
UserListyou constructed for the body of the request.If your credentials aren't for a Google Account that's a user on the
parent, set headers as described in Configure destinations and headers.
Here are sample requests in JSON for the different types of user information.
Each request sets the membershipDuration to 2592000s, where 2592000 is the
number of seconds in 30 days. Click the Open in API Explorer button to try a
request.
Contact information
{ "description": "Customer Match for contact info", "displayName": "Contact info audience", "ingestedUserListInfo": { "contactIdInfo": { "dataSourceType": "DATA_SOURCE_TYPE_FIRST_PARTY" }, "uploadKeyTypes": [ "CONTACT_ID" ] }, "membershipDuration": "2592000s" }
Mobile IDs
{ "description": "Customer Match for mobile IDs", "displayName": "Mobile ID audience", "ingestedUserListInfo": { "mobileIdInfo": { "dataSourceType": "DATA_SOURCE_TYPE_FIRST_PARTY", "keySpace": "ANDROID", "appId": "com.labpixies.flood" }, "uploadKeyTypes": [ "MOBILE_ID" ] }, "membershipDuration": "2592000s" }
Send the request
Send the request and, if required, include request headers.
If the request succeeds, the response contains the created
UserList with the id and name populated. Make note of the
values in these fields since you need them in requests to add audience members
to the audience.
If the request fails, inspect the errors to determine the cause of the failure, update the request and headers to fix any issues, and then send the updated request and headers.