I want to run a brief session in which users chat with a chatbot as an experimental stimulus. So the chatbot will be in the middle of the survey. Thus far i have been using Landbot, but I *am* open to switching to another chatbot.
My problem is embedding the chatbot in a question. If I use an iframe, the chatbot stalls at the first user response. If I try to use javascript, I get an error message that the script (below) has “Unexpected token <”
<script>
window.addEventListener('mouseover', initLandbot, { once: true });
window.addEventListener('touchstart', initLandbot, { once: true });
var myLandbot;
function initLandbot() {
if (!myLandbot) {
var s = document.createElement('script');s.type = 'text/javascript';s.async = true;
s.addEventListener('load', function() {
myLandbot = new Landbot.Popup({
configUrl: 'https://storage.googleapis.com/landbot.online/v3/H-2115917-N3AUV7GO5MNHY5BG/index.json',
});
});
s.src = 'https://cdn.landbot.io/landbot-3/landbot-3.0.0.js';
var x = document.getElementsByTagName('script')l0];
x.parentNode.insertBefore(s, x);
}
}
</script>
I have tried using solutions people have posted to a similar problem 3 years ago. It seems like my problem is new … possibly due to upgrades to both the chatbot and Qualtrics.
I am not well-versed in javascript, and I cannot figure out how to do more sophisticated api-based solutions that are suggested elsewhere I have looked for help.