function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Michael MMichael M 

Is there a way for an Einstein bot to take the url that it is placed upon and use that as a variable?

We want to place our chatbot and several different websites. All of them will have the same menu options, but for one of the dialogues, which plays a video when the user clicks on it, we want that video to be different depending on which website it is on. I am trying to avoid using a completely different chatbot. Is there a way to get the URL as a variable, and then based on that, display a different video for each website it on?
Best Answer chosen by Michael M
Michael MMichael M
This may be the answer here: https://salesforce.stackexchange.com/questions/326128/how-to-get-window-location-href-as-a-variable-in-einstein-bot/326144#326144

All Answers

AbhishekAbhishek (Salesforce Developers) 
Micheal,

There is no definite answer to your questions.

But you can check the below for reference,

https://www.salesforce.com/products/service-cloud/resources/chatbots-for-customer-service/

https://developer.salesforce.com/forums/?id=9060G0000005l8cQAA


Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks.
Michael MMichael M
Hi Abhishek, Thank you for your answer. I did not find an answer on those websites.

I found a similar idea to what I want to do here:
https://salesforce.stackexchange.com/questions/277915/live-agent-users-current-location-url 

On that website, they say to add this code to the embedded service:
embedded_svc.settings.extraPrechatFormDetails = [{ "label": "URL", "value": window.location.href, "displayToAgent": true, "transcriptFields": ["URL__c"] }];

However I do not understand how to add to add this code. When I look at my embedded service code snippet, there is no edit button. How can I add that code? And if I cannot, is there any other way to use window.location.href in my einstein bot?
Michael MMichael M
This may be the answer here: https://salesforce.stackexchange.com/questions/326128/how-to-get-window-location-href-as-a-variable-in-einstein-bot/326144#326144
This was selected as the best answer
Rahul Bejgam 6Rahul Bejgam 6
Hi,
There is a field on the Chat Transcript Object with label -> Referring Site, we can use that to get the site name. Adding a custom field to the embedd service with the embedded_svc.settings.extraPrechatFormDetails also works.