WordPress

Install tokwork in WordPress using plugin or custom code.

Install tokwork in WordPress

Two methods available: using a plugin or adding custom code.

Step 1: Install Plugin

  1. Go to PluginsAdd New
  2. Search for "Insert Headers and Footers"
  3. Install and activate the plugin

Step 2: Add tokwork Script

  1. Go to SettingsInsert Headers and Footers
  2. Paste the following in the Scripts in Footer section:
<!-- tokwork Widget -->
<script async src="https://js.tokwork.com/loader.js" 
  data-website-id="YOUR_WEBSITE_ID" 
  data-website-domain="yourdomain.com">
</script>
  1. Click Save
Done! The widget will now appear on all pages of your site.

Method 2: Edit Theme Files

Using functions.php

Add to your theme's functions.php:

functions.php
function tokwork_widget_script() {
  ?>
  <script async src="https://js.tokwork.com/loader.js" 
    data-website-id="YOUR_WEBSITE_ID" 
    data-website-domain="yourdomain.com">
  </script>
  <?php
}
add_action('wp_footer', 'tokwork_widget_script');
Warning: Changes to functions.php may be lost during theme updates. Use a child theme or plugin method instead.

Using Child Theme

If you're using a child theme, add to functions.php in your child theme:

child-theme/functions.php
<?php
// Add tokwork widget
function tokwork_widget_script() {
  ?>
  <script async src="https://js.tokwork.com/loader.js" 
    data-website-id="YOUR_WEBSITE_ID" 
    data-website-domain="yourdomain.com">
  </script>
  <?php
}
add_action('wp_footer', 'tokwork_widget_script', 100);
?>

Method 3: WordPress Customizer

  1. Go to AppearanceCustomize
  2. Click Additional CSS or look for Custom Code section
  3. Some themes allow adding custom HTML/JavaScript here
  4. Add the tokwork script
Note: Not all themes support JavaScript in the Customizer. If this doesn't work, use Method 1 or 2.

Method 4: Using Code Snippets Plugin

  1. Install Code Snippets plugin
  2. Go to SnippetsAdd New
  3. Add this code:
function tokwork_widget() {
  echo '<script async src="https://js.tokwork.com/loader.js" 
    data-website-id="YOUR_WEBSITE_ID" 
    data-website-domain="yourdomain.com">
  </script>';
}
add_action('wp_footer', 'tokwork_widget');
  1. Click Save Changes and Activate

WooCommerce Integration

tokwork works automatically with WooCommerce. No special configuration needed!

The widget will appear on:

  • ✅ Shop pages
  • ✅ Product pages
  • ✅ Cart and checkout pages
  • ✅ All other pages

Verify Installation

  1. Visit your WordPress site
  2. Look for the widget (usually bottom-right corner)
  3. Open browser console (F12)
  4. Check for: ✅ tokwork Widget loaded successfully

Conditional Loading

To load only on specific pages:

function tokwork_widget_conditional() {
  // Only load on posts
  if (is_single()) {
    ?>
    <script async src="https://js.tokwork.com/loader.js" 
      data-website-id="YOUR_WEBSITE_ID" 
      data-website-domain="yourdomain.com">
    </script>
    <?php
  }
}
add_action('wp_footer', 'tokwork_widget_conditional');

Examples:

  • is_home() - Homepage only
  • is_page() - Pages only
  • is_single() - Posts only
  • is_product() - WooCommerce products only

Troubleshooting

Performance Tips

  • ✅ tokwork script loads asynchronously (doesn't block page load)
  • ✅ Compatible with most caching plugins
  • ✅ CDN-optimized for fast delivery
  • ✅ Exclude from minification if issues occur

Next Steps