How Do I Add The Chatbot to My Website?

Install HubSpot’s tracking code, verify your domain, set targeting rules, and publish your chatbot to go live on any website.

Step-by-Step Deployment Guide

1. Copy the HubSpot Tracking Code

You'll need the tracking code from your HubSpot portal.

  • Go to Settings (⚙️ in top nav)

  • Navigate to Tracking & Analytics > Tracking Code

  • Copy the JavaScript code snippet

2. Paste the Tracking Code on Your External Website

Insert the tracking code before the </body> tag on every page where you want the chat widget to appear.

This can usually be done in your website builder or CMS under “Custom Code,” “Header/Footer Scripts,” or directly in your template files.

3. Verify Domain in HubSpot

To ensure the chatflow runs on the external site, the domain must be added and verified.

  • Go to Settings > Tracking & Analytics > Tracking Code

  • Under Advanced Tracking, add the external domain

  • HubSpot will then allow chat to appear on that site

4. Customize Chatflow Targeting Rules (Optional)

Make sure your chatflow is set to appear on the correct domain/pages:

  • Go to Conversations > Chatflows

  • Edit your chatbot

  • Under Target > Website URL, ensure it includes your external domain or specific URLs (e.g. contains www.clientsite.com)

5. Publish the Chatflow

Once targeting rules and bot setup are confirmed, click "Publish" to go live.


🔎 Optional Enhancements

  • Custom Chat Widget Behavior: Use window.HubSpotConversations JavaScript API for advanced control (e.g., open/close programmatically).

  • Multiple Sites: You can reuse the same chatbot across different domains, just update targeting rules accordingly.