Attribute revenue with Ghost

Before proceeding, confirm that you have set up Flowsery Analytics tracking on your Ghost site and linked your Stripe account.

1. Open Ghost Code Injection

  1. Sign in to your Ghost admin panel
  2. Navigate to Settings > Code Injection
  3. This is where the tracking snippet will go

2. Insert the Flowsery Analytics tracking snippet

Paste the following JavaScript into the Site Header section:

<script id="flowsery-queue">
  window.flowsery = window.flowsery || function() {
    window.flowsery.q = window.flowsery.q || [];
    window.flowsery.q.push(arguments);
  };
</script>
<script>
try {
  // Track successful member signups and payments
  document.addEventListener('DOMContentLoaded', function() {
    // Detect whether this is a successful signup/payment page
    if (window.location.href.includes('success') ||
        window.location.href.includes('welcome') ||
        document.querySelector('[data-members-success]') ||
        document.querySelector('.gh-portal-success')) {

      // Attempt to retrieve the member email from available sources
      const memberEmail = document.querySelector('[data-member-email]')?.textContent ||
                         document.querySelector('.member-email')?.textContent ||
                         localStorage.getItem('ghost_member_email');

      if (memberEmail) {
        window.flowsery("payment", { email: memberEmail });
      }
    }

    // Persist the member email on signup for subsequent tracking
    const memberForms = document.querySelectorAll('[data-members-form]');
    memberForms.forEach(form => {
      form.addEventListener('submit', function(e) {
        const emailInput = form.querySelector('input[type="email"]');
        if (emailInput && emailInput.value) {
          localStorage.setItem('ghost_member_email', emailInput.value);
        }
      });
    });
  });
} catch (e) {
  console.error("Flowsery Analytics tracking error:", e);
}
</script>

3. Save your changes

Click Save to apply the code injection settings.

Alternative: Zapier integration (no-code approach)

If you prefer a code-free setup, Zapier can bridge Ghost and Flowsery Analytics:

  1. Sign up for a Zapier account
  2. Configure a "Ghost Member Created" trigger
  3. Connect it to the Flowsery Analytics Payment API action
  4. Map the member email field to enable revenue attribution

This approach requires zero coding and automatically captures new member signups.

After a membership signup completes successfully, revenue data will appear in your Flowsery Analytics dashboard.