WordPress

Add chatbot embed code to WordPress

Install the DuChat widget on a self hosted WordPress site or a WordPress.com site that supports custom JavaScript.

WordPress

Before you start

Best for

Business sites, blogs, WooCommerce stores, help centers, landing pages, and service websites built on WordPress.

Install location

Use a trusted header and footer code plugin, a child theme, or the site wide footer script field. Prefer the footer or body end location.

WordPress snippet
<script
  src="https://your-domain.com/widget.js"
  data-workspace-id="WORKSPACE_ID"
  data-chatbot-id="CHATBOT_ID"
  defer
></script>

Install

Install steps

  1. 1Copy the widget snippetOpen the chatbot Embed page and copy the script generated for the selected workspace and chatbot.
  2. 2Open your code insertion toolUse a trusted header and footer plugin, a child theme hook, or your managed WordPress custom code area.
  3. 3Paste in the footer fieldAdd the full script to the site footer or body end field so it loads on every public page.
  4. 4Save and clear cacheSave the change, clear page cache or optimization cache, then test the public site while signed out.

Access

Domains

Add the production WordPress hostname, such as example.com.
Add the www hostname too if visitors can use it.
Add staging or preview hostnames only while you are testing them.

Verify

Verify

If WordPress strips the script from a Custom HTML block, use a footer code plugin or theme hook instead.
If a cache plugin delays or combines scripts, exclude the widget snippet when the launcher does not appear.
For WordPress.com, custom JavaScript requires a plan that allows plugins or custom code.
Next doc

Add chatbot embed code to Webflow

Add the widget script to Webflow site settings for every page or to page settings for a single page.

Open