Add a referral program to WordPress

Add one script to the page that holds your sign-up, booking or checkout form and your visitors can enter a referral code.

Before you start

Create a free Monkey Referrals account and a referral program. The dashboard shows your exact script with your real business ID and embed code ID. The examples below use placeholders.

Add the widget script

Use whichever option matches your setup.

Option 1: Custom HTML block

  1. Open the page or post that contains your form in the block editor.
  2. Add a Custom HTML block below the form.
  3. Paste the widget script and update the page.
<script
  src="https://cdn.monkeyreferrals.com/widget/v1/mr.js"
  data-business="YOUR_BUSINESS_ID"
  data-embed_code="YOUR_EMBED_CODE_ID"
></script>
  1. Install a plugin that lets you add scripts to your site, such as WPCode.
  2. Add a new snippet of type HTML, paste the widget script, and place it in the footer.
  3. Limit it to the page with your form if the plugin supports page rules.

Add the confirmation snippet

Paste this on the thank-you or confirmation page shown after the form is submitted. It confirms the referral and credits the promoter.

<script>
  window.mr && window.mr('confirm');
</script>

If you cannot edit that page, skip this step and approve referrals manually from your dashboard.

Troubleshooting

  • The referral field does not appear. Make sure the script is on the same page as the form and check the browser console for errors. Add data-form with a selector for your form, for example data-form="#signup-form".
  • The form loads late. Some builders load forms dynamically. The widget waits for the form, but a data-form selector helps it find the right one.
  • Referrals stay pending. Add the confirmation snippet to your thank-you page, or approve them manually.

Questions? See the FAQ or contact us.

Ready to add your referral code field?

Free plan: one active program and unlimited successful referrals. Upgrade only if you need more.