Integrating the TailorTalk Chat Widget

Follow these steps to add the TailorTalk Chat Widget to your website and customize its appearance and behavior.

Step 1: Navigate to Website Integration

  1. Go to the Agent Setup Page in your TailorTalk dashboard.
  2. Click the Connect button on the Website Channel.
website integration

Step 2: Customize and Test

Please enter your preferred settings and information in the widget configuration form and test the widget within it.

Widget Configuration

Widget Parameters

TailorTalk uses a configuration object with both top-level parameters and a nested options object for detailed customization.

Top-level Parameters

Parameter Type Default Description Required
widgetName string (your agent name) Internal name or window title of the widget. Yes
agentId string (you agent id) Your unique Agent ID. Yes
color string '#6366f1' Widget primary color (hex code). Yes
position string 'right' Horizontal position of the widget ('left' or 'right'). Yes
fullscreen string false Opens the widget in fullscreen mode, allowing it to take up the entire viewport. No
options object {} Nested object for UI/UX customizations (see below). No
conversionTracking boolean true Sends widget clicks and messages to your Google and Meta tags. Set to false to turn off. See Conversion Tracking. No

Fullscreen Mode

  • Ideal when the chat needs more space, such as displaying several products from your store at once.
  • Lets shoppers view and compare multiple options without excessive scrolling, such as comparing colours, sizes or similar pieces in stock.
  • Gives a more immersive experience for flows like styling help, complete the look and booking a video call.
  • Supports rich content such as cards, carousels, and image galleries, for example showcasing product recommendations, new arrivals or a full outfit.

Options Parameters (passed inside the options object)

Parameter Type Default Description
buttonIcon string 'bot' Icon displayed on the widget button.
buttonText string 'Let's Chat' Text displayed on the widget button.
welcomeMessage string (default message) Initial greeting shown to users when they open the chat.
popupMessage string (empty) Short teaser message shown in a bubble before the widget opens.
quickQuestions string[] [] List of up to 3 short questions (max 55 chars each) for quick interactions.
askDetails boolean false Toggle to collect user name and phone before chat.
defaultCountryCode string 'IN' Default country code for phone number input (ISO 3166-1 alpha-2).
launcher string or object "button" Which button opens the chat: "button" (the floating button) or "tab" (a vertical tab on the edge of the screen). Give one value for every screen, or one per screen size: { mobile: "tab", tablet: "tab", desktop: "button" }. See below.
sideButton boolean false Older shortcut for launcher: { mobile: "tab" }: a side tab on phones only. Still works.
sideButtonY number (centred) For the side tab, how many pixels it sits above the bottom of the screen, e.g. 120 (no px needed). Leave it out to keep the tab vertically centred.
buttonWidth number 42 The side tab's width in pixels.
buttonHeight number 150 The side tab's height in pixels. The text resizes to fit.

Side Tab: Screen Sizes, Position and Size

The side tab is a vertical button on the edge of the screen. Choose where it shows with launcher, per screen size; any size you leave out shows the floating button.

Screen size Width of the browser window
mobile under 768 px
tablet 768 to 1023 px
desktop 1024 px and wider

The widget checks the width again when the window is resized or a phone is turned, so a phone held sideways gets the tablet choice.

  • Which edge: set the top-level position to "right" or "left".
  • How high: set sideButtonY to the number of pixels between the bottom of the screen and the tab. A bigger number moves it up. Leave it out to keep the tab in the middle.
  • Size: set buttonWidth and buttonHeight in pixels.
options: {
  buttonText: "Chat with us",
  launcher: { mobile: "tab", tablet: "tab", desktop: "button" },
  sideButtonY: 120,   // 120 px above the bottom of the screen
  buttonWidth: 42,
  buttonHeight: 180
}

You can also pick the button style in the dashboard: Button Style in the widget settings.

Side button centred, at sideButtonY 120 and at sideButtonY 400

Step 3: Save & Generate Code

  1. Click Generate Code.
  2. Choose your Integration method (e.g., HTML, React, etc.).
  3. Copy the generated code snippet.
