Set up conversion tracking

Visit Settings → Payment → Payment Settings 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.

Output the order total

You can output the order total by adding this code anywhere in your tracking code(s):

{{ order.total_in_cents | divided_by:100 }}

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.

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

Replace UA-XXXX-Y with your Google Analytics ID

Google Analytics code for Memberful

Here's an example of the Google Analytics ecommerce tracking code to paste in your Memberful dashboard under Settings → Payment → Payment Settings.

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

Replace UA-XXXX-Y with your Google Analytics ID

General

How to

CMS Integrations

Email Newsletters

Discussion Forums

WordPress

Video

API