This comprehensive guide will help you integrate a button on your website that opens your Molin chat window. There are two ways to go about this: either by creating a new custom button or by making an existing element on your webpage clickable to launch the chat window.
Locate the section of your website where you want the button to be displayed. Insert the following HTML code:
<button type="button" onclick="document.querySelector('molin-shop-ai').openChat()">Chat with Shop AI</button>
Feel free to personalize the appearance and text of the button. For instance, you can replace the "Chat with Molin AI" text with a label that better fits your brand. Additional CSS can be added to style the button according to your design preferences.
Example for the added CSS:
<button type="button" onclick="document.querySelector('molin-shop-ai').openChat()" style="font-family: sans-serif; background: #601feb; color: white; padding: 8px 32px; border-radius: 999px; font-size: 16px;">Chat with Lenoa AI</button>
The design that this button has:
If you already have an element (such as an image, graphic, or text) on your website that you'd like to use for launching the Molin chat, follow these steps:
Wrap the existing element in an <a> tag and insert the following snippet. Replace the 'Insert your element here' text with the HTML element you wish to make clickable:
<a href="javascript:void(0);" onclick="document.querySelector('molin-shop-ai').openChat()">Insert your element here</a>
Regardless of the method you choose, remember to conduct thorough tests to ensure everything is functioning as intended.
By following either of these methods, you can make it easy for visitors to open your Molin AI chat window directly from your website.