Add custom conversion tracking

In this help doc, we'll explain how to trace the origin of your sales with our custom conversion tracking feature.

In this help doc:

Add custom conversion tracking code

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.

This will allow you to track when a member successfully completes an order. If you need to track more detailed information about the member or the order (e.g. the member's email address, the order amount, etc.), this approach won't work. You should instead send detailed conversion data to your analytics tool.

Configure checkout

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 add some data (query parameters) about the order to the URL that members are redirected to after each purchase:

Here's an example URL with the fields: https://www.YOURSITE.com/purchase-confirmation/?amount=20.00&member_id=4617942&order_id=DA59BDAD-6342-49A8-92B0-653D24581728

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 orders by members on iOS devices

With the recent changes on iOS 14.5, Apple now requires certain apps like Facebook to ask for domain verification to be able to track ad performance.

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. Therefore, the approach described above won't work.

In such cases, we recommend that you redirect to a page on your website after every purchase, so that you can insert the 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.

Track members who sign up for free

The custom analytics code only works in the checkout (for paid plans). If you'd like to implement tracking for free fregistration you can redirect those free registrants to a page on your domain. You can set up the redirect via Plans → Free registration.

Related help docs:

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