Conversion tracking

Visit Settings → Payment → Configure Checkout in your Memberful dashboard and paste any tracking codes into the Order complete analytics code box. These tracking codes will be output on the order complete page whenever a customer successfully completes an order. You can add as many tracking codes as you like. See examples for Google Analytics, Facebook Ads, and Twitter Ads below.

Google Analytics

First, read the Google Analytics documentation and learn how to get the proper tracking codes set up on your site. Because Memberful is hosted from a different domain, you'll also need to ensure you've properly set up cross-domain auto linking on your website (see the first example code below). You must also Enable Ecommerce in your Google Analytics view Ecommerce Settings.

Google Analytics code for your website

Here's an example of the Google Analytics code to use on your website with cross-domain auto linking to Memberful enabled.

Important: 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>

Google Analytics code for Memberful

To track new Memberful orders in Google Analytics, go to Settings → Payment → Configure Checkout in your Memberful dashboard and add the Google Analytics tracking code.

Important: 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>

Facebook Pixel

To track new Memberful orders in Facebook Ads, go to Settings → Payment → Configure Checkout in your Memberful dashboard and add the Facebook Pixel tracking code.

Important: 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 }},
    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>

Twitter Ads

To track new Memberful orders in Twitter Ads, go to Settings → Payment → Configure Checkout in your Memberful dashboard and add the Twitter Ads tracking code.

Important: 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>

General

How to

CMS Integrations

Email Newsletters

Discussion Forums

WordPress

Video

API