Add custom conversion tracking

Go to Customize → Checkout in your Memberful dashboard and paste your tracking codes into the Embedded analytics code to be run when an order is successfully processed box. You can add as many tracking codes as you like. These tracking codes will be output on the order complete page whenever a customer successfully completes an order.

In this help doc:

Configure checkout

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_without_currency_symbol }}, 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_without_currency_symbol }}&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_without_currency_symbol }}&tw_order_quantity=1" />
</noscript>

Track new Memberful orders in Facebook Ads

With the recent changes on iOS 14.5, Apple now requires Facebook to ask for domain verification.

Since the conversion happens on our domain (e.g. YOURSITE.memberful.com), and not on a domain that you own, you won't be able to verify it.

Because of this, we recommend that you redirect to a page on your website after every purchase, so that you can insert Facebook's tracking code on that page instead of including it on Memberful's Order Complete page.

Contact us, and we can guide you on how to set this up.

Send detailed conversion data to your analytics tool.

If you're looking to send conversion data to Google Analytics, we have a direct integration with Google Analytics, which is easier to set up. For other analytics tools, read on.

Before we can send detailed information about an order and the member who placed it, we first need to fetch it. This involves writing some code, so you'll probably need help from a developer to set this up.

1) Enable our Tapfiliate integration.

This might seem counter-intuitive, because you're not looking to do anything with affiliates, but you don't need to actually connect the integration to a Tapfiliate account or do anything affiliate-related.

This integration will simply add some data (query parameters) about the order to the URL that members are redirected to after each purchase. We'll need one of these query parameters to fetch more details about the order via our API.

2) Extract the Order ID from the URL.

On the page that members will be redirected to after purchase, write a script extracting the order ID from the query parameters in the URL.

Here's an example script that does this:

<script>

function getQueryParams(){var r={},n=function(r){return decodeURIComponent(r.replace(/\+/g," "))},t=location.search.substring(1).split("&");for(var e in t){var o=t[e].toString().split("=");o.length>1&&(r[n(o[0])]=n(o[1]))}return r}

var params = getQueryParams();
var order_id = params.order_id;

</script>

3) Use our API to find out more about the order.

Now you can call our API with a query like the following, which will return the member's email address and the order amount. You can also modify it to make it return other data points about the member or the order.

query {
    order(uuid:"YOUR_ORDER_ID") {
        member {
            id,
            email
        },
        totalCents
    }
}

4) Send the extracted data to your analytics app of choice.

Now you have the data you need to send this conversion event, including the member's email address and any other data point you got from our API, to your tracking software.

Track members who sign up for free

Since the custom analytics code only works in the checkout, you can redirect members who sign up for free to a page on your domain. You can set up the redirect via Plans → Free registration.

Can't find what you're looking for? We'd love to help! 💪

Send us a message through the orange chat bubble in the lower right corner of the page. You'll hear back within a few hours Monday - Friday. 😀