Background
⌘K

Ghost Integration

Learn how to integrate Affonso affiliate tracking into your Ghost website or blog.

Silvestro
Written by Silvestro
Updated more than a month ago

Ghost's code injection feature makes it simple to add tracking scripts globally across your entire website or blog, perfect for SaaS companies using Ghost for their content marketing and knowledge base.

Add tracking script to your Ghost site

Ghost's recommended approach is to use the site-wide code injection settings, which applies the script to all pages automatically without needing to modify themes.

  1. Open your Ghost Admin panel

  2. Go to Settings → Code injection

  3. In the Site Header section, add your tracking script:

    <script
      async
      defer
      src="https://affonso.io/js/pixel.min.js"
      data-affonso="YOUR_PUBLIC_PROGRAM_ID"
      data-cookie_duration="YOUR_COOKIE_DURATION"
    ></script>
  4. Click Save

  5. The script will automatically appear on all pages

Alternative: Use post-specific code injection by adding the script to individual posts in the post settings, or modify your Ghost theme directly.

For more details, see Ghost's official code injection documentation.

Find your Program ID →

Testing

  1. Visit your Ghost site with ?atp=test
  2. Check browser DevTools → Console → type window.affonso_referral
  3. Verify the script appears in your page source
  4. Check tracking in your Affonso dashboard

Note: Code injection changes apply immediately without needing to republish.

Multi-Domain Setup

If you're using Ghost only for your blog/content (e.g., blog.yourcompany.com) while your main application runs elsewhere (e.g., app.yourcompany.com), make sure to install the Affonso tracking script on both domains.

Affonso works seamlessly across subdomains - the same affiliate cookie will be shared between domains. See our multi-domain setup guide for more details on cross-domain tracking.

Next Steps

Once installed, you can access affiliate referral data and pass it to your payment provider. Connect your payment provider →

Was this article helpful?

If you still need help, our support team is here for you.

Contact Support
bg

Ready to Scale Your SaaS?

Affonso is the easiest way to launch your own affiliate program. We take care of the technical stuff, so you can focus on growing your business.