Connect your website: partner codes on your own contact form
You don't have to connect anything. Out of the box, every partner link goes to a short request page we host for you. The customer fills it in, and the referral shows up in your dashboard with the right partner attached. Most businesses never change that.
This guide is for when you'd rather send people to your own website, so they see your site and use the contact form you already have.
How a partner link works
- A partner shares their link, like
referapro.us/r/MARCO24. - We count the click and send the visitor on to your landing page, with the partner's code added to the address:
yoursite.com/contact?ref=MARCO24. - If no landing page is set, the visitor goes to your hosted request page instead.
The snippet's job is to catch that code on your website and put it into your form.
Option 1: Keep the hosted request page (no setup)
Leave Program → Website → Landing page empty. Referrals arrive in your dashboard on their own, already matched to the partner. Nothing to install and nothing to keep in sync.
Option 2: Use your own contact form
You need three things, all on your website.
1. Paste the snippet. Copy it from Program → Website and paste it into your site's footer (or the "custom code" area of your site builder), so it loads on every page. It looks like this:
<script src="https://referapro.us/embed.js" data-business="your-business" async></script>
2. Add a field for the code. Give your form a field named referral_code. A hidden field is best, so customers don't see it:
<input type="hidden" name="referral_code">
If you can't add a field, put data-referkit on the form tag instead (<form data-referkit ...>) and the snippet adds the hidden field for you.
3. Set your landing page. In Program → Website, put the full address of the page with your form, like https://yoursite.com/contact. Until this is set, partner links skip your website, and the snippet never sees a code.
That's it. When a referred customer sends your form, the code arrives in your normal lead email with everything else they typed. Then add the referral in Refer a Pro under that partner, so you can track it and pay them when the job's paid.
What the snippet does, exactly
- It reads the code from the address (
?ref=MARCO24) when the visitor arrives. - It keeps the code for that browser tab while they look around your site, so it's still there when they reach the contact page.
- It fills any empty field named
referral_code(alsoReferralCode,referralCodeorref_code). Forms that open later, like pop-ups, get filled too. - It uses no cookies and doesn't track anyone. Close the tab and the code is gone.
Changed the code parameter name?
Partner links add ?ref= by default. If your website already uses ref for something else, you can rename it under Program → Website. After you do, copy the snippet again: the new copy carries the new name, and the old one keeps looking for ref.
Wix, Squarespace, GoDaddy and other site builders
Many site builders don't let you name a form field, don't allow custom code on every plan, or put the form inside a frame the snippet can't reach. If the snippet can't fill your form, you have two simple choices:
- Use the hosted request page (Option 1). This is the easiest, and referrals are matched to partners automatically.
- Add a visible "Referral code" field to your form, and let partners tell customers their code. The customer types it in, and it arrives in your lead email.
To check whether the snippet works on your site, open a partner's link yourself, go to your contact form and send a test message. If your lead email shows the code, you're set.
The API for web developers
If someone builds your website, they can send referrals straight into Refer a Pro from your own form, so you don't add them by hand. Create a key under Program → Website → Inbound webhook. It's shown once, so save it somewhere safe.
Send the request from your website's server, never from code in the visitor's browser, so the key stays private.
POST https://referapro.us/api/{your-business}/referrals
X-Api-Key: rk_...
Content-Type: application/json
{
"code": "MARCO24",
"name": "Sam Lee",
"phone": "303-555-0142",
"email": "sam@example.com",
"address": "123 Main St",
"city": "Littleton",
"note": "Exterior, two-story"
}
| Field | Required | Notes |
|---|---|---|
code |
Yes | The partner's code. The partner must be approved in your program. |
name |
Yes | The customer's name, at least 2 characters. |
phone, email |
One of them | At least one, so you can reach the customer. |
address, city, note |
No | Anything that helps you quote the job. |
What comes back:
| Status | Meaning |
|---|---|
201 |
Created. The body has the referral's reference and possibleDuplicate (true if the same customer was referred recently). |
400 |
The body wasn't valid JSON. |
401 |
Wrong business name in the address, or a wrong or revoked key. |
402 |
Your program is paused until the subscription is renewed. |
422 |
No approved partner has that code, or a field failed a check. The error field says which. |
429 |
Too many requests. The limit is 30 a minute. |
A possible duplicate is still created; it's flagged in your dashboard so you can decide. If you think a key has leaked, rotate it under Program → Website. The old key stops working straight away.