I’ve been wondering about whether it’s possible to allow people building pages in Builder to refer to user-specific data. For example, for them to add some content to the page like “Hello Username”, where username varies for different logged-in users on our site.
For context, we mainly use Builder’s Pages feature, which we fetch the content for server side, and then return the HTML of this in our page responses.
I feel like Custom Targeting Attributesmight be able to be used for this, but I’m not 100% sure. There is a key query param of the URL that seems like it could be for that
userAttributes.product=${product.id}
Are there other or recommended ways to try to do this?
Custom Targeting Attributes seem like a very good option for your use case. Using Builder’s built-in types, custom targeting attributes offer a straightforward way to allow your team to specify arbitrary targeting conditions[in your case username] using strings and booleans.
You can certainly target something like userAttributes.username=${username} and update the welcome message based on the username.
You can bind any state to a text or other input using the state keyword, for example, if you have state.color = "#000" then you can bind a background or text with state value by just binding it to state.color