> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://developers.webflow.com/browser/optimize/attributes/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.webflow.com/_mcp/server. # Custom attributes > An overview of custom attributes in Webflow Optimize Attributes are different characteristics associated with your visitors (for example, demographics, behavior, etc.). If you want to target anything that isn't available by default, you can use custom attributes to store and retrieve data about your visitors. Once a custom attribute is defined and set on a page visit, you can leverage it to [define a rules-based audience](https://help.webflow.com/hc/en-us/articles/34167397653523-Create-or-edit-a-rules-based-audience) or [filter optimization results by the attribute](https://help.webflow.com/hc/en-us/articles/34167118964883-Review-your-optimization-results). ## How custom attributes work Custom attributes are first defined in Webflow Optimize, and then set for a user or pageview by using the [`wf.setAttributes()`](/browser/optimize/setAttributes) method of the Browser API. By setting an attribute, you're sending data to Webflow Optimize that can be used to [create a rules-based audience](https://help.webflow.com/hc/en-us/articles/34167397653523-Create-or-edit-a-rules-based-audience) or [filter optimization results](https://help.webflow.com/hc/en-us/articles/34167118964883-Review-your-optimization-results#01J9WN67STDYG61SRKX2HEAZZE). ## Configuring custom attributes ### Create a custom attribute in Webflow Optimize If you have an enterprise site, navigate to the **Insights** tab on your site and click **Integrations**. Find the **Custom JavaScript attributes** section and create a new entry. ![Custom JavaScript attributes](/_fern-img/b87e2da2c34a5d54d8dcb5f2898143a627b333aa19f3c4cc08cffaa0e26c53bf.webp) > **Enterprise sites only** > > This method is only available on enterprise sites. ### Set a custom attribute using the Browser API Once configured, you can set custom attributes when a user visits your site by using [`wf.setAttributes()`](/browser/optimize/setAttributes). See the example below, and the [documentation for more details.](/browser/optimize/setAttributes) #### Scopes Custom attributes can be set for a specific scope, which determines the lifetime of the attribute. * **Pageview**: The attribute is available for the duration of a pageview. * **User**: The attribute is available for the duration of a user's session. A session begins when the visitor arrives on your site and ends after 30 minutes of sustained inactivity (like when the visitor stops engaging with your website). **Example:** ```javascript // Call wf.ready() to ensure the Browser API is available wf.ready(function() { // Set custom attributes wf.setAttributes("user", { customerSegment: 'enterprise', userRole: 'technicalBuyer' }); }); ``` ## Using custom attributes in Optimize Once you've created and set a custom attribute, you can use it to create a rules-based audience or filter optimization results. #### [Create a rules-based audience](https://help.webflow.com/hc/en-us/articles/34167397653523-Create-or-edit-a-rules-based-audience) Create a rules-based audience to target visitors based on their custom attributes. #### [Filter optimization results](https://help.webflow.com/hc/en-us/articles/34167118964883-Review-your-optimization-results#01J9WN67STDYG61SRKX2HEAZZE) Filter optimization results by custom attributes. ## Looking for more information? Visit the [Webflow Help Center](https://help.webflow.com/hc/en-us/articles/34167397653523-Create-or-edit-a-rules-based-audience) to learn more about custom attributes and audiences in Webflow Optimize, including: * Creating and managing custom attributes * Building rules-based audiences * Targeting visitors with custom attributes * Best practices for audience segmentation * Enterprise-specific features and capabilities You can also explore [Webflow University](https://university.webflow.com/videos/start-optimizing-your-site-with-webflow-optimize) for additional tutorials and resources on making the most of Webflow Optimize's personalization features. > An overview of custom attributes in Webflow Optimize ## Docs - [Get Attributes](https://developers.webflow.com/browser/optimize/getAttributes.md): Get attributes for the current user or page view - [Get all attributes](https://developers.webflow.com/browser/optimize/getAllAttributes.md): Get all attributes for the current user or page view - [Set attributes](https://developers.webflow.com/browser/optimize/setAttributes.md): Set attributes for the current user or page view - [Delete attributes](https://developers.webflow.com/browser/optimize/deleteAttributes.md): Delete custom attributes for the current user or page view - [Delete all attributes](https://developers.webflow.com/browser/optimize/deleteAllAttributes.md): Delete all custom attributes for the current user or page view