Conversion tracking

You can integrate Google Analytics conversion tracking with Memberful. When someone signs up for a new membership on your website with Memberful we send a Google Analytics eCommerce event—specifically a transaction—to Google Analytics (GA) with the following data:

In this help doc:

Locate your tracking ID and enable eCommerce

  1. Locate your Tracking ID in your Google Analytics admin account.

    Tracking ID

  2. Toggle on Enable Ecommerce in your eCommerce Settings.

eCommerce settings

Add Google Analytics code to your site

WordPress site

  1. Install and activate the GA Google Analytics plugin on your WordPress site.
  2. Visit Settings → Google Analytics → Plugin Settings.
  3. Enter your Google Analytics Tracking ID.
  4. Choose Universal Analytics.
  5. Add the following code snippet to the Custom GA Code field to allow for cross-domain auto linking on your website, which is required because Memberful is hosted from a different domain.

      <script>
        // Auto link Memberful links
        ga('require', 'linker');
        ga('linker:autoLink', ['memberful.com'], true);
      </script>
    
  6. Click Save changes. After 24-48 hours, you can log into your Google Analytics account to view your stats.

Non-WordPress site

The following is an example of the Google Analytics code to use on your website with cross-domain auto linking to Memberful enabled. Review the Google Analytics documentation to learn how to add this code to your site.

You must replace UA-XXXX-Y with your real Google Analytics ID in the code below.

  <script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-XXXX-Y', 'auto');
    ga('send', 'pageview');

    // Auto link Memberful links
    ga('require', 'linker');
    ga('linker:autoLink', ['memberful.com'], true);
  </script>

Configure Memberful checkout

Go to Settings → Payment → Configure Checkout in your Memberful dashboard and paste your tracking codes into the Add successful order analytics code box.

You can add as many tracking codes as you like. See examples below for Google Analytics, Facebook Ads, and Twitter Ads.

Configure checkout

These tracking codes will be output on the "order complete" page whenever a customer successfully completes an order.

Please note that all the Order and Member variables listed in the email templates documentation are also available to use in your tracking snippets.

Track new Memberful orders in Google Analytics

You must replace UA-XXXX-Y with your real Google Analytics ID in the code below.

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  // Create the GA tracker with auto linking
  ga('create', 'UA-XXXX-Y', 'auto', {
    'allowLinker': true
  });
  ga('send', 'pageview');

  // Add the ecommerce tracker
  ga('require', 'ecommerce', 'ecommerce.js');

  // Add the transaction
  ga('ecommerce:addTransaction', {
    'id': "{{ order.number }}",
    'revenue': '{{ order.total }}'
  });

  // Add the order item
  ga('ecommerce:addItem', {
    'id': '{{ order.number }}',
    'name': '{{ order.item_name }}',
    'price': '{{ order.total }}',
    'quantity': '1'
  });

  // Send it to GA
  ga('ecommerce:send');
</script>

Track new Memberful orders in Facebook Ads

You must replace all 3 instances of <FB_PIXEL_ID> with your real Facebook Pixel ID in the code below.

<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');

fbq('init', '<FB_PIXEL_ID>');
fbq('track', 'PageView');

fbq('track', 'Purchase', {
    content_name: '{{ order.item_name }}',
    value: '{{ order.total_without_currency_symbol }}',
    currency: 'USD'
});
</script>

<noscript>
<img height="1" width="1" border="0" alt="" style="display:none" 
src="https://www.facebook.com/tr?id=<FB_PIXEL_ID>&amp;ev=PageView" />
<img height="1" width="1" border="0" alt="" style="display:none" 
src="https://www.facebook.com/tr?id=<FB_PIXEL_ID>&amp;ev=Purchase&amp;cd[value]={{ order.total }}&amp;cd[currency]=USD" />
</noscript>

Track new Memberful orders in Twitter Ads

You must replace all 3 instances of <TWITTER_TAG_ID> with your real Twitter website tag ID below.

<script src="//platform.twitter.com/oct.js" type="text/javascript"></script>
<script type="text/javascript">twttr.conversion.trackPid('<TWITTER_TAG_ID>', { tw_sale_amount: {{ order.total }}, tw_order_quantity: 1 });</script>
<noscript>
<img height="1" width="1" style="display:none;" alt="" src="https://analytics.twitter.com/i/adsct?txn_id=<TWITTER_TAG_ID>&p_id=Twitter&tw_sale_amount={{ order.total }}&tw_order_quantity=1" />
<img height="1" width="1" style="display:none;" alt="" src="//t.co/i/adsct?txn_id=<TWITTER_TAG_ID>&p_id=Twitter&tw_sale_amount={{ order.total }}&tw_order_quantity=1" />
</noscript>

Start selling memberships the easy way! 🚀 🙌 💪

Join some of the world's biggest audience-supported creators.

Try Memberful for free today →

Home

General +-

Quick start guides +-

How to +-

CMS Integrations +-

Email Newsletters +-

Discussion Forums +-

Course Builders +-

WordPress +-

Development / API +-