Refgrow

Installation Guide

Set up Refgrow in minutes with these simple steps.

Overview

Setting up Refgrow involves two essential components:

  1. Tracking Script — Placed on your website to detect referrals and track conversions
  2. Affiliate Dashboard — Where your affiliates manage their links and see their earnings
Quick Setup: Both components can be implemented with just a few lines of code.

Step 1: Add the Tracking Script

The tracking script handles referral detection, cookie management, and conversion tracking. Add it to all pages of your website:

html
<script
  src="https://scripts.refgrowcdn.com/latest.js"
  data-project-id="YOUR_PROJECT_ID">
</script>
Important: Replace YOUR_PROJECT_ID with your actual project ID from your Refgrow dashboard.

What the Tracking Script Does

  • Detects when users arrive via referral links (?ref=CODE)
  • Stores the referral code in a cookie with your configured lifetime
  • Enables manual conversion tracking via the Refgrow() function
  • Provides helper methods for Stripe Payment Links

Placement

For optimal performance, place the script in the <head> section of your HTML, before other scripts that might access the Refgrow() function.

Content Security Policy (CSP): If your website uses CSP headers, you will need to add https://scripts.refgrowcdn.com to your script-src directive. See the Tracking guide for detailed CSP configuration instructions.

Step 2: Choose Your Conversion Tracking Method

Multiple Methods: You can use one or multiple tracking methods simultaneously.

Stripe Webhooks (Recommended)

Automatically track payments processed through Stripe:

  1. Go to your project's "Integration" tab
  2. Select "Stripe Webhooks" as your tracking method
  3. Enter your Stripe Secret Key (a restricted key is recommended)
  4. Click "Connect Stripe"

Refgrow will automatically set up the required webhook in your Stripe account.

For Direct Purchase Flow: If users can purchase without registering, make sure to pass the referral code to Stripe. See the Stripe guide for details.

LemonSqueezy Webhooks

Track purchases made through LemonSqueezy:

  1. Go to your project's "Integration" tab
  2. Select "LemonSqueezy Webhooks" as your tracking method
  3. Enter your LemonSqueezy API Key
  4. In your LemonSqueezy dashboard, create a webhook pointing to: https://refgrow.com/webhook/lemonsqueezy/YOUR_PROJECT_ID
  5. Select the events: order_created and subscription_created

Manual Tracking

Track conversions by calling the Refgrow() function in your code:

javascript
// Track a signup (no monetary value)
Refgrow(0, 'signup', 'user@example.com');

// Track a purchase (with monetary value)
Refgrow(49.99, 'purchase', 'user@example.com');

Parameters:

  1. value — Monetary value (use 0 for non-monetary events)
  2. type — Event type ('signup', 'purchase', or custom)
  3. email — User's email (crucial for attribution)

Place this code on thank you pages, after successful registrations, or whenever a conversion occurs.

Step 3: Add the Affiliate Dashboard

The affiliate dashboard is where users can sign up as affiliates, get their referral links, and track their earnings.

Option 1: For Websites with User Authentication

If users are already logged into your site, pass their email to pre-authenticate them:

html
<div id="refgrow"
    data-project-id="YOUR_PROJECT_ID"
    data-project-email="user@example.com"
    data-lang="en"> <!-- Optional: Specify language code -->
</div>
<script src="https://scripts.refgrowcdn.com/page.js" async defer></script>

Notes:

  • Replace YOUR_PROJECT_ID with your actual project ID
  • Replace user@example.com with your server-side code that outputs the current user's email
  • The data-lang attribute is optional. If omitted, the language set in your project settings (or English by default) will be used. Supported codes include: en, ro, ua, de, es, fr, it, pt.
  • The user will be automatically logged in to the affiliate dashboard

Option 2: Without User Authentication

For standalone affiliate pages or sites without authentication:

html
<div id="refgrow"
    data-project-id="YOUR_PROJECT_ID"
    data-lang="en"> <!-- Optional: Specify language code -->
</div>
<script src="https://scripts.refgrowcdn.com/page.js" async defer></script>

Users will need to enter their email and verify it to access their affiliate dashboard.

Customizing the Dashboard

You can customize the appearance and content of the dashboard in your Refgrow project's "Design" tab, including:

  • Colors and fonts to match your brand
  • Custom titles and descriptions
  • Which stats to display
  • Payout information
Content Security Policy (CSP): For the affiliate dashboard widget, add https://refgrow.com or https://*.refgrow.com to your script-src and connect-src directives.

Step 4: Configure Commission Settings

Set up your commission structure in your Refgrow project settings:

  1. Go to your project's "Settings" tab
  2. Configure your default commission rate (percentage or fixed amount)
  3. Set the commission duration (lifetime, first purchase, or limited period)

Advanced Commission Options

Refgrow offers advanced commission options:

  • Product-specific commissions — Set different rates for specific products
  • Affiliate-specific overrides — Create custom rates for individual affiliates

Testing Your Installation

Complete Test Flow

  1. Sign up as a test affiliate
  2. Generate your referral link
  3. Open the link in a new private/incognito browser window
  4. Verify the cookie is set (check your browser's developer tools)
  5. Make a test purchase or trigger a conversion
  6. Verify the conversion appears in your Refgrow dashboard

Debugging Tools

The tracking script logs helpful information to the browser console. Open your browser's developer tools (F12) to see:

  • Referral code detection
  • Cookie setting confirmation
  • Conversion tracking events

Troubleshooting

Referrals Not Being Tracked

  1. Verify the tracking script is on all pages with the correct project ID
  2. Check your browser console for any error messages
  3. Ensure third-party cookies are not blocked by the browser
  4. Test with a known referral link format (e.g., ?ref=CODE)
  5. Verify the referral parameter name matches your project settings

Conversions Not Attributing to Affiliates

For Stripe/LemonSqueezy:

  • Ensure webhooks are properly configured
  • Verify you are passing the referral code to the payment provider
  • Check webhook logs in your payment provider dashboard

For Manual Tracking:

  • Ensure you are providing a valid email address to the Refgrow() function
  • Verify the cookie exists when making the call
  • Check your browser console for any API errors

Affiliate Dashboard Issues

  1. Verify the page.js script is loading properly
  2. Check that the project ID is correct
  3. Ensure there are no JavaScript errors on your page
  4. Test the dashboard on a clean page without other scripts
  5. Verify that your domain is properly configured in your project settings

Framework-Specific Guides

React / Next.js

typescript
// components/RefgrowTracking.tsx
"use client";

import Script from "next/script";

export function RefgrowTracking({ projectId }: { projectId: string }) {
  return (
    <Script
      src="https://scripts.refgrowcdn.com/latest.js"
      data-project-id={projectId}
      strategy="afterInteractive"
    />
  );
}

Vue / Nuxt

typescript
// nuxt.config.ts
export default defineNuxtConfig({
  app: {
    head: {
      script: [
        {
          src: 'https://scripts.refgrowcdn.com/latest.js',
          'data-project-id': 'YOUR_PROJECT_ID',
          defer: true
        }
      ]
    }
  }
})

Next Steps

Start Free Trial
Installation Guide — Refgrow Docs