When a new visitor submits a form on my site, can I restrict signups to only those who have been referred?
There are three supported ways to ensure only referred visitors are added as participants: using the automagic form detection setup (default behavior), via JavaScript SDK, or via the REST API.
Restrict Signups Using the Automagic Form Detection Method
If you are using the automagic form detection method for referral tracking, only referred visitors will be added as participants by default. This is the recommended and simplest approach, as no additional configuration is required.

Restrict Signups Programmatically Using the JavaScript SDK
You can use the GrowSurf JavaScript SDK to ensure only referred visitors are added as participants by using the growsurf.addReferredParticipant() method. This method automatically validates whether a visitor has a valid referral before adding them as a participant.
-
To implement this, follow these steps:
In the Program Editor > Installation > Choose your referral tracking method step, select "Programmatically using the GrowSurf API".
On form submission, call
growsurf.addReferredParticipant()with the participant data. This method will do the following:- Automatically detect a referral from the
grsfURL parameter or browser cookie - Only add the participant if a valid referrer exists
- Return
added: falsewith a reason such asno_referrer,invalid_referrer, orparticipant_already_existsif the signup should not be added
- Automatically detect a referral from the
If the visitor was referred, the participant will be created and linked to the referrer. If not, no participant will be added.
Restrict Signups Programmatically Using the REST API
Alternatively, you can restrict signups through the REST API. If you want to restrict signups programmatically via the REST API, check whether the referredByfield exists for the referred friend, then add them as a participant using the /POST Add Participant endpoint.
Steps for Programmatic Restriction with the REST API:
- Check if the visitor was referred: When the referred friend submits a form, check if the
referredByfield exists and contains a valid referrer ID or email. - Add the visitor as a participant: If a valid
referredByfield exists, call the /POST Add Participant endpoint to add them as a participant.