Skip to main content

How to Integrate Magento with Tapfiliate

This guide walks you through connecting your Magento store with Tapfiliate.

Gumrah avatar
Written by Gumrah
Updated over a week ago

In this article, we will cover:

Magento Integration Overview

Tapfiliate provides a flexible integration method for Magento, enabling accurate tracking of affiliate clicks and conversions, including coupon-based conversions and lifetime commissions. Magento 1 integrates with Tapfiliate through template edits, while Magento 2 relies on a third-party extension to enable tracking.

Pros:

  • Conversion tracking

  • Commission based on order amount

  • Affiliate coupon-code conversions

  • Lifetime/recurring commissions

  • Automatically handles refunds & disputes

Cons:

  • Developer required (code changes needed)

  • Only supports Magento 1 out of the box

  • Magento 2 integration depends on a third-party provider

Prerequisites for integrating Magento

To successfully integrate, ensure you have the following:

  1. A Tapfiliate account with your Account ID

  2. Admin access to your Magento backend

  3. Ability to edit theme templates (footer + success page)

Steps to complete tracking setup

Step 1: Set up click tracking

To install Tapfiliate tracking on your Magento store, add the main tracking code to your footer.

In Magento Admin (Magento 1):

Go to:

Configuration → General → Design → Footer

Paste the following code into Miscellaneous HTML:

<script src="https://script.tapfiliate.com/tapfiliate.js" async></script>

<script>

(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: "magento" });

tap('detect');

</script>

Replace YOUR-ACCOUNT-ID with your actual Tapfiliate account ID.

This code enables global click tracking on all store pages.

Step 2: Set up conversion tracking (Magento 1)

To track purchases, add a conversion script to your order success page.

Edit the success page template:

Open the file:

app/design/frontend/XXXX/XXXX/template/checkout/success.phtml

Add the following code at the end:

<?php

$order = Mage::getModel('sales/order')

->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());

$amount = number_format(

$order->getGrandTotal()

- $order->getShippingAmount()

- $order->getShippingTaxAmount(), 2

);

?>

<script src="https://script.tapfiliate.com/tapfiliate.js" async></script>

<script>

(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: "magento" });

tap('conversion', '<?php echo $this->getOrderId() ?>', <?php echo $amount ?>);

</script>

This tracks conversions with the order ID and the calculated order subtotal (excluding shipping & shipping tax).

Magento 2 Integration (via third-party)

Magento 2 does not include native Tapfiliate integration. Instead, install the free third-party extension from Meetanshi:

Download:

Note: Since this integration is created and maintained by a third-party developer, Tapfiliate support cannot assist with Magento 2-specific extension issues.

Advanced or Optional Features

Affiliate coupon-code tracking

If you created coupon codes for affiliates in Tapfiliate:

  • Use the Tapfiliate coupon tracking feature

  • Magento order coupons will automatically be used to attribute conversions

Order amount–based commissions

Tapfiliate will calculate commission based on the amount passed in the conversion script.

Lifetime / recurring commissions

Tapfiliate supports recurring/lifetime commissions for all customers who originate from an affiliate.

Refund & dispute handling

If a refund or dispute occurs, Tapfiliate can automatically reverse/adjust commissions as long as the order ID matches your original conversion.

How to Test and Verify Integration

Follow these steps to test your Magento tracking:

  1. Create a test affiliate in Tapfiliate

  2. Open the test affiliate’s referral link in an incognito window

  3. Verify that the click appears in:
    Tapfiliate → Reporting → Affiliates → Clicks

  4. Complete a test purchase to trigger your success page conversion script

  5. Check Tapfiliate → Conversions to confirm the conversion appears

  6. Ensure the:

    • Order ID matches

    • Amount matches

If conversions do not appear, follow Tapfiliate’s troubleshooting guide or confirm your template path and IDs.

Need More Help?

If you have questions or need assistance, feel free to contact us at support@tapfiliate.com. We're happy to help!

Did this answer your question?