virling Pricing Self-host Demo Changelog Agencies GitHub Start free trial
blog / 2026-11-21

Ghost revenue tracking: which channel brings paid members

By Devendra Variya, co-founder of Virling. Published 2026-11-21, updated 2026-12-01.

Ghost revenue tracking means joining each paid membership in Stripe to the visits that brought the member to your Ghost site. To see which channel brought each paid Ghost member, paste the Virling script into Ghost’s Code injection, connect the Stripe account Ghost uses with a read-only key, and send each signed-in member’s email as an identify event from your theme. Ghost’s own Stripe checkout cannot carry a visitor ID, so Virling matches the payer email on the Stripe charge to that member’s visits instead, and the Channels card shows revenue per channel.

Start free trial

1. Add the script in Code injection

In Ghost Admin, open Settings, then Code injection. Paste the tag into Site header and save. Ghost adds it to every page of the site, including posts, the home page and the pages where Portal opens.

<script defer src="https://app.virling.com/v.js" data-site="yourdomain.com"></script>

Replace yourdomain.com with your site. Open the published site and check that the first pageview arrives. Each visit now gets one channel from its first pageview: Paid, Email, AI, Organic search, Communities, Social, Referral or Direct. The steps match the framework guides in the docs.

2. Connect the Stripe account Ghost uses

Ghost takes paid memberships through your own Stripe account, so the charges are there to read. In the Stripe Dashboard, open Developers, API keys, then Create restricted key. Set Read on Charges, Checkout Sessions, Customers, Events, Invoices, Subscriptions and PaymentIntents, leave everything else at None, and paste the key into Virling. It starts with rk_live_; secret keys are refused. See Stripe in the docs.

Virling imports charges back 90 days on the first run, then reads new charges, refunds and lost disputes as they happen. Monthly and yearly renewals are marked by their invoice’s billing reason, subscription_cycle.

3. Why Ghost’s checkout needs email matching

For a Stripe payment, Virling looks for the visitor ID in metadata.virling_vid on the charge or its PaymentIntent, then in metadata.virling_vid or client_reference_id on the Checkout Session. On a site where you create the Checkout Session yourself, you pass the virling_vid cookie there; see link checkout to visits.

Ghost does not let you do that. When a reader picks a paid tier in Portal, Ghost creates the Checkout Session itself, and none of those fields can be set from your site. Portal is not a buy.stripe.com Payment Link either, so the script has no link to add the ID to. A Ghost payment arrives with no visitor ID, and on its own it would be Unattributed.

What still matches is the email. When a Stripe payment has no visitor ID, Virling compares its payer email (billing details or receipt email) with emails your visitors sent in identify events. If one matches exactly, the payment is credited to that visitor and shows Matched by email on the Payments page. Virling keeps only a SHA-256 hash of the trimmed, lowercased email, salted per site, and matching never crosses sites. See recover payments by email.

4. Send the member’s email from your theme

Code injection is pasted into the page as it is, so it cannot insert the member’s email. Your theme can: Ghost themes have @member data for the signed-in member. Open your theme’s default.hbs and paste this before {{ghost_foot}}, then upload the theme again:

