An AI chatbot on your website can answer questions at 2 AM, qualify leads while you sleep, and reduce your support ticket volume by half. Or it can annoy your visitors, give wrong answers, and make your brand look like it was built by someone who discovered automation last Tuesday. The difference is not the technology. It is how you set it up.

This guide covers the full process: why businesses add chatbots, what separates a good chatbot from a bad one, how to write a system prompt that actually works, what to put in the knowledge base, how to embed it on any website platform, and how to measure whether it is helping or hurting. It is written for business owners and marketing teams, not engineers.

1. Why Businesses Add Chatbots

The business case for a website chatbot is straightforward. Your website gets traffic around the clock, but your team works fixed hours. Every visitor who has a question and cannot get an answer is a potential customer who might leave and never come back.

The most common reasons businesses add chatbots:

2. What Makes a Good Chatbot

A good chatbot does not try to be a human. It tries to be useful. The best chatbots share several characteristics:

It Knows What It Knows

A good chatbot answers questions within its knowledge base accurately and confidently. Equally important, it recognizes when a question is outside its knowledge and says so honestly instead of making something up. The technical term for a chatbot inventing answers is "hallucination," and it is the single most damaging behavior a chatbot can exhibit. A visitor who gets a wrong answer and acts on it will not blame the chatbot. They will blame your company.

It Sounds Like Your Brand

A chatbot on a law firm's website should not use emojis. A chatbot on a surf shop's website should not sound like a legal brief. Your chatbot's tone, vocabulary, and personality should match your brand voice. If your brand is professional and understated, the chatbot should be professional and understated. If your brand is casual and friendly, the chatbot should be casual and friendly.

It Gets to the Point

Long-winded chatbot responses are a usability problem. Visitors are scanning, not reading novels. Good chatbot responses are concise: they answer the question, provide the essential context, and offer a clear next step. If the visitor needs more detail, they can ask a follow-up question.

It Knows When to Hand Off

Not every conversation should be handled by a chatbot. Complex sales discussions, sensitive support issues, and frustrated customers all need a human. A good chatbot recognizes these situations and hands the conversation to a person with the context of what has already been discussed.

3. How to Write a System Prompt

The system prompt is the set of instructions that defines your chatbot's behavior. It is the most important piece of configuration you will write, and most businesses get it wrong on the first try. That is fine. You will iterate.

What a System Prompt Should Include

  1. Role definition — Tell the chatbot who it is and what company it represents. "You are the customer support assistant for [Company Name]. You help visitors understand our products and answer questions about our services."
  2. Tone and personality — Define how the chatbot should communicate. "Respond in a professional, friendly tone. Use plain language. Avoid jargon unless the visitor uses it first."
  3. Knowledge boundaries — Tell the chatbot what topics it can and cannot discuss. "Only answer questions about [Company Name] products and services. If asked about competitors, say you can only speak to our own offerings. If asked about something you don't know, say so and offer to connect the visitor with our team."
  4. Response format — Specify how responses should be structured. "Keep responses under 3 sentences unless the visitor asks for more detail. Use bullet points for lists of features or options."
  5. Handoff rules — Define when the chatbot should escalate. "If the visitor asks to speak to a person, asks about pricing for enterprise plans, or expresses frustration, provide our contact email and phone number."
  6. Prohibited behaviors — List what the chatbot must never do. "Never make up information. Never provide legal, medical, or financial advice. Never share internal company information. Never promise discounts or special deals."

Common mistake: Writing a system prompt that is too vague. "Be helpful and friendly" is not a system prompt. It is a wish. Good system prompts are specific about what the chatbot should and should not do, with examples of ideal responses for common scenarios.

Example System Prompt Structure

Here is a template that works for most businesses. Replace the brackets with your specific information.

You are the AI assistant for [Company Name], a [brief description]. Your job: Answer visitor questions about our [products/services], help them find what they need, and collect their contact info if they want to talk to our team. Tone: [Professional and warm / Casual and direct / etc.] Keep responses under 3 sentences unless asked for detail. Use bullet points for feature lists. You know about: - Our [products/services] and how they work - Our pricing (refer to the pricing page for specifics) - Our company background and team - Common technical questions from our FAQ You do NOT know about: - Competitor products (say "I can only speak to our offerings") - Internal company operations - Legal or financial advice If the visitor asks to talk to a person, wants a custom quote, or seems frustrated, respond with: "I'd love to connect you with our team. You can reach us at [email] or [phone], or I can have someone follow up with you." Never make up an answer. If you're not sure, say: "I don't have that information, but our team can help. Want me to connect you?"

4. Building Your Knowledge Base

The system prompt defines behavior. The knowledge base defines what the chatbot actually knows. Without a knowledge base, your chatbot is working from the AI model's general training data, which means it might know about your industry but knows nothing specific about your business.

What to Include

What Not to Include

Knowledge base maintenance: A knowledge base is not a one-time project. Every time you change your pricing, add a product, update a policy, or learn about a new common question, the knowledge base needs to be updated. Set a calendar reminder to review it monthly.

