Home App Docs Blog Github

Dynamic Button with url param

Please fill out as many of the following questions as possible so we can help you promptly! If you don’t know how to answer or it does not apply, feel free to remove it or leave it blank.

Builder content link

Builder public api key

What are you trying to accomplish
I’m trying to append dynamic url param values to our button cta link for tracking purposes. So for example we attached externalId to our builder page. I have buttons on my page that I want to pass with the cta to our signup page with the same externalId.

I’m accomplishing this with logic in the custom JS to attach the value to the state.

I’m noticing it works in staging, but in production, the state is correctly being set, but the value is not getting attached to the rest of the page. perhaps it is a race condition? I’m not too familiar with the order in which the custom information is being attached to the button

Screenshots or video link
Screenshots of your issue, or even better a link to a video of what is happening or what you are trying to accomplish. We love using loom for that sort of thing

Code stack you are integrating Builder with
e.g. NextJS, react, Shopify

Reproducible code example
If you are having integration errors, please link to codesandbox or copy and paste your problematic code here. The more detail the better!

Looking at the content custom js code, I think this issue might be related to how the code for the state property relies on window object , try delaying the rendering of the button to the browser, you can do so by binding a show If on to Builder.isBrowser