{{#if @member}}
<script data-email="{{@member.email}}">
(function (email) {
  addEventListener("load", function () {
    var vid = window.virling && virling.vid && virling.vid();
    if (vid) fetch("https://app.virling.com/api/event", {
      method: "POST",
      body: JSON.stringify({ n: "identify", u: location.href, s: "yourdomain.com", v: vid, m: email })
    });
  });
})(document.currentScript.dataset.email);
</script>
{{/if}}

Each page a signed-in member views now ties their email to their visitor ID. Readers who are not signed in send nothing.

What matches and what does not

Email matching applies to payments synced after the identify, and Virling syncs Stripe about once a minute. That decides which paid members are credited:

  • Free members who upgrade. A reader who joins free, signs in and later picks a paid tier has sent an identify before paying. If the payer email on the Stripe charge is the email they signed in with, the payment is credited to their visits, under the default model the latest one in the last 90 days that was not Direct.
  • Readers who pay on their first visit. A new reader who goes straight to a paid tier in Portal was never signed in, so no identify was sent before the payment. The payment is Unattributed. It still counts toward revenue.
  • A different payer email. Matching is exact after trimming and lowercasing. A member who pays with another address does not match.
  • Renewals. A renewal takes the attribution of the member’s first payment, matched by Stripe customer ID, so a member credited once stays credited every month. If the first payment was Unattributed, the renewals usually are too. See membership sites and paid communities.
  • Members from before. Payments older than the 90-day import are not read, so renewals of memberships that started before then have no first payment to copy from.

A free tier with a signup form helps here: the more readers who sign in before they pay, the more paid members can be matched.

Tag the links in your Ghost newsletter

Most email apps send no referrer when a reader clicks a link, so a click from your Ghost newsletter to your own site is Direct unless it is tagged. Use one source and one medium in every issue, and change only the campaign:

https://yourdomain.com/pricing-teardown/?utm_source=newsletter&utm_medium=email&utm_campaign=pricing-teardown

A utm_medium of email or newsletter puts the visit in the Email channel, and the Campaign tab shows each issue on its own row. The free UTM builder makes the URLs. Newsletter revenue tracking covers the tags in more depth, and Substack revenue tracking shows the same approach for a publication on Substack.

See paid members per channel

On the dashboard, the Channels card lists each channel with visitors, revenue and revenue per visitor. Click a channel to filter the whole page to it, or switch to the Campaign tab to compare newsletter issues. The Payments page lists every payment with its source; open one to see the sessions before it and which one got the credit. The Retention page groups members by the channel of their first payment, with how many are still paying, net LTV and 30-day churn.

A worked example: one month of paid members

Example data, made up to show the method. An imaginary Ghost publication charges $9 a month for a paid tier. Signups are new free members in a sample month; paid members and monthly revenue are the paid memberships Virling credited to each source, all of them matched by email.

SourceSignupsPaid membersMonthly revenue
Newsletter link2317$153
Search24111$99
Social post1523$27
Referral416$54
Total45737$333
One member, matched by email (in the newsletter row)Joined free from search on day 3Upgraded on day 19, after a newsletter click$9, credited to the newsletter link

Search brought the most signups and social posts the second most, but the newsletter link brought the most paid members. It has more paid members than signups because most of them were free members already, who upgraded after clicking a tagged link in an issue. The last row shows one of them: they signed in, so your theme sent an identify; the payer email on the Stripe charge matched; and under the default model the payment went to their latest visit that was not Direct, the newsletter click, not the search visit that brought them in. Four more readers paid on their first visit without signing in, so their $36 is Unattributed and not in the table.

The Referral row lumps every site that links to you under its domain. If you ask creators to recommend your publication, the influencer UTM link generator gives each of them a tagged link, so the Campaign tab shows each creator's paid members on their own row.

Frequently asked questions

How do I see which channel brought a paid Ghost member?

Paste the Virling script into Settings, Code injection, Site header, connect the Stripe account Ghost uses with a restricted key, and send each signed-in member's email as an identify event from your theme. A Stripe payment whose payer email matches is credited to that member's visits, and the Channels card shows revenue per channel.

Can Ghost's Stripe checkout carry the Virling visitor ID?

No. Ghost creates the Stripe Checkout Session itself, so you cannot add client_reference_id or metadata.virling_vid to it. Ghost payments are matched by email instead: the payer email on the Stripe charge is compared with emails your members sent in identify events.

Why is a paid Ghost member still Unattributed?

Email matching only applies to payments synced after the identify. A reader who pays in Portal on their first visit was never signed in, so no identify was sent and the payment is Unattributed. Members who sign up free first and upgrade later are covered, as long as the payer email matches the member email exactly.

Are Ghost membership renewals credited too?

Yes. A Stripe charge whose invoice has billing reason subscription_cycle is a renewal and takes the attribution of the member's first payment, matched by Stripe customer ID. If the first payment was Unattributed, the renewals usually are too.

Does Virling store my members' emails?

No. It keeps only a SHA-256 hash of the trimmed, lowercased email, salted per site, and matching never crosses sites.

See which channel brings paid Ghost members

Virling is open source under AGPL. Self-host it free, or use the hosted version with a 14-day free trial. It connects to Stripe, Paddle, Shopify, WooCommerce, Polar, LemonSqueezy, Dodo, Creem and RevenueCat.

Start free trial See the demo