Hi all,
I have created a so-called “no-code” product tour on Usetiful which involves:
- Building my app in Streamlit
- Deploying it (in my case on Render)
- Building the product tour in Usetiful on my app by selecting various app components and designing triggers
- “Publishing” the Usetiful tour i.e. making it live for my app
To make the product tour run for a user, I have to embed Usetiful javascript into my Streamlit code. The Usetiful code looks like this:
<!-- Usetiful script start -->
<script>
(function (w, d, s) {
var a = d.getElementsByTagName('head')[0];
var r = d.createElement('script');
r.async = 1;
r.src = s;
r.setAttribute('id', 'usetifulScript');
r.dataset.token = "XXXXXXXXXXX";
a.appendChild(r);
})(window, document, "https://www.usetiful.com/dist/usetiful.js");</script>
<!-- Usetiful script end -->
My implementation of it in Streamlit looks like this:
import streamlit.components.v1 as components
usetiful_js = """
(function (w, d, s) {
var a = d.getElementsByTagName('head')[0];
var r = d.createElement('script');
r.async = 1;
r.src = s;
r.setAttribute('id', 'usetifulScript');
r.dataset.token = "XXXXXXXXXXX";
a.appendChild(r);
})(window, document, "https://www.usetiful.com/dist/usetiful.js");
"""
usetiful_html = f"<script>{usetiful_js}</script>"
components.html(usetiful_html)
Suffice to say, I’m posting here because when I run my app, the product tour doesn’t work. That is, nothing gets rendered on screen.
Is it because the Streamlit implementation “buries”/ “hides” the Usetiful javascript in an i-frame which means Usetiful misses it?
Anyway, if anyone can help me correctly implement it, I would greatly appreciate it!