Article

S2S – GTM

The S2S mode switches your tracking links into redirection mode and validates the conversion on the server side. With Google Tag Manager it requires two containers, one client-side and one server-side, that talk to each other.

This page covers the full setup of both containers, from the linking tag to the Affilae – Server Side tag.

Prerequisites: the URL format of your program must be set to Server-to-Server (S2S). You change it in Program management > [your program] > Settings, section Global settings, field URL format. You also need a working server-side container and its domain, plus your Affilae key. Module version: 1.2.
Warning: never send personal data, for example a first name, a last name or an email address. Implementing a CMP remains mandatory.
Note: the conversion tag trigger must be set to an All Pages + Purchase event. This is where most setups go wrong.

Required architecture

You must have 2 GTM containers:

  • a Client-Side container;
  • a Server-Side container.

These two containers must communicate with each other.

Two Google Tag Manager containers, one client side and one server side
Both containers live in the same account, each with its own GTM ID.

Client-Side configuration

Create the Server-Side tag

In your Client-Side container:

  1. Go to Tags > New, then name the tag.
  2. Type: Google Tag Manager (Server-Side).
  3. Server-Side container Tag ID: GTM-XXXXXXX.
  4. Server URL: the variable holding your server-side domain.
Linking tag pointing to the server side container in Google Tag Manager
The linking tag, whose configuration settings point to the server-side domain variable.

How to find your Server-Side Tag ID

  1. Open your Server-Side container.
  2. Click Admin.
  3. Select Account Information.
  4. Copy the container ID, in the GTM-XXXXXXX format.

Configure the Server URL

  1. Go to Variables > New.
  2. Name: Affilae – Server Side.
  3. Value: your server-side domain, for example https://sgtm.yoursite.com.
Variable holding the server side container URL
The variable carries the full server-side container address, ending with a slash.

Trigger the tag

  1. Trigger: All Pages and Purchase.
  2. Save and publish.

Server-Side configuration

Create the Affilae Server-Side tag

In your Server-Side container:

  1. Go to Tags > New, then name the tag.
  2. As the tag type, search for Affilae – Server Side.
  3. If the type is not available, import the template from the gallery.

Create the required variables

Key, your Affilae key

  1. Go to Variables > New.
  2. Name: affilae_key.
  3. Value: your Affilae key, found in Settings > tab Tracking.

Amount, excluding tax

  1. Go to Variables > New.
  2. Name: conversion_amount.
  3. Event name: value, or according to your dataLayer.

Currency

  1. Go to Variables > New.
  2. Name: conversion_currency.
  3. Value: EUR, or your currency.

Fill in the Affilae tag

  • Key: {{affilae_key}}
  • Amount: {{conversion_amount}}
  • Currency: {{conversion_amount}}
To tick: the Allow Probabilistic Attribution option, at the bottom of the tag.

The trigger you must not miss

The trigger must be configured with the type All Pages + Purchase.

Affilae Server Side tag configured in the server side container
The Affilae – Server Side tag filled in, with Allow Probabilistic Attribution ticked and both triggers set.

How the two containers communicate

  • Client-Side sends data to the Server-Side.
  • Server-Side processes the data and sends it to Affilae.
  • Server-Side sends the confirmation back to the Client-Side.

To verify the link, enable Preview mode on both containers, test a full journey, and check that the data flows correctly.

Pre-launch checklist

  • Affilae program set to S2S mode.
  • Server-Side container functional.
  • Client-Side tag configured with the correct Tag ID.
  • Server-Side variables created.
  • Affilae – Server Side tag configured.
  • Allow Probabilistic Attribution enabled.
  • All Pages + Purchase trigger configured.

Tests to perform

  1. Disable your ad blockers.
  2. Enable GTM Preview mode on both containers.
  3. Test an affiliate click followed by a conversion.
  4. Check that data is transmitted between the containers.
  5. Check that the conversion is recorded in Affilae, with the right amount and currency.
Tip: keep both preview modes open side by side during your test. You then see immediately whether the problem sits in the client-side container, which sends nothing, or in the server-side container, which receives but does not forward.

The other Google Tag Manager integrations

Related articles

Frequently asked
questions

Voir plus de questions reponses

Yes. The Client-Side container collects on the site and forwards to the Server-Side container, which sends the conversion to Affilae and returns the confirmation. Without both, the conversion is not validated server-side.

Open your Server-Side container, click Admin, then Account Information. Copy the container ID, in the GTM-XXXXXXX format.

Verify the client to server link, then the All Pages + Purchase trigger. Next make sure S2S mode is enabled in Affilae and that the variables are correctly mapped. Finish with a test on a real order.

It must be ticked, at the bottom of the Affilae – Server Side tag. Leaving it unticked is one of the most common causes of missing conversions.

Import the template from the Community Template Gallery, then start creating your tag again. The type becomes selectable in the list.

Yes. Implementing a CMP remains mandatory, whatever tracking mode you choose.

This integration does not work. Set the URL format to Server-to-Server (S2S) in Settings, section Global settings. That setting is what switches your tracking links to redirection and allows server-side validation.

Need help?

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

Contact Us