Guide · WordPress

HAL on WordPress, three safe ways.

Pick the method that matches how comfortable you are with theme files. All three end with the same result: HAL on every page, no plugin bloat.

Step 1 — copy your widget code

In HAL: Settings → Widget → Install. Copy the snippet containing your project ID:

<script
  src="https://api.chatwithhal.com/widget.js"
  data-project-id="YOUR_PROJECT_ID"
  async
></script>

Step 2 — pick an install method

Option A: Customizer (no code files)

  1. WP admin → Appearance → Customize.
  2. Open Additional CSS/Scripts or your theme's "header/footer scripts" panel (most modern themes ship one).
  3. Paste the snippet, Publish.

Option B: Child theme header.php

  1. Appearance → Theme File Editor — use a child theme, never the parent.
  2. Edit header.php (or footer.php) and paste the snippet before wp_head() / </body>.
  3. Save. Updates to the parent theme won't overwrite it.

Option C: Snippets plugin

If you already run a code-snippets plugin, add the snippet as a footer script scoped to the whole site. Cleanest option for managed hosts that lock the file editor.

WooCommerce identification

Logged-in shoppers become known contacts — their carts, orders, and chats share one timeline:

<?php if ( is_user_logged_in() ) : $u = wp_get_current_user(); ?>
<script>
  window.addEventListener('load', function () {
    if (window.HalWidget) {
      HalWidget.identify({
        email: <?php echo json_encode( $u->user_email ); ?>,
        name: <?php echo json_encode( $u->display_name ); ?>
      });
    }
  });
</script>
<?php endif; ?>

Print the customer email from PHP (e.g. wp_get_current_user()) into the snippet, and sign identities if you act on them — see identity verification.

WordPress tips

  • Caching plugins — after installing, purge cache once so the snippet ships.
  • Optimization plugins — exclude widget.js from "defer all scripts" and RocketCDN-style rewrites if the launcher misbehaves.
  • Cookie banners — nudge the launcher clear with edge offsets (Settings → Widget).
  • Staging sites — the same project ID works; use a separate project if you want staging chats kept out of your live inbox.