Step-by-Step Guide: Integrating the Chatbot into Your Website

Follow these instructions to implement the chatbot into various platforms. Each section includes clear steps to ensure the widget appears correctly on your site.

NEXT.JS

1. Add the Script to Your Layout:

• Insert the script tag inside the <head> section of your main layout file (e.g., app/layout.js or pages/_app.js).

next code

2. Save and Verify:

• Save your changes.
• Open your website in a browser. The chatbot widget should appear in the lower-right corner.

next code

REACT.JS

1. Insert the Script:

• Open the index.html file located in the public folder of your React project.
• Add the script tag inside the <head> section:

next code

2. Save and Verify:

• Save your changes and start your development server.
• Open your website in a browser to confirm the chatbot widget appears in the lower-right corner.

next code

GATSBY

1. Add the Script to Required Files:

• Add the script to both gatsby-ssr.js and gatsby-browser.js files:

gatsby-ssr.js:

next code

gatsby-browser.js:

next code

2. Restart the Server:

• Restart your development server to apply the changes.

3. Verify:

• Open your website in a browser to ensure the chatbot widget appears in the lower-right corner.

next code

HTML, CSS, JavaScript

1. Insert the Script:

• Open your index.html file.
• Add the script tag at the end of the <body> section:

next code

2. Save and Verify:

• Save your changes and load your website in a browser. The chatbot widget should appear in the lower-right corner.

next code

WordPress

Method 1: Adding Code to functions.php

1. Access the Theme Files:

• Log in to your WordPress Admin Panel.
• Navigate to the functions.php file:
• Use the WP File Manager plugin or access it directly via FTP under
wp-content/themes/<active-theme-name>/functions.php.

next code

2. Add the Code:

• Add the following code at the end of the functions.php file:

function add_chatbot_script_to_footer() {
    wp_enqueue_script(
        'chatbot-answering-legal', // Unique script identifier
        'https://chatapi.answeringlegal.com/tenant/main.js/...',
        array(),
        null,
        true // Load in the footer
    );
}
add_action('wp_enqueue_scripts', 'add_chatbot_script_to_footer');
next code

3. Save and Verify:

• Save the functions.php file.
• Visit your site in a browser. The chatbot widget should appear in the lower-right corner.

next code

Method 2: Using the Code Snippets Plugin

1. Install the Code Snippets Plugin:

• Go to your WordPress Admin Panel.
• Navigate to Plugins > Add New.
• Search for Code Snippets and click Install Now, then Activate.

next code

2. Add a New Snippet:

• Go to Header & Footer section inside the plugin
• Enter the script in Footer Section

next code

Both methods ensure the chatbot script is added correctly to your site. The Code Snippets plugin is recommended for users who prefer not to edit theme files directly, as it avoids the risk of breaking the site.

Verification Steps (for All Platforms)

1. Open Your Website:

• Navigate to your website using a browser.

2. Check for the Chatbot Widget:

• Confirm that the chatbot widget appears in the lower-right corner of your site.

This guide includes all necessary steps for implementing the chatbot to your website. Ensure you follow the instructions relevant to your platform and verify after implementation.