We’re building a page that we need to dynamically generate text elements on the page based on URL params. Is it possible in Builder and if so, what’s the best way to go about it?
Hi! Thanks for the question.
This is possible with Builder! The key is binding to
state.location.query.paramName (e.g. if you want the text to be “foo” if ? utm_name=foo is in the URL, bind to
state.location.query.utm_name). You can do this in the “Element Data Binding” section located in the “Data” tab.
You can also add a placeholder with
state.location.query.utm_name || 'default text!' if you want something else to display if it is not there.
You can also show and hide content on your pages based on params existing or having certain values (e.g.
state.location.query.someParam === 'some value'.
I hope this was helpful! If you have any questions, feel free to reach back out!