> ## Documentation Index
> Fetch the complete documentation index at: https://memberful.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrate with Tapfiliate

> Integrate Memberful with Tapfiliate to run an affiliate program. Track referrals, attribute new member signups, and pay affiliates a commission on each sale.

export const RelatedDocs = ({link1, link2, link3, link4, link5, link6, link7, link8, link9, link10, className = ""}) => {
  const links = [link1, link2, link3, link4, link5, link6, link7, link8, link9, link10].filter(Boolean);
  if (!links.length) return null;
  return <section className={`related-docs border dark:border-gray-700 rounded-2xl px-6 py-4 mt-6 ${className}`}>
      <p className="mb-2 font-medium">
        <strong>Related help docs:</strong>
      </p>
      <ul className="space-y-1 mb-1 mt-1">
        {links.map((link, index) => <li key={index}>
            <a href={link.url}>{link.label}</a>
          </li>)}
      </ul>
    </section>;
};

In this help article, we'll integrate Memberful with [Tapfiliate](https://tapfiliate.com/) so you can offer affiliate commissions for your membership program. For complete instructions on how to use Tapfiliate, check out their [knowledge base.](https://tapfiliate.com/knowledge-base/)

<Callout icon="info" color="#22E273">
  Memberful allows you to offer rewards to members who refer others to join your membership program in the form of a discount that will be applied to their active subscription. Learn more about our [built-in referrals program](/discounts-and-gifting/lifecycle-discounts/offer-referral-discounts/).
</Callout>

## Review your options for affiliate tracking

Memberful works best with Tapfiliate as your affiliate tracking software. However, you can also use [TrackDesk](/discounts-and-gifting/affiliate-marketing/trackdesk/), which is a more affordable option.

If you use TrackDesk, you'll need to manually prepare and add the affiliate tracking code to your site, as there is no WordPress plugin for this service. Tapfiliate does have a WordPress plugin that automates this for you, so setting it up is much simpler.

Both services are able to track renewals and disputes automatically via their Stripe integrations, but TrackDesk has the advantage in that it's able to track refunds automatically as well.

In this help article, we'll explore how to integrate Tapfiliate with Memberful.

## Create your affiliate program

From your Tapfiliate account, create your affiliate program. Once you create your program, you will get an invite URL to share (on your website, via email, or through social media) so you can sign up affiliates.

<Frame>
  <img src="https://mintcdn.com/memberful/8cnaMPD_oPIjL0By/images/integrations/affiliate-marketing/tapfiliate/tapfiliate-shareable-link.png?fit=max&auto=format&n=8cnaMPD_oPIjL0By&q=85&s=b18d475e97ee694421efd126948d5d00" alt="Shareable link" width="1440" height="1034" data-path="images/integrations/affiliate-marketing/tapfiliate/tapfiliate-shareable-link.png" />
</Frame>

Once a person signs up to become an affiliate, they will receive their own unique referral link to share with their customers or followers. They can find their unique link in their Tapfiliate dashboard.

<Frame>
  <img src="https://mintcdn.com/memberful/8cnaMPD_oPIjL0By/images/integrations/affiliate-marketing/tapfiliate/tapfiliate-affiliate.png?fit=max&auto=format&n=8cnaMPD_oPIjL0By&q=85&s=33c3a9c6f551cb46af21efec54508248" alt="Affiliate" width="1440" height="860" data-path="images/integrations/affiliate-marketing/tapfiliate/tapfiliate-affiliate.png" />
</Frame>

## Integrate Tapfiliate with Memberful

Go to *Revenue → Tapfiliate* in your Memberful dashboard, and click **Connect to Tapfiliate.**

