Docs

Refersion 

Introduction 

Refersion is an affiliate marketing platform that connects to your e-commerce store and manages every aspect of your program in one place. It helps online shops track sales driven by promoters, influencers, and affiliates. Easier to create, grow, and track your very own affiliate program. Getting set up takes minutes and requires zero technical knowledge.

You can use Refersion to:

  • Create an affiliate marketing program.
  • Add affiliates to your program.
  • Record the bonuses of your affiliates.

The Chargebee-Refersion integration enables you to track and report the purchases that are generated by your affiliates. The report on the aforementioned purchases can be found in your Refersion Account.

Note

If you are an API user, contact support  to set up order tracking for your site via the API.

Setup Integration 

Configure Credentials 

You need to configure credentials in both Chargebee and Refersion before you get started.

Setting up the Integration in Refersion 

If you already have a Refersion account, follow these steps to set up an integration in Refersion:

  • Log into Refersion using the credentials.
Note

If you are new to Refersion, sign up for a Refersion account.

  • Click Account > Settings > Tracking.
  • Enable V4 Tracking.
  • Click Add Tracking.
Note
  • Refersion is equipped to track visits and orders on the website placed by your customers, who visited the website/app through your affiliates.
  • Insert this snippet of JS code into the web pages (on your website) that you would like Refersion to keep a track of for affiliate redirected visits.

As a part of the signup process, you will be prompted to connect with the platforms you are using along with your website.

  • Select Chargebee from the platform options listed here.

  • Configure Refersion's Credentials in Chargebee:
    Enter the following information:

  • Chargebee Thank You Page: This field displays two options in the dropdown as listed here:

    • Hosted - Your Thank you page is managed by Chargebee.
    • Self-Hosted - You manage your own Thank you page.
Note

Refer to Chargebee's Integrations Options for further details on configuring credentials.

  • Shop URL: This is your website's URL example: http://www.acmeinc.com
  • Chargebee Site URL: example: acmeinc.chargebee.com
  • Refersion API keys (Public and Secret): To find this information in Refersion click Account > Settings > Refersion API. Click here to know more on how to find the keys in Refersion.
Note

