Tutorials
How to implement the GrowSurf JavaScript SDK in common use-case scenarios.
Scenario
Example 1: Trigger a referral on qualifying action (e.g, on conversion, purchase, or upgrade)
Step 1: Make sure the GrowSurf Universal Code is installed
Step 2: Add the participant
Step 3: Trigger the referral
Example 2: Open GrowSurf window on button click
Step 1: Make sure the GrowSurf Universal Code is installed
Step 2: Add code
Example 3: Display a participant's unique share link and referral count inline on a webpage
Step 1: Make sure the GrowSurf Universal Code is installed
Step 2: Add code
Add the Embedded Form anywhere in your HTML
Example 4: Redirect to another URL after a successful participant signup
Step 1: Make sure the GrowSurf Universal Code is installed
Step 2: Add code
Example 5: Add a personalized message to your Share URL for a warm welcome
Step 1: Make sure the GrowSurf Universal Code is installed
Step 2: Add code
Example 6: Only add a participant if they were referred
Step 1: Make sure the GrowSurf Universal Code is installed
Step 2: Add code
Example 7: Hide the GrowSurf Embedded Form until a GrowSurf participant is detected
Step 1: Make sure the GrowSurf Universal Code is installed
Step 2: Add code
Example 8: Add internationalization support for the GrowSurf Embedded Form and embedded invite
Step 1: Make sure the GrowSurf Universal Code is installed
Step 2: Add code
Example 9: Update pre-populated share and email invite messages to capitalize on a customer "aha moment"
Step 1: Make sure the GrowSurf Universal Code is installed
Step 2: Add code
Example 10: Load multiple GrowSurf programs on a single webpage
Step 1: Update each Share URL for each of your programs

Step 2: Paste this code into the <HEAD> of your website instead of the GrowSurf Universal Code
Example 11: Display a Referral Link on Your Login Page

Step 1: Install GrowSurf in Your React App
Step 2: Register Users and Add Them to GrowSurf
Step 3: Display Profile Page After Login/Registration
Step 4: Login and Validate the GrowSurf Participant
Step 5: Show the Referral Widget (Only After Logout)
Example 12: Display "You came through a referral link!" on Your Signup Page

Step 1: Install GrowSurf in Your React App
Step 2: Get the referralId and show the referral message on the registration page
Step 4: Register Users and Add Them to GrowSurf
Last updated
Was this helpful?
Let's say you're a SaaS company that helps social media users gain more followers. You could ask for referrals once a user gains 100 followers.
Add the following HTML code (e.g, in a popup on your webpage):
Add the following JavaScript code:
If you need to call this on immediate page load, wrap the JavaScript code in a
grsfReadyEvent Listener.