Setup Webchat Interface
Embedding Webchat
Learn how to embed the webchat interface in your website
Basic Implementation
Step 1: Add Script Tag
First, include the following script tag within the <head>
section of your HTML document:
This script initializes the Stubber Webchat module.
Step 2: Add HTML Tag
Next, add the Webchat component to your webpage by including the following HTML tag where you want the chat window to appear:
Replace the profile_uuid
with the UUID of your Webchat profile.
Note: To avoid overlay issues, place the Webchat tag within the
<body>
tag.
Display Modes
Webchat offers several display modes to suit different website integration needs:
Default Mode
The default mode displays the webchat as a floating button in the bottom right corner of the screen. When clicked, it opens a chat window.
Embedded Mode
Embedded mode positions the webchat UI in a custom position within your website. The webchat will grow to fit any div it is placed in.
Manual Mode
In manual mode, the webchat will not be fixed to the bottom right. Instead, the webchat window will grow to fit any div you place it in.
Advanced Configuration
Passing Custom Data
If you need to pass custom data from the Webchat to your stub, add the attribute pass_through_data
to the stubber-webchat
tag:
This data will be available in your stub at:
Using Stubref Instead of Profile UUID
If you've configured webchat via stub.data, you can use the stubref instead of a profile UUID:
Styling Your Webchat
You can customize the appearance of your webchat by setting the primary color CSS variable:
Note: Setting the primary color is completely optional. You can configure this color in your webchat profile settings instead of setting it inline. This approach is recommended for consistency across all instances of your webchat.
Complete Example
Here's a complete example of embedding webchat in a webpage: