Partner guide: PSB Hosting × DiveChat.
A live chat on your website gives visitors a quick way to ask a question at the moment they are ready to buy, instead of filling in a form and waiting. If your site runs on a VPS, adding a chat widget takes a few minutes, but server settings such as HTTPS, security headers and caching can stop it from appearing.
This guide shows how to add the DiveChat live chat to a WordPress site or a site on your own engine hosted on a VPS, which server settings to check, and how to test the chat before you announce it.
What You Need Before You Start
Prepare three things: a working site on HTTPS, access to its templates or admin panel, and a DiveChat account.
| What | Where to find it | Why it matters |
|---|---|---|
| A site on HTTPS | Your web server config (nginx or Apache) and SSL certificate | Browsers block or warn about scripts on insecure pages |
| Access to templates or WordPress admin | SSH/SFTP to the server or the WordPress dashboard | The widget code must be placed on every page |
| A DiveChat account | divechat.ru | The widget code is generated in your account |
| A list of security headers | Server config or security plugin | A strict Content-Security-Policy can block the widget |
If you are still choosing a server for the site, any PSB Hosting VPS gives you root access, so you can change web server settings yourself.
Step 1. Get the Widget Code in DiveChat
The widget is a short JavaScript snippet generated in your DiveChat account. You add it to your site once, and the chat appears on every page that contains it.
- Sign up or log in at DiveChat.
- Add your website as a channel in the account settings.
- Copy the widget code that DiveChat generates for that site.
- Keep the code in a text file: you will paste it in the next step.
DiveChat says the widget can be launched without developers; the exact menu names may change, so follow the current instructions in your account.
Step 2. Add the Code to WordPress
On WordPress, the safest way is a plugin that inserts code into the site footer, because theme updates do not overwrite it.
Option A: a header and footer code plugin
- In the WordPress dashboard, open Plugins → Add New and install a plugin for inserting header and footer code (for example, WPCode).
- Open the plugin settings and paste the DiveChat code into the footer section.
- Save the changes and clear the cache if you use a caching plugin.
Option B: a child theme
If you prefer not to add a plugin, paste the code into the footer.php file of a child theme, right before the closing </body> tag. Do not edit the parent theme: the next update will remove your changes.
Step 3. Add the Code to a Custom Engine or a Static Site
On your own engine, paste the code once into the base layout template that every page uses, right before </body>.
For a static site served by nginx, you can either add the code to every HTML file or let nginx insert it into all pages with the sub_filter directive:
location / {
sub_filter '</body>' '<!-- DiveChat widget code --></body>';
sub_filter_once on;
# ...your existing directives
}
Replace the comment with the code from your DiveChat account, then check the config and reload nginx:
sudo nginx -t && sudo systemctl reload nginx
The sub_filter directive comes from the ngx_http_sub_module, which is included in most distribution builds of nginx. Test it on one page first: if responses are compressed by an upstream application, the replacement will not work.
Step 4. Check the Server Settings That Block the Widget
If the code is in place but the chat does not appear, the cause is almost always on the server side: insecure content, security headers or caching.
| Symptom | Likely cause | What to do |
|---|---|---|
| The chat does not appear, the browser shows a warning | The page or some resources load over HTTP | Redirect all traffic to HTTPS and fix mixed content |
| The console shows a "Content Security Policy" error | Your CSP header does not allow the widget domains | Add the domains listed in the DiveChat instructions to script-src, connect-src and frame-src |
| The chat appears only after a hard refresh | An old version of the page is cached | Clear the plugin, server and CDN cache |
| The chat works on desktop but not on mobile | A separate mobile template or AMP pages without the code | Add the code to the mobile template too |
| The chat loads slowly or not at all | A script optimizer defers or combines the widget script | Exclude the widget script from minification and deferral |
You can see errors in the browser console: press F12, open the Console tab and reload the page.
Step 5. Test the Chat Before Launch
Test the chat as a visitor would, from the first message to the reply in the operator panel.
- Open the site in an incognito window and make sure the widget appears on the home page and on a few inner pages.
- Send a test message and check that it arrives in the DiveChat operator panel.
- Reply from the panel and confirm the visitor sees the answer.
- Repeat the test on a phone.
- If you connect messengers, the AI operator or a CRM, send one more test message and check that the conversation history is saved.
DiveChat states that its AI operator can answer routine questions and create deals in a CRM; details and current plans are on the DiveChat website.
Keep the Site Fast and Stable
A chat widget adds one more script to every page, so it is worth keeping an eye on server resources and page speed.
- check page load time after adding the widget;
- keep the web server, PHP and WordPress plugins updated;
- set up monitoring so you know if the site goes down;
- move to a larger plan or a dedicated server when traffic grows.
DiveChat users get 15% off a PSB Hosting order with the promo code DIVECHAT (one use per customer). More server guides are on the PSB Hosting blog.









