Custom targeting attributes
Enterprise plans
Learn how to create custom targeting attributes in Builder to go beyond built-in targeting options.
Define custom attributes to tailor content delivery based on user roles, preferences, or other unique conditions for a more dynamic and personalized user experience.
Prerequisites
- Make sure you're familiar with the basics of Targeting Content.
- You make custom targeting attributes in the Settings and apply them in the Visual Editor.
- In your code, pass custom targeting attributes to Builder’s API or set them globally using
setUserAttributes().
Create custom targeting attributes in the Settings
- Go to Space Settings.
- Under the Targeting section, click Edit button for Custom Targeting.
- Click + New Target Attribute button.
- Define targeting properties, such as
Name,Type, andEnumin the Custom targeting attributes dialogue. - Click Save.
The targeting properties:
- Name specifies the name of the custom targeting attribute.
- Type determines how values are entered. A
Stringtype provides a text box as an input, while abooleantype includes a toggle switch to selecttrueorfalse. - Enum is available only for
Stringtypes. This option replaces the text box with a dropdown menu, requiring users to select from predefined options when targeting content.
This video below shows how to create custom targeting attributes in Settings.
Set up custom targeting attributes in the Visual Editor
Target content using custom targeting attributes by setting conditions with the defined attributes.
The process is similar to targeting with built-in attributes, with custom targeting attributes included in the list of options for creating targeting conditions.
- Open the content entry you want to target.
- Click the Targeting icon at the top of the Visual Editor.
- Click + Add Target.
- Choose a targeting attribute from the dropdown and set its value based on the attribute type.
The video below covers setting up custom targeting attributes in the Visual Editor.
Render targeted content with custom targeting attributes
Targeting matches the values provided in a content API request through userAttributes with the targeting conditions set for your content in the Visual Editor. For built-in attributes like device or urlPath, Builder automatically extracts the necessary targeting data from your request.
For custom targeting attributes, include the required data in your request using the builder.get() or builder.getAll() methods.
You can alternatively use setUserAttributes to set the targeting attributes once across multiple content requests:
Alternatively, you can pass the attributes as query string parameters when making requests through the Content or GraphQL APIs.
The following example explains how to define custom targeting attributes in a Page model and send them as query parameters to target content based on conditions set in the visual editor. You can also use a Section model.
For example, create two versions of the page: one that displays the premium version when isProUser is true and another that displays the basic version for non-paid users.
You can define as many custom targeting attributes as needed to suit your use case.
For more examples, see Targeting Cheatsheet.
Targeting matches the values provided in a content API request through userAttributes with the targeting conditions set for your content in the Visual Editor.
For built-in attributes like device or urlPath, Builder automatically extracts the necessary targeting data from your request.
For custom targeting attributes, include the required data in your request using the fetchOneEntry() or fetchEntries() methods.
Alternatively, you can pass the attributes as query string parameters when making requests through the Content or GraphQL APIs.
The following example shows how to define custom targeting attributes in a Page model and send them as query parameters to target content based on conditions set in the visual editor. You can also use a Section model.
For example, create two versions of the page: one that displays the premium version when isProUser is true and another that displays the basic version for non-paid users.
You can define as many custom targeting attributes as needed to suit your use case.
For more information on different example use cases, visit Targeting Cheatsheet.
Targeting matches the values provided in a content API request through userAttributes with the targeting conditions set for your content in the Visual Editor. For built-in attributes like device or urlPath, Builder automatically extracts the necessary targeting data from your request.
For custom targeting attributes, include the required data in your request using the builder.get() or builder.getAll() methods.
You can alternatively use setUserAttributes to set the targeting attributes once across multiple content requests:
Alternatively, you can pass the attributes as query string parameters when making requests through the Content or GraphQL APIs.
The following example explains how to define custom targeting attributes in a Page model and send them as query parameters to target content based on conditions set in the visual editor. You can also use a Section model.
For example, create two versions of the page: one that displays the premium version when isProUser is true and another that displays the basic version for non-paid users.
You can define as many custom targeting attributes as needed to suit your use case.
For more examples, see Targeting Cheatsheet.
Targeting matches the values provided in a content API request through userAttributes with the targeting conditions set for your content in the Visual Editor.
For built-in attributes like device or urlPath, Builder automatically extracts the necessary targeting data from your request.
For custom targeting attributes, include the required data in your request using the fetchOneEntry() or fetchEntries() methods.
Alternatively, you can pass the attributes as query string parameters when making requests through the Content or GraphQL APIs.
The following example explains how to define custom targeting attributes in a Page model and send them as query parameters to target content based on conditions set in the visual editor. You can also use a Section model.
For example, create two versions of the page: one that displays the premium version when isProUser is true and another that displays the basic version for non-paid users.
You can define as many custom targeting attributes as needed to suit your use case.
For more information on different example use cases, visit Targeting Cheatsheet.
Targeting matches the values in a Content API request through userAttributes with the targeting conditions set in the Visual Editor.
For built-in attributes like device or urlPath, Builder automatically extracts the necessary targeting data.
For custom targeting attributes, include the required data in your request using builder.get() or builder.getAll().
Alternatively, use setUserAttributes() to define targeting attributes once and apply them across multiple content requests.
Alternatively, pass the attributes as query parameters when making requests through the Content or GraphQL API.
This example explains how to define custom targeting attributes in a Page model and send them as query parameters to target content based on conditions set in the Visual Editor. You can also create a Section model.
For instance, you can create two versions of a page:
- One that displays the latest landing page created by the marketing team for the upcoming launch event, when
userTypeisadminormarketer. - Another that displays the regular landing page for all other users not defined in
userType.
Define as many custom targeting attributes as needed to fit your use case.
For more examples, see Targeting Cheatsheet.
Targeting matches the values provided in a content API request through userAttributes with the targeting conditions set for your content in the Visual Editor.
For built-in attributes like device or urlPath, Builder automatically extracts the necessary targeting data from your request.
For custom targeting attributes, include the required data in your request using the fetchOneEntry() or fetchEntries() methods.
Alternatively, you can pass the attributes as query string parameters when making requests through the Content or GraphQL APIs.
The following example explains how to define custom targeting attributes in a Page model and send them as query parameters to target content based on conditions set in the visual editor. You can also use a Section model.
For example, create two versions of the page: one that displays the premium version when isProUser is true and another that displays the basic version for non-paid users.
You can define as many custom targeting attributes as needed to suit your use case.
For more information on different example use cases, visit Targeting Cheatsheet.
Targeting matches the values provided in a content API request through userAttributes with the targeting conditions set for your content in the Visual Editor.
For built-in attributes like device or urlPath, Builder automatically extracts the necessary targeting data from your request.
For custom targeting attributes, include the required data in your request using the fetchOneEntry() or fetchEntries() methods.
Alternatively, you can pass the attributes as query string parameters when making requests through the Content or GraphQL APIs.
The following example explains how to define custom targeting attributes in a Page model and send them as query parameters to target content based on conditions set in the Visual Editor. You can also use a Section model.
For example, create two versions of the page: one that displays the premium version when isProUser is true and another that displays the basic version for non-paid users.
You can define as many custom targeting attributes as needed to suit your use case.
For more information on different example use cases, visit Targeting Cheatsheet.
Targeting matches the values provided in a content API request through userAttributes with the targeting conditions set for your content in the Visual Editor. For built-in attributes like device or urlPath, Builder automatically extracts the necessary targeting data from your request.
For custom targeting attributes, include the required data in your request using the builder.get() or builder.getAll() methods.
You can alternatively use setUserAttributes to set the targeting attributes once across multiple content requests:
Alternatively, you can pass the attributes as query string parameters when making requests through the Content or GraphQL APIs.
The following example explains how to define custom targeting attributes in a Page model and send them as query parameters to target content based on conditions set in the Visual Editor. You can also use a Section Model.
For example, create two versions of the page: one that displays the premium version when isProUser is true and another that displays the basic version for non-paid users.
You can define as many custom targeting attributes as needed to suit your use case.
For more examples, see Targeting Cheatsheet.
Targeting matches the values provided in a content API request through userAttributes with the targeting conditions set for your content in the Visual Editor.
For built-in attributes like device or urlPath, Builder automatically extracts the necessary targeting data from your request.
For custom targeting attributes, include the required data in your request using the fetchOneEntry() or fetchEntries() methods.
Alternatively, you can pass the attributes as query string parameters when making requests through the Content or GraphQL APIs.
The following example explains how to define custom targeting attributes in a Page model and send them as query parameters to target content based on conditions set in the visual editor. You can also use a Section model.
For example, create two versions of the page: one that displays the premium version when isProUser is true and another that displays the basic version for non-paid users.
You can define as many custom targeting attributes as needed to suit your use case.
For more information on different example use cases, visit Targeting Cheatsheet.
Targeting matches the values provided in a content API request through userAttributes with the targeting conditions set for your content in the Visual Editor. For built-in attributes like device or urlPath, Builder automatically extracts the necessary targeting data from your request.
For custom targeting attributes, include the required data in your request using the builder.get() or builder.getAll() methods.
You can alternatively use setUserAttributes to set the targeting attributes once across multiple content requests:
Alternatively, you can pass the attributes as query string parameters when making requests through the Content or GraphQL APIs.
The following example explains how to define custom targeting attributes in a Page model and send them as query parameters to target content based on conditions set in the visual editor. You can also use a Section model.
For example, create two versions of the page: one that displays the premium version when isProUser is true and another that displays the basic version for non-paid users.
You can define as many custom targeting attributes as needed to suit your use case.
For more examples, see Targeting Cheatsheet.
Targeting matches the values provided in a content API request through userAttributes with the targeting conditions set for your content in the Visual Editor.
For built-in attributes like device or urlPath, Builder automatically extracts the necessary targeting data from your request.
For custom targeting attributes, include the required data in your request using the fetchOneEntry() or fetchEntries() methods.
Alternatively, you can pass the attributes as query string parameters when making requests through the Content or GraphQL APIs.
The following example explains how to define custom targeting attributes in a Page model and send them as query parameters to target content based on conditions set in the visual editor. You can also create a Section model.
For example, create two versions of the page: one that displays the premium version when isProUser is true and another that displays the basic version for non-paid users.
You can define as many custom targeting attributes as needed to suit your use case.
For more information on different example use cases, visit Targeting Cheatsheet.
Targeting matches the values provided in a content API request through userAttributes with the targeting conditions set for your content in the Visual Editor.
For built-in attributes like device or urlPath, Builder automatically extracts the necessary targeting data from your request.
For custom targeting attributes, include the required data in your request using the fetchOneEntry() or fetchEntries() methods.
Alternatively, you can pass the attributes as query string parameters when making requests through the Content or GraphQL APIs.
The following example explains how to define custom targeting attributes in a Page model and send them as query parameters to target content based on conditions set in the visual editor. You can also create a Section model.
For example, create two versions of the page: one that displays the premium version when isProUser is true and another that displays the basic version for non-paid users.
You can define as many custom targeting attributes as needed to suit your use case.
For more information on different example use cases, visit Targeting Cheatsheet.
Targeting matches the values provided in a content API request through userAttributes with the targeting conditions set for your content in the Visual Editor.
For built-in attributes like device or urlPath, Builder automatically extracts the necessary targeting data from your request.
For custom targeting attributes, include the required data in your request using the fetchOneEntry() or fetchEntries() methods.
Alternatively, you can pass the attributes as query string parameters when making requests through the Content or GraphQL APIs.
The following example explains how to define custom targeting attributes in a Page model and send them as query parameters to target content based on conditions set in the visual editor. You can also create a Section model.
For example, create two versions of the page: one that displays the premium version when isProUser is true and another that displays the basic version for non-paid users.
You can define as many custom targeting attributes as needed to suit your use case.
For more information on different example use cases, visit Targeting Cheatsheet.
Targeting matches the values provided in a content API request through userAttributes with the targeting conditions set for your content in the Visual Editor.
For built-in attributes like device or urlPath, Builder automatically extracts the necessary targeting data from your request.
For custom targeting attributes, include the required data in your request using the fetchOneEntry() or fetchEntries() methods.
Alternatively, you can pass the attributes as query string parameters when making requests through the Content or GraphQL APIs.
The following example explains how to define custom targeting attributes in a Page model and send them as query parameters to target content based on conditions set in the visual editor. You can also create a Section model.
For example, create two versions of the page: one that displays the premium version when isProUser is true and another that displays the basic version for non-paid users.
You can define as many custom targeting attributes as needed to suit your use case.
For more information on different example use cases, visit Targeting Cheatsheet.
Targeting matches the values provided in a content API request through userAttributes with the targeting conditions set for your content in the Visual Editor.
For built-in attributes like device or urlPath, Builder automatically extracts the necessary targeting data from your request.
For custom targeting attributes, include the required data in your request using the fetchOneEntry() or fetchEntries() methods.
Alternatively, you can pass the attributes as query string parameters when making requests through the Content or GraphQL APIs.
The following example explains how to define custom targeting attributes in a Page model and send them as query parameters to target content based on conditions set in the visual editor.
For example, create two versions of the page: one that displays the premium version when isProUser is true and another that displays the basic version for non-paid users.
You can define as many custom targeting attributes as needed to suit your use case.
For more information on different example use cases, visit Targeting Cheatsheet.
Targeting matches the values provided in a content API request through userAttributes with the targeting conditions set for your content in the Visual Editor.
For built-in attributes like device or urlPath, Builder automatically extracts the necessary targeting data from your request.
For custom targeting attributes, include the required data in your request using the fetchOneEntry() or fetchEntries() methods.
Alternatively, you can pass the attributes as query string parameters when making requests through the Content or GraphQL APIs.
The following example explains how to define custom targeting attributes in a Page model and send them as query parameters to target content based on conditions set in the visual editor.
For example, create two versions of the page: one that displays the premium version when isProUser is true and another that displays the basic version for non-paid users.
You can define as many custom targeting attributes as needed to suit your use case.
For more information on different example use cases, visit Targeting Cheatsheet.
Targeting matches the values provided in a content API request through userAttributes with the targeting conditions set for your content in the Visual Editor.
For built-in attributes like device or urlPath, Builder automatically extracts the necessary targeting data from your request.
For custom targeting attributes, include the required data in your request using the fetchOneEntry() or fetchEntries() methods.
Alternatively, you can pass the attributes as query string parameters when making requests through the Content or GraphQL APIs.
The following example explains how to define custom targeting attributes in a Page model and send them as query parameters to target content based on conditions set in the visual editor. You can also use a Section model.
For example, create two versions of the page: one that displays the premium version when isProUser is true and another that displays the basic version for non-paid users.
You can define as many custom targeting attributes as needed to suit your use case.
For more information on different example use cases, visit Targeting Cheatsheet.
Targeting matches the values provided in a content API request through userAttributes with the targeting conditions set for your content in the Visual Editor.
For built-in attributes like device or urlPath, Builder automatically extracts the necessary targeting data from your request.
For custom targeting attributes, include the required data in your request using the fetchOneEntry() or fetchEntries() methods.
Alternatively, you can pass the attributes as query string parameters when making requests through the Content or GraphQL APIs.
The following example explains how to define custom targeting attributes in a Page model and send them as query parameters to target content based on conditions set in the visual editor. You can also create a Section model.
For example, create two versions of the page: one that displays the premium version when isProUser is true and another that displays the basic version for non-paid users.
You can define as many custom targeting attributes as needed to suit your use case.
For more information on different example use cases, visit Targeting Cheatsheet.
Targeting matches the values provided in a content API request through userAttributes with the targeting conditions set for your content in the Visual Editor. For built-in attributes like device or urlPath, Builder automatically extracts the necessary targeting data from your request.
For custom targeting attributes, include the required data in your request using the builder.get() or builder.getAll() methods.
You can alternatively use setUserAttributes to set the targeting attributes once across multiple content requests:
Alternatively, you can pass the attributes as query string parameters when making requests through the Content or GraphQL APIs.
The following example explains how to define custom targeting attributes in a Page model and send them as query parameters to target content based on conditions set in the visual editor. You can also use a Section model.
For example, create two versions of the page: one that displays the premium version when isProUser is true and another that displays the basic version for non-paid users.
You can define as many custom targeting attributes as needed to suit your use case.
For more examples, see Targeting Cheatsheet.
Targeting matches the values provided in a content API request through userAttributes with the targeting conditions set for your content in the Visual Editor.
For built-in attributes like device or urlPath, Builder automatically extracts the necessary targeting data from your request.
For custom targeting attributes, include the required data in your request using the fetchOneEntry() or fetchEntries() methods.
Alternatively, you can pass the attributes as query string parameters when making requests through the Content or GraphQL APIs.
The following example explains how to define custom targeting attributes in a Page model and send them as query parameters to target content based on conditions set in the visual editor. You can also use a Section model.
For example, create two versions of the page: one that displays the premium version when isProUser is true and another that displays the basic version for non-paid users.
You can define as many custom targeting attributes as needed to suit your use case.
For more information on different example use cases, visit Targeting Cheatsheet.
Targeting matches the values provided in a content API request through userAttributes with the targeting conditions set for your content in the Visual Editor. For built-in attributes like device or urlPath, Builder automatically extracts the necessary targeting data from your request.
For custom targeting attributes, include the required data in your request using the builder.get() or builder.getAll() methods.
You can alternatively use setUserAttributes to set the targeting attributes once across multiple content requests:
Alternatively, you can pass the attributes as query string parameters when making requests through the Content or GraphQL APIs.
The following example explains how to define custom targeting attributes in a Page model and send them as query parameters to target content based on conditions set in the visual editor. You can also create a Section model.
For example, create two versions of the page: one that displays the premium version when isProUser is true and another that displays the basic version for non-paid users.
You can define as many custom targeting attributes as needed to suit your use case.
Match custom targeting attributes to their types
Targeting attributes store user input based on their type and determine how values are defined in content API requests. The API request must include the exact value to properly display the targeted content.
For example, userType with the value premium is passed to the Content API request.
In the Settings
In the Targeting section, the userType attribute is defined as a String type.
In the code
When making a request to the Content API, a String value is passed to userType, ensuring it aligns with the type declaration from Settings.
In the Visual Editor
The targeting condition is set using the custom defined userType attribute, with premium as the expected value of type String.
In the Settings
In the Targeting section, the userType attribute is defined as a string type.
In the code
When making a request to the Content API, a string value is passed to userType, ensuring it aligns with the type declaration from Settings.
In the Visual Editor
The targeting condition is set using the custom defined userType attribute, with premium as the expected value of type String.
In the Settings
In the Targeting section, the userType attribute is defined as a String type.
In the code
When making a request to the Content API, a String value is passed to userType, ensuring it aligns with the type declaration from Settings.
In the Visual Editor
The targeting condition is set using the custom defined userType attribute, with premium as the expected value of type String.
In the Settings
In the Targeting section, the userType attribute is defined as a string type.
In the code
When making a request to the Content API, a string value is passed to userType, ensuring it aligns with the type declaration from Settings.
In the Visual Editor
The targeting condition is set using the custom defined userType attribute, with premium as the expected value of type String.
In the Settings
In the Targeting section, the userType attribute is defined as a String type.
In the code
When making a request to the Content API, a String value is passed to userType, ensuring it aligns with the type declaration from Settings.
In the Visual Editor
The targeting condition is set using the custom defined userType attribute, with premium as the expected value of type String.
In the Settings
In the Targeting section, the userType attribute is defined as a string type.
In the code
When making a request to the Content API, a string value is passed to userType, ensuring it aligns with the type declaration from Settings.
In the Visual Editor
The targeting condition is set using the custom defined userType attribute, with premium as the expected value of type String.
In the Settings
In the Targeting section, the userType attribute is defined as a string type.
In the code
When making a request to the Content API, a string value is passed to userType, ensuring it aligns with the type declaration from Settings.
In the Visual Editor
The targeting condition is set using the custom defined userType attribute, with premium as the expected value of type String.
In the Settings
In the Targeting section, the userType attribute is defined as a String type.
In the code
When making a request to the Content API, a String value is passed to userType, ensuring it aligns with the type declaration from Settings.
In the Visual Editor
The targeting condition is set using the custom defined userType attribute, with premium as the expected value of type String.
In the Settings
In the Targeting section, the userType attribute is defined as a string type.
In the code
When making a request to the Content API, a string value is passed to userType, ensuring it aligns with the type declaration from Settings.
In the Visual Editor
The targeting condition is set using the custom defined userType attribute, with premium as the expected value of type String.
In the Settings
In the Targeting section, the userType attribute is defined as a String type.
In the code
When making a request to the Content API, a String value is passed to userType, ensuring it aligns with the type declaration from Settings.
In the Visual Editor
The targeting condition is set using the custom defined userType attribute, with premium as the expected value of type String.
In the Settings
In the Targeting section, the userType attribute is defined as a String type.
In the code
When making a request to the Content API, a String value is passed to userType, ensuring it aligns with the type declaration from Settings.
In the Visual Editor
The targeting condition is set using the custom defined userType attribute, with premium as the expected value of type String.
In the Settings
In the Targeting section, the userType attribute is defined as a String type.
In the code
When making a request to the Content API, a String value is passed to userType, ensuring it aligns with the type declaration from Settings.
In the Visual Editor
The targeting condition is set using the custom defined userType attribute, with premium as the expected value of type String.
In the Settings
In the Targeting section, the userType attribute is defined as a String type.
In the code
When making a request to the Content API, a String value is passed to userType, ensuring it aligns with the type declaration from Settings.
In the Visual Editor
The targeting condition is set using the custom defined userType attribute, with premium as the expected value of type String.
In the Settings
In the Targeting section, the userType attribute is defined as a String type.
In the code
When making a request to the Content API, a String value is passed to userType, ensuring it aligns with the type declaration from Settings.
In the Visual Editor
The targeting condition is set using the custom defined userType attribute, with premium as the expected value of type String.
In the Settings
In the Targeting section, the userType attribute is defined as a string type.
In the code
When making a request to the Content API, a string value is passed to userType, ensuring it aligns with the type declaration from Settings.
In the Visual Editor
The targeting condition is set using the custom defined userType attribute, with premium as the expected value of type String.
In the Settings
In the Targeting section, the userType attribute is defined as a String type.
In the code
When making a request to the Content API, a String value is passed to userType, ensuring it aligns with the type declaration from Settings.
In the Visual Editor
The targeting condition is set using the custom defined userType attribute, with premium as the expected value of type String.
In the Settings
In the Targeting section, the userType attribute is defined as a String type.
In the code
When making a request to the Content API, a String value is passed to userType, ensuring it aligns with the type declaration from Settings.
In the Visual Editor
The targeting condition is set using the custom defined userType attribute, with premium as the expected value of type String.
In the Settings
In the Targeting section, the userType attribute is defined as a string type.
In the code
When making a request to the Content API, a string value is passed to userType, ensuring it aligns with the type declaration from Settings.
In the Visual Editor
The targeting condition is set using the custom defined userType attribute, with premium as the expected value of type String.
In the Settings
In the Targeting section, the userType attribute is defined as a String type.
In the code
When making a request to the Content API, a String value is passed to userType, ensuring it aligns with the type declaration from Settings.
In the Visual Editor
The targeting condition is set using the custom defined userType attribute, with premium as the expected value of type String.
Use custom types with plugins
You can create and use custom types with plugins like Shopify, Cloudinary, BigCommerce, Magento, and others. These plugins provide rich interfaces for inputs such as colors, forms, or products. The stored values depend on the editor and may not always be immediately clear.
For more details on stored values, see Extending the UI with custom types in the Making a Plugin.
What's next
Take your targeting a step further by scheduling your content and creating A/B tests to measure your Page or Section engagement.