Use custom attributes to filter results and target audiences.
Whether you’re personalizing content or filtering results, custom attributes help you shape strategy around what matters to your audience. You can define attributes based on what you already know — like sign-in state — with the setAttributes() API, then add the custom attribute to the Optimize dashboard so that you can use them to in audiences or as results filters.
Overview of the setup process
There's a two-step process you'll need to complete for each custom attribute you want to use in Optimize:
-
Define the attributes using the
setAttributes()API — this attaches attribute names and values to visitors - Add the attribute names to Optimize — this registers them so you can use them in Optimize
How to define attributes
Use the setAttributes() API to assign one or more values to a visitor. You can use any string-based name and value pair — for example, { "plan": "enterprise" } or { "persona": "technical" }. Learn how to set custom attributes using the API.
Note
Custom attributes are stored client-side and sent with every pageview and goal event.
How to add attribute names to Optimize
Open your Optimize site in Webflow, then:
- Click Account settings in the Navigation panel
- Go to Custom Attributes
- Click Add or Edit
- Enter each attribute name exactly as it appears in your API call
- Click Save
Important
Use the exact same spelling and casing as your API-defined attribute names.
How to use custom attributes in Optimize
After registering your attributes, they can be used in audiences and optimization results filters.
Targeting custom attributes — build a rules-based audience and set it for an optimization to show personalized variations to visitors that match relevant custom attributes.
Filtering optimization results — the attributes are automatically added as results filters. When Optimize collects data for the new attributes, you'll be able to choose your custom attributes from the filters list to see how specific segments performed.