GrowthRailDocs

Overview

Each project has a single Campaign configuration with two halves:

Referrer Experience

What your existing users see. Includes the floating trigger button and the referral sharing modal/drawer with their referral link, copy button, and social sharing options.

New User Experience

What referred visitors see when they arrive via a referral link. A promotional banner with custom text and positioning to encourage signup.

Configure these in the dashboard under Campaign Setup.

Referrer Experience

The Referrer Experience is what your existing users see when they open your app. It consists of a trigger button and a sharing modal or drawer.

Campaign Designer & Live Preview
Customize your trigger button, modal text, and view changes in real-time in the campaign preview panel.

Trigger Button

The trigger button is a floating element that opens the referral sharing UI when clicked. Configure its appearance and position.

FieldValuesDescription
buttonTypefloating edge nonefloating — a pill/FAB that hovers over content. edge — a tab pinned to the viewport edge. none — no button rendered (use manual trigger).
buttonPositionbottom-right | bottom-left | top-right | top-leftCorner of the viewport where the button appears.
No button? No problem. If displayMode is set to none, no trigger button is rendered. You can open the referral dashboard manually using showReferralDashboard().

Modal / Drawer

When the trigger button is clicked (or you call showReferralDashboard()), the SDK opens a sharing UI with the user's referral link, a copy button, and social sharing buttons.

FieldTypeDescription
componentType"modal" | "drawer"modal — centered overlay with backdrop. drawer — side panel that slides in.
modalTitlestring (max 200 chars)Headline of the sharing UI (e.g. "Invite your friends").
modalDescriptionstring (max 500 chars)Body text explaining the benefit (e.g. "Share your link and earn 500 credits for each friend who signs up.")

Social sharing channels

The SDK includes built-in sharing buttons for:

Copy to clipboard — one-click referral link copy
Twitter/X — pre-filled tweet with referral link
Facebook — share dialog with referral link
LinkedIn — share post with referral link
WhatsApp — pre-filled message with referral link
Email — mailto link with subject and body

Branding / Theme

Customize the look and feel to match your brand:

FieldFormatDescription
themeColorhex (#RRGGBB)Primary brand color for button and accents.
backgroundColorhex (#RRGGBB)Modal/drawer background color.
tintColorhex (#RRGGBB)Tint overlay color for the backdrop.
tintAlphanumber (0–1)Opacity of the tint overlay (0 = transparent, 1 = opaque).

Controlling the UI via SDK

The SDK fetches the campaign configuration automatically when initAppUser() is called and renders the trigger button and modal based on your dashboard settings. You can also control it programmatically:

tsx
import { useGrowthRail } from '@growth-rail/react';

function MyComponent() {
  const {
    showReferralDashboard,
    showFloatingButton,
    hideFloatingButton,
  } = useGrowthRail();

  return (
    <>
      {/* Open the referral sharing modal on demand */}
      <button onClick={() => showReferralDashboard()}>
        Invite Friends
      </button>

      {/* Manually control the floating button */}
      <button onClick={() => showFloatingButton({ position: 'bottom-right' })}>
        Show Button
      </button>
      <button onClick={hideFloatingButton}>
        Hide Button
      </button>
    </>
  );
}

Override modal options at runtime

You can override campaign-level modal settings on a per-call basis:

tsx
showReferralDashboard({
  title: 'Share & Earn!',
  description: 'Invite friends to get 500 credits each.',
  componentType: 'drawer',
  theme: {
    primaryColor: '#6366f1',
    tintColor: '#000000',
    backgroundColor: '#ffffff',
  },
});

Inline referral dashboard (React)

For embedding the referral UI directly in your page layout instead of a modal:

tsx
import { ReferralDashboard } from '@growth-rail/react';

function ReferralsPage() {
  return (
    <div className="referral-section">
      <h2>Your Referrals</h2>
      <ReferralDashboard
        title="Invite Friends"
        onLinkCopied={() => toast('Link copied!')}
      />
    </div>
  );
}

New User Experience

When a referee (new user) lands on your site via a referral link, the SDK can automatically display a welcome banner to encourage signup.

New User Welcome Banner Settings
Configure the text and layout options for the referee welcome banner.
FieldTypeDescription
promoTextstring (max 500 chars)The promotional message shown to referred visitors (e.g. "You were invited! Sign up for a special welcome bonus.").
promoPositionstringOne of: top-left, top-center, top-right, bottom-left, bottom-center, bottom-right.
Auto-display: The banner only appears when the SDK detects a referralCode in the URL. It is dismissible by the user. No extra code needed on your side — the SDK handles rendering and positioning.

Referral Redirect Link

The Campaign also stores your project's Referral Redirect Link — the base URL that Growth Rail appends referral codes to when generating shareable links.

text
# Generated referral link format:
https://yourapp.com/signup?referralCode=ABC123&rewardEventName=user_signup

# Set in the dashboard under Campaign -> Referral Redirect Link

This should point to your signup or landing page where the SDK is initialized, so it can automatically detect and process the referral.

Webhooks

When a reward is granted for a referral under this campaign, all enabled webhooks fire automatically. Configure them in the Growth Rail dashboard under Integrations → Reward Webhooks.

For webhook payload details, authentication, retry behavior, and event types, see the Webhooks guide.