A chatbot on a WordPress site
BizzBot5 min read
You add a chatbot to a WordPress site by inserting the line of code you get from the provider into the header or footer of the site, so that it loads on every page. You can do this through the admin area, without changing the look of the site. The exact menu names depend on the theme and version, so here we describe the general procedure.
In short
- The goal is for the line of code to load on all pages, not just one.
- The code is inserted in the header or footer, through the theme settings or through a plugin for inserting scripts.
- Make a backup of the site before changing anything.
- After inserting, check the site on a computer and on a phone.
Why there is no single path through the menus
WordPress is a system for building sites, and every site has its own theme and its own plugins. So there is no single path through the menus. The same goal, getting one line of code to load on all pages, can be reached in several ways, and each depends on how the site was built. We deliberately do not give exact plugin names, because they change and differ from site to site. So it is more useful to know what you are looking for than exactly where it is: a field where you can paste extra code that loads on every page of the site.
If you do not know what a script is and what exactly gets pasted, first read the text on putting a chatbot on a site.
Before you start
It is wise to do four things before any change.
- Make a backup. Most hosting companies offer it with one click, and there are plugins for it too. If something goes wrong, you go back to the old version.
- Check who maintains the site. If an agency or a freelancer built your site, tell them before the change. Some sites are locked, and changes in the theme get erased on update.
- Prepare the code. Have the line of code ready, exactly as you received it.
- Write down what you changed. A short note with the date and the place where you pasted the code saves time when you later need to move or remove it.
Three common ways to add the code
1. Theme settings
Many themes have a field for extra code in the header or footer. Look in the admin area for the theme settings or appearance customization, and in it for something like "header scripts" or "footer scripts", that is, "additional code". Paste the line and save.
Advantage: no extra plugin. Downside: if you change the theme, the code stays in the old one.
2. A plugin for inserting scripts
There are plugins whose only purpose is to let you insert code into the header or footer of all pages. Look in the plugin catalog by searching "header footer scripts" or similar, and read the ratings and the date of the last update before installing. After installing, you paste the code in the plugin's settings and save.
Advantage: the code stays even when you change the theme. Downside: one more plugin to maintain.
3. Editing theme files
Technically it is possible to insert the code directly into the theme files, but that is the riskiest way. A mistake in a file can display a blank page, and the change is often erased when the theme updates. The recommendation is to leave that to someone who knows the site and to try it on a copy first.
Checking and typical problems
What to check after inserting
Once you have saved the code, do not rely only on what you see in the admin area.
- Open the site in a private window to bypass the cache. If the icon does not show, clear the site's cache or the caching plugin's cache, if you have one.
- Check the home page, the services page, contact and at least one blog page.
- Open the site on a phone. The icon must not cover important buttons.
- Send the chatbot one simple question and check the answer.
- If you have a cookie banner, check that it does not overlap with the icon.
Typical problems
Most problems have a simple explanation.
- The icon does not appear. Most often it is the cache, or the code was pasted in the wrong place, for example into only one page.
- The code looks odd after pasting. Some editors turn quotation marks into "smart" quotes. Paste the code into a plain text editor and copy it from there.
- The chat disappears after a theme update. The code was in the theme files. Move it into the settings or into a plugin.
- The site slowed down. Check the speed before and after. If the difference is noticeable, consider removing other plugins you do not use. More in the text on a chatbot's effect on SEO.
- The icon shows only to logged-in users. Some script plugins choose where the code loads, so check the setting.
If you have an online shop on WordPress
The principle is the same, but you should also check the cart and checkout pages. A visitor should not get confused at that moment, and the icon must not cover the order confirmation button. General guidelines for shops are in the text on a chatbot on an online shop.
Frequently asked questions
Do I need a special plugin for a chatbot on WordPress?
You do not have to. It is enough for the line of code to load on all pages, which you can do through the theme settings or a plugin for inserting scripts. Whether you have a suitable field depends on the theme.
Does a chatbot slow down a WordPress site?
Every additional element can affect speed, so it is good to measure speed before and after. If you notice a big difference, check the other plugins and caching.
What if I am not supposed to touch a site an agency built?
Get in touch with them and pass them the code. For them it is a job of a few minutes, and you avoid the risk of a change disappearing on the next update.
What next
Make a backup of the site and see whether your theme has a field for extra code in the header or footer. If you need help with setup, get in touch, and with BizzBot we can paste the line of code for you too.