Closed jcabot closed 4 years ago
We can access the page URL within the widget using window.location.href
or for a cleaner solution we can embed the widget inside a RouteComponent then get the location from the props.location
. Then we should send the URL alongside the user's message to the server and store it in the database.
I added hostname
and url
to the args
object of Socket.IO such as:
hostname
is the domain name of the web host where the widget is deployed (e.g., localhost)url
is the URL of the current page (e.g., http://localhost:5000/admin)I can add more information such as the web protocol.
@gdaniel we should work on the server side to process this.
Hamza
Who is filling the parameters? As part of the call to renderWidget?
For now, these parameters are extracted automatically. We were discussing if we should allow the user to override their values by adding optional parameters to renderWidget
.
Hamza
I can't give a concrete example but I guess there will be situations where due to some strange internal URL forwardings, the "public" URL of the website where the widget is embedded may not be exactly the same one you'd get by extracting it automatically.
Nice job @hamzaed! I can't think of an example with such URL forwarding but I agree this could be configurable somehow. I also think that we should have it automatically extracted if not provided, no need to rely on a parameter if we can get the information by ourselves.
Thanks @gdaniel
I added hostname
and url
to the list of parameters of renderXatkitWidget
. I don't do any extra checking: if a parameter exists, I take it otherwise I extract the value directly.
The new signature of renderXatkitWidget
is the following:
renderXatkitWidget(server, username, elementId, title, subtitle, startMinimized, senderPlaceholder, profileAvatar, launcherImage, buttonsPlaceholder, hostname, url)
Talking with Joan Giner, he mentioned that clients typically want to correlate the chatbot usage with the pages where a specific question/issue was posed. In short, they want to know what pages generate plenty of questions (which means that those pages are not clear enough).