Prerequisites
- A business with customers. See Sync businesses and customers.
- Your
project_idandsecret_key. See Authentication.
1. Sync the property into customer metadata
Put the value on each customer’smetadata as part of your normal customer
sync. Pick a key made of letters, numbers and underscores.
A sync replaces the whole customer, including
metadata. Keep sending every metadata key on every
sync request, or the ones you leave out are removed.2. Define the filter
Choose where the filter should apply:- Every business in your project: define it once in the dashboard.
- One business: define it with the API.
For every business, in the dashboard
- Open Resources > Customer Filters and select Create a new customer filter.
- Enter the metadata key as the Variable Name (
plan), a Display Text that businesses will see (“Membership plan”), and a Filter Type (select). Forselect, add one option per possible value. - Save, then turn the filter on in the list. A new project-level filter is disabled until you enable it.
For one business, with the API
Thevariable_name is customer. followed by the metadata key.
id. A filter created for
a business is enabled immediately.
options is required in this request for every type. For types other than
select and array_of_known, pass an empty array:
variable_name again for the same business updates the
existing filter definition instead of creating a second one, so you can run this
step every time you onboard or update a business.
3. Check the filter in the embed
Create an embed for the business and open the segment builder. “Membership plan” is offered as a filter, with a dropdown of the options you defined. Build a segment with it and confirm the customers you expect are included. If the customers you expect are missing, check that the value inmetadata
matches the filter’s type and, for select, one of the option values exactly.
See Filter definitions.
Change or remove a filter
- To change the label, type or options, send only the properties you want to
change to
POST /filter_definitions/:id. If you sendoptions, the list you send replaces the existing options. - To hide a filter without deleting it, call
POST /filter_definitions/:id/disable. Bring it back withPOST /filter_definitions/:id/enable. - To delete it, call
DELETE /filter_definitions/:id.
Related
- Filter definitions for every type and the value it expects.
- How segments and filter definitions work for how project-level and business-level definitions combine.