FirstPromoter + Ghost
Table of contents

Launch a referral program for your membership business with Ghost and FirstPromoter. FirstPromoter allows you to build a referral program and ask your biggest fans to promote your work to other people. Collect information about how many referrals have come from each of your members, so you can offer them competitions, rewards, commissions or payouts.

It's possible to integrate FirstPromoter with your Ghost site in a few steps, as shown in this guide.

Add the referral tracking script

To get started, sign up for a FirstPromoter account if you haven't already. Once you have an account, follow the setup steps provided. The first step is to copy the tracking script provided in your FirstPromoter dashboard:

Since FirstPromoter needs to track user behaviour across your entire site, we'll use the global code injection feature which can be found in the Ghost Admin settings menu. Paste your tracking script into the {{ghost_head}} section:

Create a welcome page in Ghost

In order to track member signups, create a page in Ghost, and populate it with content you'd like to share with your Members when they sign up.

Create a signup redirect to the welcome page

To track signups, add a second script in Ghost that redirects new members to the welcome page you just created.

Copy this exact code into the {{ghost_head}} section of global code injection, right underneath the FirstPromoter script you added in step 1:

    function getParameterByName(name, url) {
        if (!url) url = window.location.href;
        name = name.replace(/[\[\]]/g, "\\$&");
        var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
            results = regex.exec(url);
        if (!results) return null;
        if (!results[2]) return '';
        return decodeURIComponent(results[2].replace(/\+/g, " "));
    var action = getParameterByName('action');
    if (action == 'signup') {
        window.location = '/welcome/';

Install signup tracking code

Follow these steps to implement custom signup tracking in Ghost. You can follow these steps instead of the FirstPromoter instructions.

  1. In your Ghost theme, duplicate the page.hbs template
  2. Name your duplicated template page-welcome.hbs to map it to your welcome page
  3. Then add the following code snippet to the end of this file:
{{#if @member}}

    <script type="text/javascript">
    var email = "{{}}";
    var uid = "{{@member.uuid}}";
    if (window.$FPROM){
        $FPROM.trackSignup({email: email,uid: uid});
    } else {


Once you've edited your theme, upload the updated version from the Design page in Ghost Admin to implement your changes.

Connect your Stripe account

If you also want to track payments, connect your Stripe account to FirstPromoter, using the same account you have connected to your Ghost members site.

All you need to do is click the Stripe Connect button and follow the steps to connect your account.

Any referred signups that make a payment will now be tracked in your FirstPromoter account.

Test your tracking code

FirstPromoter provide some quick methods to test your implementation is working as expected. The first step is testing visitor tracking, to ensure that all visitors to your site who have clicked an affiliate link are tracked.

testing tracking code in firstpromoter

After following the link provided to test visitor tracking, try signing up as a member of your site. Click the confirmation link in the email sent from Ghost - you should be redirected to your new welcome page.

Click the test signup tracking button in FirstPromoter to ensure everything is working as expected.

Once you've got the green light on all tests, you're good to go!

Launch your referral program

Ask your members to promote your work and invite them to your FirstPromoter account. Once they sign up and share their unique affiliate link, the following happens:

  • A new user clicks an affiliate link and lands on your homepage, they get a cookie from the tracking script
  • If they sign up, they are redirected to the welcome page on your site
  • The welcome page sends the member information to FirstPromoter as a Referred lead, so you can see how many members have been referred and who referred them:
  • If the member starts a paid subscription, Stripe sends a webhook to FirstPromoter and the conversion is tracked automatically. Referred customers appear in your FirstPromoter dashboard so you can track how many referred leads became paid subscribers 🎉