Widget code

Step 4: Add the Widget Code to Your Website

Choose your integration method and add the code as follows:

  • HTML Website:
    Paste the code just before the closing </body> tag in your main HTML file (e.g., index.html).

  • React Application:
    Place the code inside a useLayoutEffect (or useEffect) in your main component (e.g., App.js).
    You can also create a dedicated component for the widget.

  • Next.js Application:
    Use the code in your main layout or page file.
    Make sure to import next/script as Script.

Example Integration Code

Choose your integration method and use the corresponding code snippet below.
Replace the values as needed for your configuration.

HTML Website

<script>
  (function() {
    function loadTailorTalkWidget(callback) {
      var script = document.createElement('script');
      script.src = "https://plugins.tailortalk.ai/widget.js";
      script.onload = callback;
      document.head.appendChild(script);
    }

    loadTailorTalkWidget(function() {
      TailorTalk.init({
        widgetName: "YOUR_WIDGET_NAME",
        agentId: "YOUR_AGENT_ID",
        color: "#6366f1",
        position: "right",
        options: {
          buttonText: "Let's Chat",
          welcomeMessage: "Hello! How can I assist you today?",
          quickQuestions: ["How can you help?", "Tell me more about..."], // Optional
          launcher: { mobile: "tab" } // Side tab on phones, floating button elsewhere
        }
      });
    });
  })();
</script>

React Application

import React from "react";

React.useLayoutEffect(() => {
  if (!document.getElementById("tailortalk-widget-script")) {
    const script = document.createElement("script");
    script.id = "tailortalk-widget-script";
    script.src = "https://plugins.tailortalk.ai/widget.js";
    script.async = true;
    document.body.appendChild(script);

    script.onload = () => {
      window.TailorTalk && window.TailorTalk.init({
        widgetName: "YOUR_WIDGET_NAME",
        agentId: "YOUR_AGENT_ID",
        color: "#6366f1",
        position: "right",
        options: {
          buttonText: "Let's Chat",
          welcomeMessage: "Hello! How can I assist you today?",
          quickQuestions: ["How can you help?", "Tell me more about..."], // Optional
          launcher: { mobile: "tab" } // Side tab on phones, floating button elsewhere
        }
      });
    };
  }

  return () => {
    const container = document.querySelector(".tt-widget-container");
    if (container) container.remove();
  };
}, []);

Next.js Application

import Script from "next/script";

<>
  <Script src="https://plugins.tailortalk.ai/widget.js" strategy="afterInteractive" />
  <Script id="tailortalk-init" strategy="afterInteractive">{`
    function initTailorTalkWidget() {
      if (window.TailorTalk && window.TailorTalk.init) {
        window.TailorTalk.init({
          widgetName: "YOUR_WIDGET_NAME",
          agentId: "YOUR_AGENT_ID",
          color: "#6366f1",
          position: "right",
          options: {
            buttonText: "Let's Chat",
            welcomeMessage: "Hello! How can I assist you today?",
            quickQuestions: ["How can you help?", "Tell me more about..."], // Optional
            launcher: { mobile: "tab" } // Side tab on phones, floating button elsewhere
          }
        });
      } else {
        setTimeout(initTailorTalkWidget, 100);
      }
    }
    initTailorTalkWidget();
  `}</Script>
</>

Tip:

  • For all methods, replace the sample values with your actual configuration.
  • If you use another framework, ensure the script loads after the DOM is ready and the widget is initialized as shown.

Confirmation

Widget Confirmation

Once integrated, your TailorTalk widget will appear on your website, ready to assist your visitors.

By following these steps, you can easily integrate and customize the TailorTalk Widget to match your website's style and user experience.

Track Clicks and Messages as Conversions

The widget automatically sends its clicks and messages to the Google tag, Google Tag Manager and Meta Pixel on your website. To use them as conversions in Google Ads and Meta campaigns, see Conversion Tracking.

XLinkedIn