https://retellai.com/?utm_source=discord&utm_medium=seo logo
lets say I have deployed the chatbot in an website
# ❓・ai-evy-support
d
@AI Evy lets say I have deployed the chatbot in an website. now is there any way for the chatbot to know which page of the website the user is on in real time?
a
Thanks for tagging me @dzei. I'll look through relevant sources and get back to you shortly.
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
​ To learn more, see the sources I considered: [[1] Retell Website Widget](https://docs.retellai.com/deploy/chat-widget) ​
### Answer [(1) ]() : Yes, you can pass page-specific information to the chatbot using the
data-dynamic
attribute when deploying the Retell chat widget . The chat widget supports a
data-dynamic
attribute that accepts a JSON object with custom key-value pairs . You can use JavaScript to dynamically update this attribute with the current page URL or other page-specific information . Here's how you can implement this:
Copy code
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='{"current_page": "homepage", "url": "<https://yoursite.com/%22%7D'>
></script>
To make this work in real-time as users navigate your site, you'd need to use JavaScript to update the
data-dynamic
attribute whenever the page changes. You can capture
window.location.href
or other page identifiers and pass them through this attribute, making the information available to your chat agent during conversations .