Revenue
Attribute revenue with Ghost
Ghost sells paid memberships through your Stripe account. Its checkout can't carry the visitor ID, but the member's email can link the Stripe payment to the visit.
Add the code with Code injection
Open Settings → Advanced → Code injection
In Ghost Admin, open Code injection and choose Site header.
Paste this code below the MetricRaven tag
Site header<script> window.metricraven = window.metricraven || { q: [] }; window.metricraven.payment = window.metricraven.payment || function () { window.metricraven.q.push(["payment"].concat([].slice.call(arguments))); }; </script> <script> document.addEventListener("DOMContentLoaded", function () { try { // Remember the email a visitor signs up with (Ghost's member forms and Portal). document.querySelectorAll("[data-members-form]").forEach(function (form) { form.addEventListener("submit", function () { var input = form.querySelector('input[type="email"]'); if (input && input.value) sessionStorage.setItem("mr_member_email", input.value); }); }); // Ghost returns from a paid Stripe checkout with ?stripe=success. var params = new URLSearchParams(window.location.search); var email = sessionStorage.getItem("mr_member_email"); if (params.get("stripe") === "success" && email) { window.metricraven.payment({ email: email }); sessionStorage.removeItem("mr_member_email"); } } catch (e) { console.error("MetricRaven payment tracking error:", e); } }); </script>It keeps the email typed into a member form for this tab only, and sends it once Ghost returns from Stripe with
?stripe=success.Save
Members who upgrade while signed in pay with their account email, which is the one sent.
Verify it works
Sign up for a paid tier in a private window. Once Stripe sync imports the payment (about a minute), it appears in Revenue credited to that visit's source.
Without code
You can also send paid members from your own backend or an automation (for example a Zapier “new member” trigger) to the Payments API with their email. Don't do this as well as connecting Stripe, or payments count twice.
Notes
- Free members aren't revenue. Track free signups as a goal instead.
- Renewals keep the same visit through the Stripe customer.
- Matching rules, privacy and the security model: Attribute by email.