In this article, we’ll share how we’ve set this connection up to track clicks from affiliate referrals on your ClickFunnels website, send order data via a webhook from ClickFunnels to Zapier, and finally have Zapier send order data into Refersion to create conversions.

Before you get started please note:

  • This is an advanced tutorial; familiarity with both Zapier and webhooks will be required. We recommend looping in your developer.

  • You will need a paid Zapier plan that supports at least 1 Premium app.

Step 1: Add Refersion's tracking scripts to your funnel(s):

In order to track clicks back to affiliates when customers visit your site, you'll need to add the following click tracking script to all pages of your website. In ClickFunnels you can do this by navigating to your funnel’s “Settings” section and pasting the below code snippet into the ”HEAD TRACKING CODE” box.

Important note: You’ll see on the 6th line in the code snippet below “YOUR_PUB_KEY”. Be sure to replace that with your specific public key from your Refersion account. You can find your public key in Refersion by navigating to Account > Settings > Refersion API.

<script>
!function(e, n, t, i, o, c, s, a) {
e.TrackingSystemObject = "rfsn", (s = n.createElement(t)).async =
1, s.src = "https://cdn.refersion.com/refersion.js", s.onload =
function() {
rfsn.pubKey = "YOUR_PUB_KEY", rfsn.settings.fp_off = 1;
rfsn.initializeXDLS().then(() => {
rfsn.launchDefault()
})
}, (a = n.getElementsByTagName(t)[0]).parentNode.insertBefore(s,a)
}(window, document, "script");
</script>

Here’s an image of where to paste the code:

Once you’ve added the code, scroll all the way down to the bottom of the screen and click “Save and Update Settings”.

In addition to the click tracking script, you'll also need to include a code snippet on your order confirmation page. This script is responsible for reporting the click funnels “uvid” as a unique identifier for the click. This will be critical later when matching clicks to orders to create conversions.

In order to add this script, please navigate to your funnel’s Steps section and find your order confirmation page and click the “EDIT PAGE” button.

Once you are in the page editor, on the top navigation bar, go to Settings > Tracking Code.

In the tracking code popup window, click the “</> FOOTER CODE” tab. You'll know this is highlighted when it’s a darker gray than the header code tab. Past the code below in the footer code tab’s code box.

<script>
function rfsnConversionTracking() {
let urlParams = new URLSearchParams(window.location.search);
const cart_id = urlParams.get("cf_uvid");
if (typeof rfsn === 'object') {
const rfsnObj = {
cart: cart_id,
id: localStorage.getItem("rfsn_v4_id"),
url: window.location.href,
aid: localStorage.getItem("rfsn_v4_aid"),
cs: localStorage.getItem("rfsn_v4_cs")
};
rfsn.sendCheckoutEvent(rfsnObj.cart, rfsnObj.id, rfsnObj.url, rfsnObj.aid, rfsnObj.cs);
} else {
setTimeout(function() {
rfsnConversionTracking();
}, 500);
}
}

rfsnConversionTracking();
</script>

Here’s an example image of what this should look like once completed:

Remember to save your changes on the top right of the page editor.

Step 2: Set up a webhook in ClickFunnels to send order data to Zapier

While we have created a Zapier Template to get started with, you will first need to configure a webhook in ClickFunnels in order to complete the Zapier setup.

To start, open up this Zapier template in a new tab and click “Try this Zap” to create a new zap in your account. When the new zap is created, copy the webhook URL from the first step of the zap and head to your ClickFunnels dashboard.

If you’ve navigated away from your funnel, return to your funnel’s settings page and scroll down to the “Webhooks” section. Click “Manage your Funnel Webhooks”.

In this section, click “+ New Webhook”. For your webhook:

  • Paste the Zapier webhook URL in the “URL” field.

  • Remove “All Events” from the events box and select the “purchase_created” event only.

  • Leave the version as “1”.

  • Change the adapter to “json”.

Here’s what your webhook settings should look like:

Once everything is filled out properly, click “Create Funnel Webhook” to finalize your webhook.

Step 3: Set up the Zap Template

Now that your webhook is configured in ClickFunnels, you’ll need to place an order to finish up your zap. To avoid placing an order twice, you can grab a test order link from your Refersion dashboard for this step. Here is more information about placing test orders.

Immediately after placing your order return to your Zapier template and click “Test Trigger” for step 1. You should see order data related to the order you just placed.

Press continue to move on to the next step in the zap.

This next step in the zap is optional but we do recommend it to ensure you’re only paying out commissions on paid orders. To do so you’ll want to make sure your filter step is configured so your zap only continues if the “Purchase Status” field from ClickFunnels is “Paid” as shown in the image below:

Once your filter settings are configured, you can click continue to see if your zap would continue onto the next step. It should say “Your Zap would have continued” if you placed a paid test order.

This next step is responsible for formatting the amount paid by your customer. Since this data is sent to Zapier in cents, the zap will reformat the number (from 1 cent to .01 for example)so our system can read the order amount properly and calculate commission.

If everything has been set up correctly, the test run on this step will be successful:

Finally, the last step of the zap sends the order data from ClickFunnels into Refersion. This step will have been preconfigured for you in our template zap, but you can use the image below as a reference for how these steps should be configured:

Once you have verified everything in this step is completed you should be able to run another successful test. Your completed Zap should look like this:

Important Note: If you have multiple funnels, you’ll need to repeat these steps for each funnel you’d like to have track referrals.

Be sure to complete a new test order after the zap is enabled to confirm everything is working as intended.

Did this answer your question?