Refgrow lets you run a member referral and affiliate program on your community. On Swarm, you connect Refgrow using custom code in your white label settings and your store.
Please note: White labelling (including custom code) is only available on the Scale plan. You’ll need white label set up with a validated custom domain before Refgrow can track referrals across your branded site. See How to White Label Your Swarm Account.
Before you start
- Set up your Refgrow account and copy the integration snippets from their dashboard.
- Complete white label setup: custom domain validated, logo, and branding saved.
- Have your Swarm store set up if you want referral tracking on checkout pages. See How to Set up Your Store.
Note: Refgrow’s own guide may ask you to create separate pages (e.g. /affiliate-program). Swarm doesn’t work that way — you paste code into fixed areas (white label + store), not per-URL page builders.
Where to add Refgrow code in Swarm
Swarm has three places for custom code. Use the right one for each part of Refgrow’s setup:
What you’re adding | Where in Swarm |
Tracking script (capture referral links) | White Label settings → space pages Head + Store → Head code |
Public signup widget (optional) | Store → Body code |
Member referral dashboard | White Label settings → space pages Body code |
New member signup tracking | White Label settings → sign up page Body code |
White label code
Click your Profile picture → Settings → White Label tab → scroll to optional settings (after your domain is validated):
- Add code to your sign up page — Head and Body
- Add code to your space pages — Head and Body
Store code
Open your store admin → Settings → Custom Code tab:
- Head code — added to the
<head>of your public store
- Body code — added before the end of the page
See also How to Add Custom Code to Your Store.
Important: Don’t paste all Refgrow snippets into one field. The tracking script goes in Head; widgets and events go in Body, in the area that matches where your members actually are (store vs space vs signup).
Step 1: Add the Refgrow tracking script
Paste Refgrow’s main tracking snippet (from their Step 1) into:
- White Label → Add code to your space pages → Head
- Store → Custom Code → Head code
This captures referral codes when someone lands on your site from a referral link.
Optionally, add the same tracking snippet to White Label → Add code to your sign up page → Head so signups are covered too.
Step 2: Add referral widgets
For logged-in members (referral dashboard)
Paste Refgrow’s member dashboard snippet into:
White Label → Add code to your space pages → Body
Members will see this inside your community on your custom domain, not on app.swarm.to.
For visitors on your store (optional public signup)
If you want a public “become a referrer” widget on your storefront, paste Refgrow’s public signup snippet into:
Store → Custom Code → Body code
For new member signups
Paste Refgrow’s signup/conversion snippet into:
White Label → Add code to your sign up page → Body
This runs when someone registers on your white label domain.
Identifying logged-in members (email variable)
Refgrow may ask you to replace something like REPLACE_WITH_LOGGED_IN_USER_EMAIL or {{current_user.email}}.
Swarm does not use template variables. When a member is logged in, Swarm exposes the user email in JavaScript as:
window.currentUserEmail
In your Refgrow identify call, use:
if (window.currentUserEmail) {
refgrow('identify', { email: window.currentUserEmail });
}
Put this in space pages Body code (member dashboard) so it only runs for logged-in users on your white label site.
Stripe checkout (optional)
Refgrow may suggest passing the referral code into Stripe metadata at checkout. Swarm creates Stripe Checkout sessions on the server, so you usually cannot complete this step from store body code alone.
For most communities, Steps 1–3 are enough. You can skip Stripe metadata unless you have a custom checkout integration.
Paid memberships through your store still work normally via Stripe.
