Implémentation via Google Tag Manager – script HTML
This guide is intended to help you implement Affilae tracking via Affilae HTML scripts.
1- Installing GTM To install the GTM container on your site, please follow the Google Configuration and Installation instructions: support.google.com/gtm
2- Add the Affilae tag Once GTM has been installed, log in to your account and navigate to your “Workspace”; from there, in the left-hand column, find and click on “Tags”.
- When the page loads, click on “New” to create a new tag, then :
- Name your Tag e.g tag_affilae (if you have existing Tags you can follow the nomenclature).
- Click in the “Tag configuration” table, then in the right-hand menu that appears, select “Custom HTML”.
- Copy and paste your Affilae Tag into the HTML field. You’ll find your script in your program configuration in the “Tracking” tab via the “Custom integration (Scripts)” section. Track clicks”.
The Affilae tag, which must be included on all the pages of your website (or landing pages), detects clicks from affiliated websites and protects you against click fraud.
Remarks :
- The affiliation tag on your website is different for each programme.
- The Affilae tag must be added to each page of your website, including the confirmation page.
- The Affilae tag must be added in the section head tag OR alternatively just after the opening body tag.
- Check 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/’
- Once the Tag has been installed and the “pid” filled in, click on the “Trigger” table, the menu of predefined triggers will appear, and all you have to do is select “All pages“.
- Save and send your changes.
Notes: On the label, don’t forget to update the _ae variable to match your program ID (for example, 5f03acf00000000000000000).
3- Add the Affilae Conversion Tag The Conversion Tag must be installed on the event or confirmation page for which you want to track conversions (e.g. sales, contact form…) and must only be triggered after the Affilae Tag. Before going any further, it’s a good idea to understand how user-defined variables work. You can find GTM documentation here. The Affilae Conversion Tag relies on User-Defined Variables, and these variables will need to be created by you using your site’s dataLayer. Each of the conversion data items required for the Tag to function correctly (event.Conversion.id, event.Conversion.amount…) must have a corresponding User-Defined Variable to ensure that conversion data is sent to Affilae. Variables: From your “Workspace in the left-hand column, find and click on “Variables“.
- When the page loads, find the “User-defined Variables” table and click on “New” to create a new Variable, then :
- Name your Variable e.g. dl_conversion_id (if you have existing Variables you can follow the nomenclature).
- Click on the “Variable configuration” table, then select “Data layer variable” from the right-hand menu.
- In the “Data layer variable name” field, enter your value from the data layer on the page of your site where the conversion is taking place.**
- For “Data layer version”, leave “Version 2”.
- Save and go on to create the next variable.
WARNING: When entering the “Data layer variable name”, as explained above, the value entered must correspond to the value found in the data layer. If the page where the Tag is triggered contains a dataLayer with 2 “id” values (common for ecommerce), you’ll need to specify the property path. Below is an example of a dataLayer found on an ecommerce site: if we’re looking for the conversion id, the result to enter into GTM would be: ecommerce.purchase.actionField.id
Trigger:Once you’ve created your variables, you’ll need to create the trigger for your Affilae Conversion Tag. To do this, from your “Workspace” in the left-hand column, find and click on “Triggers”.
- When the page loads, click on “New” to create a new Trigger, then :
- Name your trigger e.g. trigger_confirmation_page (if you have existing triggers, you can follow the nomenclature).
- Click in the “Trigger configuration” table, then in the right-hand menu that appears, select the type of trigger that best suits your needs. If you have a specific URL as a confirmation page, the “Window loaded” type would be the simplest choice.
- Save and go on to create your Affilae Conversion Tag.
Conversion tag: From your “Workspace”, in the left-hand column, find and click on “Tags”. in the left-hand column, find and click on “Tags”.
- When the page loads, click on “New” to create a new tag, then :
- Name your Tag e.g tag_affilae_conversion (if you have existing Tags you can follow the nomenclature).
- Click in the “Tag configuration” table, then in the right-hand menu that appears, select “Custom HTML”.
- Copy and paste your Affilae Conversion Tag into the HTML field, then fill in the Variables you’ve created for :
event.Conversion.id event.Conversion.amount Other data are optional and can be left blank using the empty string syntax (” “).
You’ll find your scriptin your program’s configuration in the “tracking” tab via the “Custom integration (Scripts)” section, “track conversions“.
- Once the Tag has been installed and the variables filled in, click on the “Trigger” table, the triggers menu will appear and all you have to do is select the Trigger you created in the previous step.
- Save and send your changes.
Your tracking configuration is now complete. Before launching your Affilae program, check that your configuration is working properly by carrying out test conversions to verify that the tags are triggered correctly, that the variables you’ve created are being tracked and that clicks and conversions are being tracked in the Affilae platform. The above steps need to be repeated for each Affilae program you create, as each program will have a different Program ID, but depending on your Affilae programs you could potentially re-use certain Variables and Triggers without having to create new ones.
Notes:
You can leave variables unused with empty strings.
You may have several tags to implement if your program includes more than one rule.
The key information to be sent with the conversion is a static value. This will be different for each rule created (e.g. 5f025b700000000000000000-5f0118000000000000000000). This information is available in the back-office.
Common problem: To push a conversion to our back-end, the Affilae Tag must be loaded before the conversion Tag. If the Conversion Tag is not triggered, and depending on your website and implementation, you may want to use the Loaded Window trigger. To add multiple trigger conditions, you need to create a trigger group. Again, this may change depending on your trigger strategy.
Note:
- The programme must be in Parameter.
Parameters to be entered :
Variable | Mandatory | Value |
---|---|---|
key | yes | The key is provided on the “conversion code” page accessible from the “Config” menu of your affiliate program. e.g. 5f04fe700000000000000000-5f04fe700000000000000000 |
id | yes | Fill this parameter with a unique identifier, the simplest being the order number.
If you’re using this code to subscribe to your newsletter and you don’t have a unique identifier, we advise you to use a Hash (e.g. MD5) from the surfer’s e-mail, for example. |
amount | Yes for sales | Total amount of the order, excluding VAT, which will be the basis for calculating the commission and sales generated. e.g. 123.45 |
payment | Yes if the conversion is linked to a payment | If conversions are subject to payment, specify the method chosen by your customer, otherwise leave blank:
|
customer | Yes, if Revenue Share is enabled | Customer ID if Revenue Share is enabled. Please use an identifier that will not change over time, the best being the ID number used in your database.
Leave blank if you don’t use Revenue Share. |
cv | No | Custom variable that will be returned with the conversion, and available in the interface and API. Allows you to assign your own identifier to a conversion. |
voucher | No | Variable used to identify the promo code associated with a sale. The code is case-sensitive. Use `;` as separator to add multiple codes. |
product | No | List of product IDs, separator `;`. |