5. How to Embed on Any Website Platform

Most chatbot platforms provide an embed code: a small snippet of HTML and JavaScript that you paste into your website. The embed process varies by platform, but the mechanics are the same everywhere.

WordPress

For WordPress sites, you have two options. The simplest is to paste the embed code into your theme's footer. Go to Appearance > Theme Editor > footer.php and paste the code just before the closing </body> tag. If you are using a page builder like Elementor, add an HTML widget to your site's global footer template.

If you are not comfortable editing theme files, many chatbot providers offer WordPress plugins that handle the embed automatically. Install the plugin, enter your chatbot ID or API key, and the widget appears on every page.

Shopify

In Shopify, go to Online Store > Themes > Edit Code. Open the theme.liquid file and paste the embed code just before the closing </body> tag. Save and publish. The chatbot will appear on every page of your store.

Squarespace

Squarespace supports code injection under Settings > Advanced > Code Injection. Paste your chatbot embed code in the Footer section. This adds the code to every page without touching your theme templates.

Any HTML Website

For any static HTML site, open your main HTML file (usually index.html) and paste the embed code before the closing </body> tag. If your site has multiple pages, paste it in each page or use a shared footer file that all pages include.

Single-Page Applications (React, Vue, Angular)

For SPAs, add the embed script to your index.html file in the public directory. The chatbot will load once when the app initializes and persist across route changes. If you need to control when the chatbot appears (for example, only on certain pages), most providers offer JavaScript APIs to show and hide the widget programmatically.

6. Measuring Chatbot Performance

A chatbot that nobody uses is a waste of money. A chatbot that everybody uses but gives bad answers is worse. You need to measure both engagement and quality.

Engagement Metrics

Quality Metrics

Business Impact Metrics

7. Common Mistakes and How to Avoid Them

Having deployed chatbots across dozens of businesses, certain mistakes appear repeatedly. Knowing them in advance saves you weeks of debugging.

Mistake 1: Launching Without Testing

Before your chatbot goes live, test it with 30-50 questions that your real customers ask. Do this yourself, not with a testing script. If any answer is wrong, misleading, or off-brand, fix the system prompt or knowledge base before launch. The first impression a chatbot makes is the one that sticks.

Mistake 2: Making It Too Aggressive

A chatbot that pops up immediately, blocks the content, and starts asking questions before the visitor has read a single word is the digital equivalent of a salesperson who follows you around the store. Set your chatbot to appear after a reasonable delay (15-30 seconds), or let it sit quietly in the corner until the visitor initiates. Proactive messages can work, but they should be relevant to the page the visitor is on, not generic "How can I help you?" prompts.

Mistake 3: No Escalation Path

If a visitor asks to speak to a person and the chatbot has no way to make that happen, you have created a dead end. Always include a clear path to human contact: an email address, a phone number, a calendar booking link, or a live chat handoff. The chatbot should present these options without the visitor having to ask twice.

Mistake 4: Set It and Forget It

Chatbots need maintenance. Your products change, your pricing changes, your policies change, and new common questions emerge. Review your chatbot's conversation logs at least monthly. Look for questions it cannot answer, answers that are outdated, and patterns that suggest knowledge base gaps. A chatbot that gives stale information is worse than no chatbot at all.

Mistake 5: Ignoring Mobile

More than half of website traffic comes from mobile devices. Test your chatbot on a phone. Is the widget too large? Does it cover critical content? Can visitors easily close it? Is the text readable without zooming? Mobile chatbot UX is a common afterthought that becomes a primary frustration.

Mistake 6: Too Much Personality, Not Enough Substance

Some businesses spend more time crafting their chatbot's witty persona than building its knowledge base. Visitors do not care if your chatbot tells jokes. They care if it can answer their question. Personality is a nice-to-have. Accuracy is a must-have.

8. Choosing the Right Approach

There are three broad approaches to adding a chatbot to your website, each with different tradeoffs.

Hosted Chatbot Platforms

Services that provide the AI, the widget, and the management dashboard. You configure the chatbot through their interface, upload your knowledge base, and embed their widget. This is the fastest path to a working chatbot and requires no technical skills. The tradeoff is less customization and ongoing subscription costs.

API-Based Custom Build

You build your own chatbot interface and connect it to an AI API. This gives you full control over the user experience, the conversation flow, and the data handling. The tradeoff is development time and the need for ongoing maintenance. This approach makes sense for businesses with engineering teams who want a tightly integrated experience.

Hybrid Approach

Use a platform for the core chatbot functionality but customize the widget's appearance and behavior to match your site. Many platforms offer enough customization through CSS and JavaScript hooks that the chatbot looks and feels native to your website while still being managed through the platform's dashboard.

Decision framework: If you need a chatbot working this week and do not have developers, use a hosted platform. If you have engineers and want the chatbot deeply integrated into your product, build custom. If you want something in between, look for platforms with strong customization options.

Build Your AI Chatbot with StellarClose

Our bot builder lets you configure your system prompt, upload your knowledge base, and get an embed code in minutes. No coding required.

Try the Bot Builder