Copy the details under API Keys and Subdomain, as they come in handy in the upcoming step(when you add Refersion's credentials in Chargebee).

Follow these steps to set up the integration from Refersion to Chargebee within the Chargebee store:

  1. Select Hosted from the drop-down of the Chargebee Thank You.
  2. Enter the Website URL in the Enter Your Shop URL field.
  3. Enter the Chargebee Site URL.
  4. Enter the Refersion API Keys and Subdomain information.
  5. Click Connect Chargebee.

Connecting to Refersion 

Now that you have set up the integration in Refersion log into the Chargebee site to connect to the created Refersion account.

1.Connecting to Refersion Account 

  • Login to Chargebee.
  • Click Apps>Go to Marketplace> Refersion.
  • Enter your Refersion API Keys, and Subdomain information.
  • Click Save.

2. Setup the Webhook in Chargebee 

Chargebee can send the order data back to Refersion using Webhooks.
To configure Refersion's webhook in your Chargebee site, sign in to your Chargebee site.

  • Click Settings > Configure Chargebee > Webhooks and click Add new webhook.
  • Configure the Refersion's Webhook URL, with the Refersion API Keys, and Subdomain details:
    https://<SUBDOMAIN>.refersion.com/tracker/chargebee/conversion/v2/?public_key=<PUB_KEY>&private_key=<SEC_KEY>
    
  • Click Save.

3. Setup the Checkout 

  • Add Chargebee JS to your header.

  • If you are using, Chargebee's Drop-In Script to generate the Subscribe button,
    Note:Add the parameter data-cb-refersion-enabled="true" to your Chargebee JS function in the header.

  • If you are using, Chargebee JS and generating your own Subscribe buttons, Add the following script in all the pages that have the checkout/subscribe button.

    <!-- REFERSION TRACKING: BEGIN -->
    <script>
    ! function(e, n, t, i, o, c, s, a) {
      e.TrackingSystemObject = "r", (s = n.createElement(t)).async = 1, s.src = "https://cdn.refersion.com/refersion.js", s.onload = function() {
          r.pubKey = "<PUB_KEY>";
          // Uncomment next line if you need to debug during testing
          // r.settings.dbg_mode = true;
          r.settings.fp_off = true;
          r.initializeXDLS().then(() =&gt; {
              r.launchDefault().then(() =&gt; {
                  const rfsnTrackingEvent = new Event("refersion-loaded");
                  document.dispatchEvent(rfsnTrackingEvent);
              });
          });
      }, (a = n.getElementsByTagName(t)[0]).parentNode.insertBefore(s, a);
    }(window, document, "script");
    </script>
    <!-- REFERSION TRACKING: END -->
    /* Note to Add the Public Key to the code */
    

4. Setup your Thank you / Conversion page 

Chargebee's default Thank you page

  • Chargebee supports its native Thank you page, where post purchase, users will be shown a close button that signifies the completion of the transaction.
  • Conversions will be tracked automatically in Refersion via Chargebee's Server-Side integration.

Custom Thank you page
You can also choose to redirect users to a custom Thank you page designed by you. Chargebee supports this out of the box. To enable this and then track the conversion on Refersion,

  • Navigate to plans, select the plan, and add the Redirect URL.

  • To the configured Redirect URL / Thank you page, add ?rfsn_ci={{Find Domain Here }}.

If your Thank you page's URL was, 
https://acmeinc.com/success.html

This would be,
**https://acmeinc.com/success.html*?rfsn_ci={{subscription.id}}**
  • Add this JS snippet to your Custom Thank you page.
<!-- REFERSION TRACKING: BEGIN -->
  <script>
  function rfsn_getQS(e) {
      e = e.replace(/[\\[]/, "\\\\[").replace(/[\\]]/, "\\\\]");
      var t = new RegExp("[\\\\?&]" + e + "=([^&#]*)"), 
      n = t.exec(location.search); 
      return n == null ? "" : decodeURIComponent(n[1].replace(/\\+/g, " "));
  }
  document.addEventListener("refersion-loaded", function() {
    const cart = rfsn_getQS('rfsn_ci');
    let id = '', aid = '', cs = '', url = window.location.href;
    try {
        id = localStorage.getItem("rfsn_v4_id");
        aid = localStorage.getItem("rfsn_v4_aid");
        cs = localStorage.getItem("rfsn_v4_cs");

        if (id && aid && cs) {
            r.sendCheckoutEvent(cart, id, url, aid, cs);
        } else {
            console.warn("Missing Refersion parameters.");
        }
    } catch (error) {
        console.error(error);
    }
  });
  console.log(rfsn_getQS('rfsn_ci'));
  </script>
<!-- REFERSION TRACKING: END -->

5. Allow-listing your Domain 

White list your domain in Chargebee.

  • Go to Settings.
  • Navigate to Configure Chargebee > Checkout & Self Serve Portal > Advanced Settings > Add Domains and add your site.
Note

This is applicable only when you are using Chargebee's Checkout.

How to Test 

  • Create a Test Affiliate on Refersion.
  • Go to Perform Test Order on Refersion's Home Page.
  • Select the Test Affiliate from the drop-down.
  • Click Get Test Link, this will generate a unique test URL for you.

  • Copy the link, open a new incognito window, and paste the URL.

  • Test the Subscription purchase flow.

  • Post the purchase, the plan you just bought should reflect as a Conversion on Refersion against the test affiliate. You can see this in the Manage > Conversions section on Refersion.

FAQ 

1.What does Refersion track on my website?

Refersion tracks and reports on two things:

  • Visits to your website that are a direct result of your affiliates (these are tracked through the affiliate URLs that you set up in your Refersion site)

  • Orders made on your website (or with Chargebee's hosted pages) are a direct result of your affiliates.

2.Chargebee communicates with Refersion via webhook. Where can I find this webhook on my Refersion site?

The webhook that Chargebee uses to communicate with Refersion needs to be set up manually using your Refersion subdomain, your public API key, and your secret API key. It cannot be copied from your Refersion website and pasted in Chargebee.

3. Where can I find my API keys in Refersion?
Your API keys are available at Account > Settings > Refersion API.

Log in to your Refersion account and navigate to this page to access your API keys.

4.How do I know what version of Refersion to choose in Chargebee?

If you are a new user or are using the Chargebee-Refersion integration for the first time, then choose version two.

Was this article helpful?
Loading…