Article

C2S – Manual

The manual integration means installing two Affilae scripts on your website yourself: the tracking tag on all pages, and the conversion tag on the confirmation page. Use this method when no plugin matches your technology.

Prerequisites: the URL format of your program must be set to Parameter or Redirect (in Server-to-Server (S2S), follow the S2S – Server-to-Server guide instead). You can edit the URL format in your program Configuration, under Global settings. Have your Program ID and your Key at hand.
Warning: never send personal data in the parameters, for example a name, a surname or an e-mail address.

Check your CSP configuration

If your server enforces a content security policy, it must allow the Affilae domains. See the Content-Security-Policy reference.

Add the Affilae domains to your existing policy:

script-src https://static.affilae.com; img-src https://static.affilae.com https://lb.affilae.com; frame-src https://lb.affilae.com; connect-src https://lb.affilae.com

Install the tracking tag

This tag allows tracking of your partners clicks and their conversions.

Where to place it

  • On ALL pages of your website.
  • Inside the <head> section or just after <body>.

Code to install:

<script type="text/javascript">
var _ae = {
"pid":"YOUR_PROGRAM_ID",
};
(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>

Replace YOUR_PROGRAM_ID with your Program ID. You find it in your program Configuration, Tracking tab, Integration via an Affilae plugin section.

What this tag does

  • It detects when a visitor comes from an affiliate partner.
  • It protects against fake clicks.
  • It tracks the visitor journey.
Consent banner (CMP): load the tag as soon as consent is given If your website uses a consent management platform (CMP), it must load the Affilae tracking tag as soon as the visitor accepts, on the page they landed on. The tag reads the click identifier from that first page’s address: if it only loads on the next page, that identifier is lost: with a link in Parameter format, the click is not recorded; with a Redirect link, the sale may no longer be attributed to the affiliate, even for a visitor who accepted.

Install the conversion tag

Where to place it

  • Only on the order confirmation page.
Good to know: to use this tag, the tracking tag must be implemented.

Code to install:

<script type="text/javascript">
var aeEvent = {};
aeEvent.key = '{{KEY}}';
aeEvent.Conversion = {};
/* Values below must be updated */
aeEvent.Conversion.id = '{{ID}}';
aeEvent.Conversion.amount = '{{AMOUNT}}';
aeEvent.Conversion.payment = '{{PAYMENT}}';
aeEvent.Conversion.voucher = '{{VOUCHER_CODE}}';
aeEvent.Conversion.subid = '{{SUB_ID}}';
aeEvent.Conversion.customer = '{{CUSTOMER_ID}}';
aeEvent.Conversion.currency = '{{CURRENCY_CODE}}';
aeEvent.Conversion.product = '{{PRODUCT_ID}}'; // List of product_id separated by ;
if ('AeTracker' in window) {
AeTracker.sendConversion(aeEvent);
} else {
(window.AE = window.AE || []).push(aeEvent);
(function (event) {
var sent = false;
var sendFallback = function () {
if (sent || 'AeTracker' in window) return;
sent = true;
var c = event.Conversion;
new Image().src = 'https://lb.affilae.com/?key=' + event.key
+ '&id=' + c.id + '&amount=' + c.amount
+ '&cv=' + (c.subid || '') + '&payment=' + (c.payment || '')
+ '&voucher=' + (c.voucher || '') + '&product=' + (c.product || '')
+ '&customer=' + (c.customer || '') + '&currency=' + (c.currency || '')
+ '&fp=&cids=&t=&source=js&v=fallback';
};
setTimeout(sendFallback, 5000);
window.addEventListener('pagehide', sendFallback);
})(aeEvent);
}
</script>

Parameters to be filled in

In the code, replace every value between double braces, for example {{ID}}, with the order data. The table gives the field name in the JavaScript tag, then the parameter name in the address of the image version or of the Server-to-Server postback.

TAG FIELD URL PARAMETER REQUIRED VALUE
key key Yes The key is available in your program Configuration, Tracking tab, Integration via an Affilae plugin section. Example: 5f04fe700000000000000000-5f04fe700000000000000000
Conversion.id id Yes Enter a unique identifier for this parameter. The simplest option is to use the order number. For a sign-up without an order number, use the sign-up identifier generated by your website. Without this value, the conversion is refused.
Conversion.amount amount Yes for sales Total amount of the order excluding tax, after discounts and without shipping costs, which will be used as the basis for calculating the commission and the revenue generated. Example: 123.45
Conversion.currency currency No Three-letter currency code (ISO 4217), for example EUR. It must be one of the Rule Currencies, otherwise the conversion is refused. Without a currency, the first currency of the rule applies.
Conversion.payment payment No Send online for any order paid online: an empty or different value, for example bankwire for a bank transfer or other, applies the status chosen in the rule, field Status of new conversions not paid online.
Conversion.voucher voucher No The promo code or codes used, separated by a semicolon. Uppercase and lowercase do not matter: LEA20 and lea20 are the same code.
Conversion.subid cv No Free reference of your choice, reported with the conversion and available in the interface and the API. Not to be confused with the SubIDs that affiliates add to their links.
Conversion.customer customer Recommended Your customer’s ID, stable over time, preferably the one from your database, never a plain email address. It lets Affilae recognise the same customer from one order to the next. It is required when the rule enables Revenue Sharing.
Conversion.product product No IDs of the ordered products, separated by a semicolon. They feed top products if your program has a product feed whose IDs match.

The tag does not transform the values: encode the ones that may contain special characters (space, &, #, +…), for example with encodeURIComponent() in JavaScript.

Your installation checklist

Before starting

  • I have my Affilae Program ID.
  • I have my conversion key.
  • I have configured the URL format in my dashboard.

Installation

  • Tracking tag installed on all pages.
  • Conversion tag installed on the confirmation page.
  • Variables replaced with dynamic values.
  • Test carried out with a test order.

Important checks

  • No personal data is transmitted.
  • Tags load correctly, to be checked in developer tools.
  • Conversions appear in my Affilae dashboard.
Tip: always test with a real transaction placed through a tracked link. An order created by hand in your back office does not fire the tag, so it proves nothing.

Related articles

Frequently asked
questions

See more questions

Check that your Program ID and your key are correct. Then check your security settings, in particular your CSP policy, which must allow the static.affilae.com and lb.affilae.com domains.

The tracking tag must be installed AND functional, so it must be tested first. Verify that all mandatory parameters are filled, then test with a real transaction through a tracked link.

Any personal data: no name, no surname, no e-mail address. To identify a customer, use a stable technical identifier, for example the one from your database.

Without tax, after discounts and without shipping costs. The amount parameter expects that amount, and that value is the basis for calculating the commission and the revenue generated.

Separate them with a semicolon inside the same parameter. Uppercase and lowercase do not matter in promo codes.

In Affilae, open your program Configuration, then the Tracking tab. The Integration via an Affilae plugin section shows the Program ID and, for each rule, its Key.

Yes, but dedicated documentation exists and will save you time. See C2S – WooCommerce – Manual for a WooCommerce store, and C2S – GTM – Manual for an installation through Google Tag Manager.

Need help?

Stay up to date with the latest trends in affiliate marketing and never miss any of our articles.

Contact Us