Tracking code

To successfully track events on your website, two lightweight Javascript snippets need to be added to the code. You can do this yourself by following the steps below, or get support from our technical team. Feel free to send a request via email to tech-support@addrevenue.io and we'll assist you in this matter.

Here you can read more about how tracking works technically.

Once you have installed the tracking code, we want you to make a test purchase. See our Test purchase guide for step-by-step and troubleshooting help.

 

Instructions for specific platforms can be found here:

The base script

On every page in the HEAD section, you should copy and paste the following code:

<script src='https://addrevenue.io/track2.js'></script>

The conversion script

On the page of any completed transaction (often the Thank you page), copy and paste the following code.
Please note that it must be placed AFTER the loading of the base script.
The keyword 'Purchase' can be changed, to track a conversion that matches the Conversion Event ID you have setup in your commission program.

<script>
ADDREVENUE.sendEvent('Purchase', {'value': YOUR_VALUE, 'currency': 'YOUR_CURRENCY', 'orderId': 'YOUR_ORDERID'});
</script>

Important!
The variable names YOUR_VALUE, YOUR_CURRENCY and YOUR_ORDERID needs to be changed and set up your e-commerce application!

The amount that should be sent as value, is the complete order amount excluding taxes, shipping and any fees!

value An integer or decimal value of the conversation value, normally the complete order amount excluding taxes, shipping and any fees.
currency Three-letter Currency code according to the ISO 4217 standard.
orderId A string with your transaction id, normally the order number. If this is a custom conversion without an order number, please generate a unique ID.


Example of code for an online purchase of 458 SEK incl taxes, whereof 59 SEK is shipping fee. The amount to send is the value of the goods excl tax, in this case 319,20 SEK, if the tax rate is 25%.

<script>
ADDREVENUE.sendEvent('Purchase', {'value': 319.20, 'currency': 'SEK', 'orderId': 'W6234'});
</script>

Other conversions

It is possible to setup other conversions than Purchase. In fact you can use any name, as long as it matches the Conversion Event ID, you setup in your commission program.
Let's say that you setup a commission program with the Conversion Event ID "My signup" and with 200 SEK commission for each signup, the conversion code will look like this:

<script>
ADDREVENUE.sendEvent('My signup', {'orderId': '123456'});
</script>


Please note that the value and currency can be left out, since they are configured in the commission program already.
You can even leave the orderId out, but we do not recommend this, as any duplicates will be very hard to identify.

If you support multiple currencies, you can set up the commission program with 100% commission and then use value and currency in the conversion code instead, much like the purchase event.

<script>
ADDREVENUE.sendEvent('My signup', {'value': 200.00, 'currency': 'SEK', 'orderId': '123456'});
</script>


Amounts in the Commission Program setup should never be used together with values in the conversion code. If they are used together, the value and currency in the conversion code will be used and the amount and currency in the Commission Program will be ignored.

Custom commission programs

Addrevenue has two types of commission programs: Fixed and Variable. As the names suggest, you as an advertiser in a commission program of the type "Fixed" set a fixed amount and fixed currency, while for variable commission programs you set a percentage, and then commission is calculated based on the value of the conversion multiplied by the specified percentage.

But in some cases neither Fixed nor Variable is suitable. It can e.g. be so that a transaction contains both variable and fixed parts, or perhaps variable parts with different percentages and so on. We do not have our own support for this type of complex commission programs, but we still allow you to in commission programs of the type "Custom" to pass the of you calculated commission amount to the function call to ADDREVENUE.sendEvent via the parameter commissionAmount.

Example:

<script>
ADDREVENUE.sendEvent('Purchase', {'value': 559.20, 'currency': 'SEK', 'orderId': '123456', 'commissionAmount': 83.88});
</script>

Please note that the commission amount should be specified excluding taxes, since we will add any application taxes in the affiliate payout.