Refersion Tracking Documentation

Complexity: Beginner Developer

Getting Started

In order for Refersion to operate as expected, we must be able to capture your transactions. If you are not using a shopping cart platform that we already integrate with, you must implement our tracking solution on your web site manually. Our tracking isn't very complicated and is installed similiar to how Google Analytics is installed.

To install, you must complete the following steps.

Include a JavaScript code on every page on your site so that we can track your affiliate visits.

Report each order to us either on your "thank you" page or through a Webhook (for more advanced developers).

Your Refersion API Keys

For most of our APIs you must idenfity your account with your own unique Refersion API Public and/or Secret key. You may see existing or create new API keys right from your account settings.

Step 1 - Tracking Visits

Please copy/paste the following code on every page on your web site where you expect your affiliates to drive traffic. Make sure to place the code just before the </body> tag in your HTML.

Step 2 - Tracking Orders

For this type of tracking, you must add code into your "thank you" or confirmation page. This would be the page that all customers are directed to after completing their order. Below is sample code which you should use as a starting template.

Within this code, you must dynamically insert the customer's transaction information from the respective order. We've added some dummy order information for your reference. Not all data is required, but all is recommended. A description of each field is available at the end of this article.

For best performance, place this code just before the </body> tag in your HTML.

In order to function properly, the click tracking code described in Step 1 and this code must run on the same domain and security level (http/https).

Another way to report orders to us is by creating a Webhook. Usually this option requires a greater amount of development work since you'll be "posting" order information to us directly from your server.

There are two requirements for this implementation:

Sending us a cart_id using a short JavaScript code on your "thank you" page so that we may reference any future Webhook reported to the session.

An HTTP POST of the actual order information from your server, which contains the previously reported cart_id.

The cart_id value

When we receive any Webhooks, we must associate it with a previously captured browser session. However, since Webhooks are reported from the server-side and not the browser-side, we can not access the relevant customer's session information. For this reason, we use the cart_id value as a common identifier that we can reference. We ask you to report a cart_id on your "thank you" page where we store session information and then a second time in the Webhook so that we may associate it with the aforementioned browser session from the JavaScript call.

The cart_id may be any string value up to 255 characters.

For security, make sure that cart_id is not sequential or may be easily guessed such as a session ID or an encrypted version of several strings.

Reporting cart_id

Please copy/paste the following code into your "thank you" or confirmation page. This would be the page that all customers are directed to after completing their order.