How do I use custom variables in S2S or JS?
Custom variables enrich partner tags or server-to-server (S2S) connectors with information specific to your implementation. You create them from a custom JavaScript script, then call them with the <TMPL_VAR jsvar.$NOM_VAR /> macro in two activation contexts:
- partner tags configured in the Eulerian Tag Management System (TMS);
- S2S connectors.
You can also use predefined variables in the custom variable’s script. These variables pass on parameters from your ad-centric, site-centric or user-centric integration.
How custom variables work
Once created, a custom variable is called with the following macro:
<TMPL_VAR jsvar.$NOM_VAR />
In this macro, replace $NOM_VAR with the name of the custom variable you configured. For example, if the custom variable is called montantHT, you call it with <TMPL_VAR jsvar.montantHT />.
You can then use this macro in a partner tag or in an S2S connector to pass the variable’s value to the partner automatically.
For the full list of variables available in TMPL_VAR format, see TMPL variables · syntax and escaping.
Add a custom variable
Where to go: Activate > Connector configuration > Custom variables

Then click Add.
Setting to fill in
| Setting | Description |
|---|---|
| Name | Enter the name of the custom variable. Any name is allowed. |
Write the JavaScript integration script
Once the variable is created, you need to write the JavaScript integration script.

The script must follow JavaScript syntax.
You can add predefined variables to the script by clicking Insert a predefined variable. These variables contain, among other things, parameters from:
- your site’s data;
- your channels;
- your configured audiences.
Once the script is written, you need to activate the custom variable by setting Active to Yes.
Note
Before you activate a custom variable, have your dedicated Account Manager check that it is integrated correctly: am@eulerian.com.
Integration in the TMS
Your custom variable is now available in the Eulerian TMS, in the partner tag configuration.
Where to go: Activate > Tag management system
In a partner tag’s details, you add custom variables in the Custom parameters panel. You can add a custom variable to a partner tag in two ways:
- by selecting the custom variable from the list of available variables;
- or by using the variable’s macro directly,
<TMPL_VAR jsvar.montantHT />for a variable namedmontantHT.
The variable’s value is then injected automatically into the partner tag when it fires.
Server-to-server integration
Where to go: Activate > S2S
In an S2S partner connector’s details, you add custom variables in the Custom parameters panel. As with the TMS, you can add a custom variable to the connector from the list of available variables, or call it directly with its macro <TMPL_VAR jsvar.$NOM_VAR />.
This macro passes the custom variable’s value to the partner as part of the server-to-server call. Once configured, the variable is passed automatically to the partner within the S2S connector.