Then go to *Website → External website* and fill out the **Redirect to this page after every order** field. If you prefer, you can also set this on a per-plan basis by going to the desired plan and setting [the plan's redirect URL](/configuration/other-settings/configure-redirect-settings/#set-up-plan-specific-redirects).

This should be set to the URL of a page on your website, usually a "Thank you" page. Memberful-hosted pages like [our subscribe page](/website-builder/pages/subscribe-page/) or [plan purchase URLs](/plans/promote-and-sell/add-a-link-to-buy-a-plan) won't work.

<Frame>
  <img src="https://mintcdn.com/memberful/8cnaMPD_oPIjL0By/images/integrations/affiliate-marketing/tapfiliate/tapfiliate-site-redirect-url.png?fit=max&auto=format&n=8cnaMPD_oPIjL0By&q=85&s=804ce11e793f1d2dcce8dc7eba09c34a" alt="Redirect URL" width="1440" height="1006" data-path="images/integrations/affiliate-marketing/tapfiliate/tapfiliate-site-redirect-url.png" />
</Frame>

### Track conversions with WordPress

If you're using WordPress, you can track conversions with Tapfiliate's WordPress Plugin.

1. Install [Tapfiliate's WordPress Plugin](https://wordpress.org/plugins/tapfiliate/).
2. Go to *Settings → Tapfiliate.*
3. Fill out the **Tapfiliate account ID** field with your account ID found in your Tapfiliate profile settings.

<Frame>
  <img src="https://mintcdn.com/memberful/8cnaMPD_oPIjL0By/images/integrations/affiliate-marketing/tapfiliate/tapfiliate-account-id.png?fit=max&auto=format&n=8cnaMPD_oPIjL0By&q=85&s=88c25f7c336550c02b0d8bd527d5c7e0" alt="Account ID" width="1440" height="483" data-path="images/integrations/affiliate-marketing/tapfiliate/tapfiliate-account-id.png" />
</Frame>

4. Click **Save Changes.**
5. Add the following shortcode to the "Thank you" page, which you configured in the [Integrate Tapfiliate with Memberful](#integrate-tapfiliate-with-memberful) section:

```text theme={null}
[tapfiliate amount_query_param=amount external_id_query_param=order_id customer_id_query_param=member_id]
```

### Track conversions without WordPress

If you're not using WordPress, you'll need to add some JavaScript code between the `<head>` and `</head>` HTML tags on every page of your website.

```javascript theme={null}
<script src="https://script.tapfiliate.com/tapfiliate.js" type="text/javascript" async></script>
<script type="text/javascript">
  (function(t,a,p){t.TapfiliateObject=a;t[a]=t[a]||function(){ (t[a].q=t[a].q||[]).push(arguments)}})(window,'tap');

  tap('create', 'YOUR_ACCOUNT_ID', { integration: "memberful" });
  tap('detect');
</script>
```

Replace **YOUR\_ACCOUNT\_ID** with your actual account ID, which can be found in your Tapfiliate profile settings. Make sure that your account ID is between single quotes (`'`).

<Frame>
  <img src="https://mintcdn.com/memberful/8cnaMPD_oPIjL0By/images/integrations/affiliate-marketing/tapfiliate/tapfiliate-account-id.png?fit=max&auto=format&n=8cnaMPD_oPIjL0By&q=85&s=88c25f7c336550c02b0d8bd527d5c7e0" alt="Account ID" width="1440" height="483" data-path="images/integrations/affiliate-marketing/tapfiliate/tapfiliate-account-id.png" />
</Frame>

Next, place the following code inside the `<head>` tag of your "Thank You" page, configured in the [Integrate Tapfiliate with Memberful](#integrate-tapfiliate-with-memberful) section. This will send your conversions to Tapfiliate:

```javascript theme={null}
<script src="https://script.tapfiliate.com/tapfiliate.js" type="text/javascript" async></script>
<script type="text/javascript">
  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}
  (function(t,a,p){t.TapfiliateObject=a;t[a]=t[a]||function(){ (t[a].q=t[a].q||[]).push(arguments)}})(window,'tap');

  tap('create', 'YOUR_ACCOUNT_ID', { integration: "memberful" });
  tap('detect');

  var params = getQueryParams();
  if (params.order_id && params.member_id && params.amount) {
    tap('conversion', params.order_id, params.amount, { customer_id: params.member_id });
  }
</script>
```

Replace **YOUR\_ACCOUNT\_ID** with your actual account ID, which can be found in your Tapfiliate profile settings. Make sure that your account ID is between single quotes (`'`).

<Frame>
  <img src="https://mintcdn.com/memberful/8cnaMPD_oPIjL0By/images/integrations/affiliate-marketing/tapfiliate/tapfiliate-account-id.png?fit=max&auto=format&n=8cnaMPD_oPIjL0By&q=85&s=88c25f7c336550c02b0d8bd527d5c7e0" alt="Account ID" width="1440" height="483" data-path="images/integrations/affiliate-marketing/tapfiliate/tapfiliate-account-id.png" />
</Frame>

## Track and manage affiliate activity

If a member uses an affiliate's referral link to access your website and make a purchase, that information (affiliate, conversion ID, and amount) is communicated to Tapfiliate via the WP Plugin or the JavaScript code you inserted. You can manage your affiliates (and their payments) through your Tapfiliate account.

### Locate a Tapfiliate conversion in Memberful

If you'd like to cross-reference a Tapfiliate conversion with the related order in Memberful, add your Memberful account URL subdomain and the Tapfiliate external ID (replace 12345) to the URL below:

```text theme={null}
https://ACCOUNT-URL.memberful.com/admin/orders/12345
```

The external ID in Tapfiliate refers to the order ID in Memberful.

## Integrate Tapfiliate with Stripe

Since both Memberful and Tapfiliate integrate with Stripe, some tasks can be automated. To integrate Tapfiliate with Stripe:

1. Open the Stripe integration page (replace `YOUR-TAPFILIATE-ACCOUNT` with your Tapfiliate subdomain):

```text theme={null}
https://YOUR-TAPFILIATE-ACCOUNT.tapfiliate.com/a/integrations/?open=stripe
```

2. Click **Go to Installation** or **Installation**.

<Frame>
  <img src="https://mintcdn.com/memberful/8cnaMPD_oPIjL0By/images/integrations/affiliate-marketing/tapfiliate/tapfiliate-stripe-installation.png?fit=max&auto=format&n=8cnaMPD_oPIjL0By&q=85&s=cda40c591170229e2a4a017209257a80" alt="Tapfiliate Stripe integration installation" width="1440" height="988" data-path="images/integrations/affiliate-marketing/tapfiliate/tapfiliate-stripe-installation.png" />
</Frame>

3. Skip to the last step (connect with Stripe).
4. Connect your Stripe account.

### Set up recurring commissions

If you'd like your affiliates to earn ongoing commissions for referring members, you can use [Tapfiliate's Stripe integration](https://tapfiliate.com/docs/integrations/stripe/), which automatically handles renewals.

1. Make sure you've integrated your Tapfiliate account with Stripe.
2. Enable lifetime / recurring commissions via *Programs → View program → Commission structure.*

### Automatically handle refunds

If you've integrated your Tapfiliate account with Stripe, and you want all refunds initiated inside Memberful to be propagated to your Tapfiliate account, you can set up an automation using Tapfiliate's [REST API.](https://tapfiliate.com/docs/rest/) Check out our [Partners page](https://memberful.com/preferred-partners) if you need a developer's help with this task.

### Automatically handle disputes

If you've integrated your Tapfiliate account with Stripe, all disputes in Stripe will automatically result in a Tapfiliate commission being disapproved.

<RelatedDocs
  link1={{
url: "/discounts-and-gifting/affiliate-marketing/trackdesk/",
label: "Integrate Memberful with TrackDesk.",
}}
  link2={{
url: "/discounts-and-gifting/track-member-referrals/",
label: "Track member referrals.",
}}
  link3={{
url: "/metrics-and-analytics/tracking/integrate-with-google-analytics/",
label: "Integrate with Google Analytics.",
}}
  link4={{
url: "/metrics-and-analytics/tracking/add-custom-conversion-tracking/",
label: "Add custom conversion tracking.",
}}
/>
