Conversion tracking

Hello, if you want to track conversion (ie: register in your analytics tools when someone is subscribed), you can use this code:

if ("MutationObserver" in window) {
    var observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
          var form =;
          if (form.classList.contains('success') && mutation.oldValue != '') {
            // track conversion here

    var subscriptionForms = document.querySelectorAll('form[data-members-form="subscribe"]');

    subscriptionForms.forEach(function (form) {
      observer.observe(form, { 
        attributes: true,
        attributeOldValue: true,
        attributeFilter: ['class'] 

Currently it seems like waiting for class changes is the only way. Would be usefull if the membership script triggers an event :grinning:

1 Like

Which analytics tool are you using? Are you wanting to track a successful email submission?

I’m using fathom and yes, I want to track successful email submission.


I have no idea which paid-member-only post or which Utm_source led people to buy my Ghost premium subscription.

Anyone already done this? Please share your experience.

For example I can add GA or Fathom js code, but can’t understand where to put it - which event to tag

hey! Did you try this code? Did it work?

yes it does

1 Like