Add a referral program to Shopify

Add the widget to a Shopify page with a form, and approve checkout referrals manually where Shopify limits custom scripts.

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

  1. In your Shopify admin, go to Online Store, then Themes.
  2. Choose Edit code on your current theme.
  3. Open theme.liquid and paste the widget script just before the closing </body> tag.
<script
  src="https://cdn.monkeyreferrals.com/widget/v1/mr.js"
  data-business="YOUR_BUSINESS_ID"
  data-embed_code="YOUR_EMBED_CODE_ID"
></script>

Alternatively, add a Custom Liquid section to the page that holds your form and paste the script there.

A note about checkout pages

Shopify restricts custom scripts on checkout and order confirmation pages, and the options vary by plan and change over time. If you cannot place the confirmation snippet there, approve referrals manually from your Monkey Referrals dashboard. Many stores use the widget on a sign-up or contact form and approve referrals after the order is paid.

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.