Install on WordPress
WPCode plugin in the Header field. Block themes hid the Theme File Editor, so editing functions.php directly is not the modern path.
WordPress's modern install uses the free WPCode plugin in the site-wide Header field. Two reasons it beats editing functions.php: block themes (default since 2022) hide the Theme File Editor entirely, and any direct theme edits break when you switch or update themes. WPCode injects code into every page's <head> independently of the active theme, so the install survives switches.
Avoid the alternatives
A few WordPress code-injection plugins are abandoned or poorly maintained: Insert Headers and Footers by Astra, Header Footer Code Manager. WPCode is the maintained, free, plugin-shop-vetted option. Stick with it.
If you have an existing classic theme and a child theme, you CAN hook into wp_head from your child theme's functions.php instead. That's the legacy path; WPCode is what we recommend for new installs.
Install the WPCode plugin
In WordPress admin: Plugins > Add New > search "WPCode" > Install Now > Activate.
WPCode adds a new top-level menu item in the admin sidebar.
Paste the head script
WPCode > Code Snippets > Header & Footer. In the Header box, paste:
<script>
(function(){
var s=document.createElement('script');
s.src='https://js.rekomi.com/v1/rekomi.js';
s.async=true;
s.dataset.programId='YOUR_PROGRAM_ID';
document.head.appendChild(s);
})();
</script>Save Changes. Your program ID lives in Rekomi at Settings > Tracking.
Cache plugins require a purge
If you run WP Rocket, W3 Total Cache, LiteSpeed Cache, or WP Super Cache, purge the cache after saving WPCode. These plugins serve previously-rendered HTML to visitors until you purge, so your fresh script tag will not appear in production output until cache regenerates.
After purging, hard-refresh (Cmd+Shift+R) on the front-end and run View Source. Confirm the Rekomi script tag is present in the rendered <head>.
WooCommerce + Stripe
If your WordPress site runs WooCommerce with Stripe as the payment gateway, the head script alone is sufficient for click capture. Conversions fire via the Stripe webhook rail just like a native-Stripe customer. No additional WooCommerce-side configuration needed.
If WooCommerce uses PayPal, Square, or any non-Stripe gateway, you need to fire the convert event from the order thank-you page. Add this to your child theme's functions.php:
add_action('woocommerce_thankyou', function($order_id) {
$order = wc_get_order($order_id);
if (!$order) return;
?>
<script>
window.Rekomi && window.Rekomi.convert({
external_event_id: '<?php echo esc_js($order->get_id()); ?>',
amount_cents: <?php echo intval($order->get_total() * 100); ?>,
currency: '<?php echo esc_js($order->get_currency()); ?>',
customer_email: '<?php echo esc_js($order->get_billing_email()); ?>',
});
</script>
<?php
}, 10, 1);WooCommerce hands you $order->get_total() as a decimal; multiply by 100 to get cents.
Other WordPress plugins
MemberPress, Paid Memberships Pro, LearnDash, Easy Digital Downloads, and most membership/course plugins each expose a thank-you-page or post-purchase hook. Search the plugin's docs for "thank you page" or "purchase confirmation page" and inject the same window.Rekomi.convert() call from that hook, mirroring the WooCommerce example above.
Troubleshooting
Script tag does not appear in View Source after install. Your cache plugin is serving stale HTML. Purge cache. If you don't use a cache plugin, check that WPCode is Active under Plugins (not just Installed).
WooCommerce conversion fires twice. The woocommerce_thankyou hook can fire multiple times if your theme re-renders the page (some themes use AJAX refreshes). Rekomi de-dupes on external_event_id, so duplicate fires are silent no-ops. Not a real bug.
Amount is 100x off. WooCommerce returns the total as a decimal (e.g., "49.00"). You forgot to multiply by 100 in the PHP snippet. Add the * 100.
WPCode visible in admin menu but the snippet does not save. WPCode's free tier limits how many snippets you can have. Check your snippet count; the Header & Footer slot counts as one.
Related
Install on Kit (ConvertKit)
Kit has no site-wide head HTML slot and does not expose order data in templating, so installs are per-landing-page for click capture and server-side S2S for conversions.
Install on Webflow
Site settings Head code for the global install. Then either Webflow Ecommerce Order Confirmation snippet, or Stripe Payment Links MutationObserver for external checkouts.