Dynamically changing the URL of a script embed

Hi!

I have a page with dynamic buttons that each contain a Script ID variable. I want to pass this variable to a static page with a form embed code URL that loads different forms based on the Script ID.

How do I pass the Script ID into the embed code’s URL? I have a string query loading into the page, but I do not know how to grab it within a code embed on a static page (there is no Fields I can add to the embed code)

Example:
(/upcoming-programs?reference=12345) leads to a page with an embed of (<script src=“www.embed.com/12345“)

Thanks!