This guide will help you integrate your Refersion account with your BigCommerce store, allowing you to track affiliate orders generated in BigCommerce. Below are the required steps:
Install the Refersion app in BigCommerce
Add Refersion’s tracking code snippets to your store
Determine the SSL settings for your site
Run a test order
Step 1: Install the Refersion app in BigCommerce
You’ll need a Refersion account - if you haven’t created one yet, sign up here.
Note: Only the Store Owner can install the Refersion app for BigCommerce. If you are logged in with an administrator role or below, we suggest looping in the store owner to assist with the app installation.
Log in to your Refersion dashboard (if you’ve just created the account, click Exit to Dashboard) then open a new tab in your browser. In the new tab, login to your BigCommerce store.
With both of these tabs open, install the Refersion app from the BigCommerce App Store. This will automatically connect BigCommerce tracking to your Refersion account.
You can check to see if tracking is connected in Refersion by going to Account > Settings > Tracking. The new tracking should look like this:
Step 2: Add Refersion’s tracking code snippets
In order to track clicks and create conversions in Refersion from your store, you’ll need to add two code snippets in BigCommerce using the Script Manager. The first script one is our click tracking script, and it enables us to track clicks when affiliates drive traffic to your store using their referral link.
In BigCommerce, navigate to Storefront > Script Manager and click Create a Script.
Configure the settings on the Create Script screen to match the settings below:
Name of script: Refersion click tracking
Location on page: Head
Select pages where script will be added: All pages
Script category: Functional
Script type: Script
Add the following snippet to the script contents box, being sure to replace the highlighted YOUR_PUB_KEY with your Refersion API Public Key (found in Account> Settings>Refersion API. More info on where to find your pub_key here).
<script type="text/javascript">
(function (w,d,s,u,o,c,e,x) {
w['TrackingSystemObject']=o;
e=d.createElement(s);e.async=1;e.src=u;e.onload=c;x=d.getElementsByTagName(s)[0];x.parentNode.insertBefore(e, x);
})(window,document,'script','https://cdn.refersion.com/refersion.js','r',function () {
// Configure SDK
r.pubKey = 'YOUR_PUB_KEY';
r.settings.fp_off = true;
r.cart_type='BIGCOMMERCE';
// Initialize
r.initializeXDLS().then(() => {
r.launchDefault();
});
});
</script>
Here is how your settings should look once everything is completed:
Save your changes and proceed.
Next, you’ll need to add Refersion’s conversion tracking script to your store. You’ll do this by creating another script using the same Create a Script button.
Configure the settings on the Create Script screen to match the settings below:
Name of script: Refersion conversion tracking
Location on page: Footer
Select pages where script will be added: Order Confirmation
Script category: Functional
Script type: Script
Finally, copy and paste the following snippet into the “script contents” box and save your changes.
<script type="text/javascript">
function checkoutFunction() {
if ( typeof r === 'object' ) {
const requestParams = {
cart: "{{checkout.order.id}}",
id: localStorage.getItem('rfsn_v4_id'),
url: window.location.href,
aid: localStorage.getItem('rfsn_v4_aid'),
cs: localStorage.getItem('rfsn_v4_cs'),
cartType: localStorage.getItem('rfsn_v4_cart_type')
};
r.sendCheckoutEvent(requestParams.cart, requestParams.id, requestParams.url, requestParams.aid, requestParams.cs, requestParams.cartType);
} else {
setTimeout(function () {
checkoutFunction();
}, 500);
}
}
checkoutFunction();
</script>
Once this is complete, you should have two new scripts listed in the script manager.
Step 3: Determine the SSL settings on your site
There are three scenarios and you can determine which settings you have by heading to your site and clicking into the address bar at the top of the browser.
No SSL on the site - the web address will start with “http” - with no “s” at the end.
SSL on the homepage only - the address on your homepage starts with “https,” but the others start with only “http.”
SSL on the entire site, provided by BigCommerce - if all pages on your site start with “https,” you have SSL throughout.
No SSL on the site
You will use your BigCommerce URL for Refersion tracking, and you can find your BigCommerce domain by following the steps here. Once you have obtained that URL, set your domain in Refersion by going to Account > Settings.
SSL just on the homepage
Contact Refersion at [email protected] - we’ll need to turn on additional settings for your account.
SSL on the entire site, provided by BigCommerce
Add your website's URL (yourwebsite.com, for example) in Account > Settings and you're all set. No additional steps required, proceed to Step 4.
Step 4: Run a test order
To make sure everything is configured correctly, run a test order to test the tracking on your site (Please note: free orders from BigCommerce do NOT get recorded as conversions, so you'll need to place a paid order to test your integration. Also test orders will take about 10 minutes to come through). If you are having any issues contact us at [email protected].