Add Olotalk to WordPress

WordPress has no single “custom code” box, so the reliable paths are a footer hook or a headers-and-footers plugin.

You’ll need your Assistant ID (ast_oltk_…) from your assistant’s Install step. New here? Start with the Quick start.


Easiest: a headers & footers plugin

If you’d rather not touch theme files, install a plugin that injects raw HTML — WPCode and Insert Headers and Footers are the common ones.

  1. Install and activate the plugin.
  2. Open its settings (e.g. Code Snippets → Header & Footer, or Settings → Insert Headers and Footers).
  3. Paste the snippet into the Footer / Body box and save:
<script
  src="https://cdn.jsdelivr.net/npm/@olotalk/assistant-loader@0/dist/loader.iife.js"
  data-olotalk-assistant-id="YOUR_ASSISTANT_ID"
  async
></script>

These plugins output the snippet verbatim, so the data-olotalk-* attributes survive.

<html>
<head> … </head>
<body>
… your page …
target<script src="…/loader.iife.js" data-olotalk-assistant-id="…" async></script>
</body>
</html>
Paste the snippet into the plugin's Footer / Body box. Wherever a platform puts it, the goal is the same: it loads just before the closing body tag.

If you maintain your own (child) theme or a site-specific plugin, add the loader on wp_footer:

// functions.php (child theme or site-specific plugin)
add_action( 'wp_footer', function () {
  ?>
  <script
    src="https://cdn.jsdelivr.net/npm/@olotalk/assistant-loader@0/dist/loader.iife.js"
    data-olotalk-assistant-id="YOUR_ASSISTANT_ID"
    async
  ></script>
  <?php
} );

Don’t use wp_enqueue_script() for the loader. It gives you no way to attach the data-olotalk-* attributes to the generated <script> tag (you’d need the script_loader_tag filter or wp_script_add_data), so data-olotalk-assistant-id never gets added and the assistant never boots. Output the raw <script> tag (as above) or use a headers-and-footers plugin.


Allow your domain

Add your site’s domain under your assistant’s Install domains, or the assistant stays hidden. If you publish from a *.wordpress.com or *.wpcomstaging.com preview URL, add that too.

If a caching plugin (WP Rocket, W3 Total Cache, LiteSpeed) has a “delay JavaScript execution” option, exclude olotalk from it — otherwise the launcher won’t load until the visitor interacts with the page.


Verify

Open your published site and look for the chat launcher in the bottom-right. Then check your dashboard: the Install step’s Install status card shows Seen on yourdomain.com once the snippet loads — with a one-click fix if the domain isn’t allowed yet. Nothing there? See Troubleshooting.