Custom integration

Modified on Wed, 20 Sep, 2023 at 3:56 PM

Install tracking scripts on your website

 

This documentation will guide you to implement Affilae Tracking.

Only two steps are required to set-up Affilae Tracking.
  • Implement Affilae Tag on every pages of your website. The Affilae Tag will allow you to track events such like clicks and conversions from your partners.
  • Trigger the Conversion Tag when you want to track an event such like a sale or lead.

 

Affilae Tag – Track clicks from your partners

Affilae Tag, which should be embedded on all pages of your website (or landing pages), detects clicks from affiliate websites and protect you from click fraud.

Notes:


    • The Affilae Tag for your website is different for each program.
    • The Affilae Tag must be added on every page of your website including confirmation page.
    • The Affilae Tag must be added within the head section tag OR alternatively just after the opening body tag.
    • Verify your CSP configuration.

"default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' https://static.affilae.com/; img-src 'self' https://static.affilae.com/ https://lb.affilae.com/; frame-src 'self' https://lb.affilae.com/; connect-src https://lb.affilae.com/"

How does it work?

  • The Tag below starts asynchronously downloading the library from our domain static.affilae.com.
  • The Tag is initialized by the content of the variable _ae which is mandatory.
  • The Tag also creates AeTracker object to handle events like new click/conversion.
  • The Tag should look like the code below, please replace PROGRAM_ID with your own program ID.
<script type="text/javascript">    var _ae = {        "pid":"523bce93052499c655000d05",    };    (function() {        var element = document.createElement('script'); element.type = 'text/javascript'; element.async = true;        element.src = '//static.affilae.com/ae-v3.5.js';        var scr = document.getElementsByTagName('script')[0]; scr.parentNode.insertBefore(element, scr);    })();
</script>

 

② Conversion Tag – Track leads and sales

The conversion Tag triggers an event to our sever in order to track a new conversion.

The server is then able to detect whether a user has been part of an affiliate tracking process or not and a conversion is created if at least one contributor is found.

Conversion Tag must be embedded on the conversion confirmation pages of your web site: order confirmation pages / thank you pages…

Different types of Tags are available to better match your needs. You must create one conversion Tag for each existing rules (i.e. KEY). If required you can add a fall-back Tag by using the JS Tag and iframe Tag together.

JS Tag

<-- Affilae Conversion Tag -->    <script type="text/javascript">         var aeEvent = {};         /* {{KEY}} must be updated for each rule */         aeEvent.key = '523bcf14052499c655000daf-523bce93052499c655000d05';         aeEvent.Conversion = {};         /* Values below must be updated */         aeEvent.Conversion.id = '{{ID}}';         aeEvent.Conversion.amount = '{{AMOUNT}}';         aeEvent.Conversion.payment = '{{PAYMENT}}';         aeEvent.Conversion.voucher = '{{VOUCHER_CODE}}'; // List of voucher_id seperated by ;         aeEvent.Conversion.subid = '{{SUB_ID}}';         aeEvent.Conversion.customer = '{{CUSTOMER_ID}}';         aeEvent.Conversion.currency = 'EUR';         aeEvent.Conversion.product = '{{PRODUCT_ID}}'; // List of product_id seperated by ;         ('AeTracker' in window)           ? AeTracker.sendConversion(aeEvent)           : (window.AE = window.AE || []).push(aeEvent);   </script>

Note: This Tag requires Affilae Tag Implementation (Check Step 1).

Iframe Tag – Fall-back

<!-- Values in query string must be updated -->
<iframe src="https://lb.affilae.com/?key={{KEY}}&id={{UNIQUE_ID}}&amount={{AMOUNT}}&payment={{PAYMENT}}&customer={{CUSTOMER_ID}}&cv={{SUB_ID}}&voucher={{VOUCHER_CODE}}&currency={{CURRENCY_CODE}}" frameborder="0" width="1" height="1"></iframe>

Note: valid for redirect.

Image Tag – Fall-back

<!-- Values in query string must be updated -->
<img src="https://lb.affilae.com/?key={{KEY}}&id={{UNIQUE_ID}}&amount={{AMOUNT}}&payment={{PAYMENT}}&customer={{CUSTOMER_ID}}&cv={SUB_ID}&voucher={{VOUCHER_CODE}}&currency={{CURRENCY_CODE}}" style="display: none;" width="0" border="0" height="0">

Note: valid for redirect.

  Parameters to be set:


VariableRequiredValue Information
keyYesThis key is supplied to you on the “conversion code” page available through your affiliate program Configuration dashboard.

e.g.5f04fe700000000000000000-5f04fe700000000000000000

idYesPopulate this parameter with a unique identifier, for example, a unique order number.

If you use this code to confirm a subscription to a newsletter yet you do not have an automatically generated unique identifier, you can, for example, use the user’s email Hash (e.g. MD5) to populate this parameter.

amountYes for salesTotal amount Excluding Tax of an order, which will serve as the basis for calculating the commission and Revenuegenerated.

e.g.123.45

paymentYes if conversion requires paymentIf the conversions are subject to payment, specify the client’s mode of payment, if not simply leave this parameter blank:
  • online for online payment
  • bankwire for payment by bank transfer
  • other for all other types of payments
customerYes if revenue share is activatedYour client identifier if the “Revenue Share” option is activated. Please use an identifier that will not change over time, the best being the ID number used in your database.

Leave this parameter blank if you do not use the Revenue Share option.

cvNocustom variable that will be available in the interface and API: products, new customer etc.
voucherNoShould be replaced by the voucher code that was applied during the check-out process. Value is case sensitive. Use ; as a separator to add multiples codes.
Productno Product IDs list. Use ; as a separator to add multiples product.



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article