Article

C2S – GTM – Manual

The manual integration means pasting your Affilae scripts into Custom HTML tags in Google Tag Manager. You keep full control over the code, and you install nothing from the template gallery.

This page covers the manual C2S (client-side) integration. Expect one click tag, one conversion tag, and as many variables as you have order data points to send.

Prerequisites: the URL format of your program must be set to Parameter. You change it in Program management > [your program] > Settings, section Global settings, field URL format. You also need a Google Tag Manager container you can publish to, and a dataLayer that exposes order data.

What to know before you start

  • The affiliate tag for your website is different for each program.
  • The Affilae tag must be added to every page of your site, including the confirmation page.
  • Check your CSP configuration before testing.
Warning: never send personal data in your variables, for example a first name, a last name or an email address.

CSP configuration (server-side)

"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/"

Install Google Tag Manager

Follow Google official documentation to install and configure the GTM container on your site: developers.google.com/tag-platform/tag-manager.

Add the Affilae tag (click tag)

  1. Log in to your GTM account, then open Workspace > Tags.
  2. Click New to create a tag.
  3. Name it, for example Affilae – Click Tag.
  4. In Tag Configuration, select Custom HTML.
  5. Paste your Affilae script, available in your program under Settings > tab Tracking > Custom integration (Script) > Track clicks.
  6. In Trigger, select All Pages.
  7. Save and publish.
Important: update the _ae variable with your program ID, for example 5f03acf00000000000000000.
Custom HTML tag holding the Affilae click script in Google Tag Manager
The click tag: Custom HTML type, Affilae script pasted in the HTML field, All Pages trigger.

Track conversions

Create the dataLayer variables

Create one variable per conversion data point you want to send.

Conversion ID

  1. Open Variables > New.
  2. Name: dl_conversion_id.
  3. Type: Data layer variable.
  4. Variable name: dl_conversion_id, depending on your dataLayer.
  5. Version: 2.

Amount excluding VAT

  1. Open Variables > New.
  2. Name: dl_conversion_amount.
  3. Type: Data layer variable.
  4. Variable name: dl_conversion_amount, depending on your dataLayer.
  5. Version: 2.

Additional variables, if necessary. Repeat for customer, payment, voucher, and so on.

Data layer variable created in Google Tag Manager
A data layer variable, with its dataLayer variable name and version 2.

Create the trigger

  1. Open Triggers > New.
  2. Name: purchase.
  3. Type: usually Purchase or Custom Event.
  4. Configuration: depending on your conversion event.
  5. Save.

Create the conversion tag

  1. Open Tags > New.
  2. Name it.
  3. Type: Custom HTML.

Retrieve the conversion script

  1. In Affilae, open Settings > tab Tracking > Custom integration (Script) > Track conversions.
  2. Copy the script.
  3. Configure the variables: replace the values with your GTM variables.
  4. In Trigger, select purchase.
  5. Save and publish.
Custom HTML tag holding the Affilae conversion script in Google Tag Manager
The conversion tag: the Affilae script, with every value replaced by a GTM variable, and the Purchase trigger.

Use the full variable path

The data layer variable name must be the full path, for example ecommerce.purchase.actionField.id. A shortened name returns no value.

Example dataLayer on an order confirmation page
Example dataLayer, where the order ID is nested under ecommerce.purchase.actionField.

Handle several Affilae programs

  • Create a new conversion tag for each program, each with a different KEY.
  • Reuse existing variables and triggers where appropriate.
  • Test each program individually.

Test before you go live

GTM Preview mode

  • Enable Preview mode, then add a tracked link.
  • Test a complete journey, from click to conversion.
  • Check that the tags are firing.

DataLayer variables

  • Check that your variables retrieve the correct values.
  • Test with live data.

In Affilae

  • Check that clicks are reported.
  • Check that conversions are reported.
  • Check the amounts and the data.
Tip: test in Preview mode first, then with a real order. Preview mode proves a tag fires, but only a real order proves the values sent are the right ones.

The other Google Tag Manager integrations

  • C2S – GTM – Templates: two ready-made templates from the GTM gallery, with no script to handle.
  • S2S – GTM: the conversion is validated server-side, with two containers talking to each other.

Related articles

Frequently asked
questions

Voir plus de questions reponses

In Affilae, open Settings, tab Tracking, then the Custom integration (Script) panel. It holds Track clicks then Track conversions, each with a copy button.

Check the Program_ID inside the _ae variable of your click tag. Also check that the tag fires on All Pages, and that your container has actually been published.

Check the dataLayer variables and the KEY in your conversion tag. Then make sure your trigger matches the real conversion event of your website.

Check the variable names in your dataLayer, they must match exactly. Mind the full path too: the data layer variable name reads for example ecommerce.purchase.actionField.id, not id alone.

Create one conversion tag per program, each with its own KEY. Existing variables and triggers can be reused. Then test each program separately.

Yes if your site enforces one. It must allow static.affilae.com and lb.affilae.com. The full line to copy is in the CSP configuration section of this page.

Templates are enough in most cases and update themselves from the gallery. Go manual when you need control over the script, for example to send data the templates do not cover.

Need help?

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

Contact Us