Skip to main content
Businesses build segments in the embed by filtering on customer properties. A property only shows up as a filter once you have defined it. This guide takes one property, a customer’s membership plan, from your system to a working filter. For the model behind this, see How segments and filter definitions work.

Prerequisites

1. Sync the property into customer metadata

Put the value on each customer’s metadata 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

  1. Open Resources > Customer Filters and select Create a new customer filter.
  2. Enter the metadata key as the Variable Name (plan), a Display Text that businesses will see (“Membership plan”), and a Filter Type (select). For select, add one option per possible value.
  3. 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

The variable_name is customer. followed by the metadata key.
The response is the filter definition, including its 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:
Sending the same 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 in metadata 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 send options, the list you send replaces the existing options.
  • To hide a filter without deleting it, call POST /filter_definitions/:id/disable. Bring it back with POST /filter_definitions/:id/enable.
  • To delete it, call DELETE /filter_definitions/:id.