dzei
02/12/2026, 11:19 AMAI Evy
02/12/2026, 11:19 AMAI Evy
02/12/2026, 11:20 AMdata-dynamic attribute where you can inject custom data: [(1) ]()
html
<script
id="retell-widget"
src="<https://dashboard.retellai.com/retell-widget.js%22>
type="module"
data-public-key="YOUR_RETELL_PUBLIC_KEY"
data-agent-id="YOUR_CHAT_AGENT_ID"
data-dynamic='{"key": "value"}'
></script>
You could populate this with the current page URL or page name using JavaScript on your website. For example, you might set data-dynamic='{"current_page": "pricing"}' and then reference {{current_page}} in your agent's prompt. [(2) ]()
Dynamic variables can be used in prompts, begin messages, tool configurations, and more.
Check out these potentially useful sources: [Dynamic Variables]() , [Retell Website Widget]()
Would you like a general answer on how to dynamically set the data-dynamic attribute based on the current page?AI Evy
02/12/2026, 11:20 AMAI Evy
02/12/2026, 11:20 AMdzei
02/12/2026, 11:22 AMdzei
02/12/2026, 11:23 AMAI Evy
02/12/2026, 11:23 AMAI Evy
02/12/2026, 11:23 AMdata-dynamic attribute based on the current page, you can use JavaScript to inject the page information before the widget loads. Here's a general approach:
html
<script>
// Get the current page path or title
const currentPage = window.location.pathname;
// Or use: document.title, or a custom page identifier
// Create the dynamic variables object
const dynamicVars = JSON.stringify({
"current_page": currentPage
}) ;
// Set the attribute on the widget script
document.addEventListener('DOMContentLoaded', function() {
const widgetScript = document.getElementById('retell-widget') ;
if (widgetScript) {
widgetScript.setAttribute('data-dynamic', dynamicVars) ;
}
}) ;
</script>
<script
id="retell-widget"
src="<https://dashboard.retellai.com/retell-widget.js%22>
type="module"
data-public-key="YOUR_RETELL_PUBLIC_KEY"
data-agent-id="YOUR_CHAT_AGENT_ID"
></script>
Then in your agent's prompt, reference the variable using double curly braces: [(1) ]()
The user is currently on page: {{current_page}}
Dynamic variables can be used in prompts, begin messages, tool configurations, and more.
You can also use window.location.href for the full URL, or define custom page names based on your routing logic.AI Evy
02/12/2026, 11:23 AMAI Evy
02/12/2026, 11:23 AM