TMPL variables · syntax and escaping
TMPL variables inject dynamic values into the tags set up in the Eulerian TMS. You use them directly in the code of your custom tags (JavaScript, Image, Iframe, S2S) to pass data collected in real time to your partners: product reference, amount, user identifier, current URL. The tags that hold them are created in Eulerian Tag Manager (Client-side).
Tag syntax
There are two types of TMPL tag.
Self-closing tags · return a value:
<TMPL_VAR $var />
Opening/closing tags · used for loops and conditions:
<TMPL_IF $var> ... </TMPL_IF>
Both types follow standard XML syntax rules:
- The closing angle bracket of a self-closing tag is preceded by a
/:<balise /> - For opening/closing tags, the
/goes after the opening angle bracket of the closing tag:<balise>...</balise> - Attributes can be added inside a tag:
<balise attribut="valeur">...</balise>
Examples:
<!-- Self-closing tag with an attribute -->
<TMPL_VAR prdref ESCDQUOTE />
<!-- Control structure with a regular expression -->
<TMPL_IF cgip.codepromo REGEX('^(PM-)')> ... </TMPL_IF>
Escaping values
Depending on the context in which a tag returns content, some characters can cause syntax errors. Three escaping attributes are available on TMPL_VAR tags.
The problem · without escaping, the apostrophe in manteau d'hiver (French for “winter coat”) causes a JavaScript error:
// ERROR
var product_type = 'manteau d'hiver';
| Attribute | Context | Example |
|---|---|---|
ESCSQUOTE | Value in single quotes | var product_type = '<TMPL_VAR cgip.product_type ESCSQUOTE />' |
ESCDQUOTE | Value in double quotes | var product_type = "<TMPL_VAR cgip.product_type ESCDQUOTE />" |
ESCHTTP | Value in a URL | https://t.partenaire.com?type=<TMPL_VAR cgip.product_type ESCHTTP /> |
Simple macros
Generic parameter
| Tag | Description |
|---|---|
<TMPL_VAR cgip.xxx /> | Returns the value of any parameter passed in the collector tag. xxx must be the parameter key as it appears in the call (not in the source code). Applies to every Eulerian parameter, including those listed below. |
Conversion
| Tag | Description |
|---|---|
<TMPL_VAR ref /> | Unique reference of the conversion. Matches the ref parameter for a confirmation tag (quote/order), and actionref for historised conversion tracking. |
<TMPL_VAR amount /> | Total amount of the conversion including VAT. Matches the amount parameter of a quote or order confirmation tag. |
<TMPL_VAR amountexvat /> | Total amount of the conversion excluding VAT (sale or quote). Not available in the context of a started basket. |
<TMPL_VAR type /> | Conversion type. Matches the type parameter of a confirmation tag. |
<TMPL_VAR payment /> | Payment method. Matches the payment parameter of a sale tag. |
Current page
| Tag | Description | Example result |
|---|---|---|
<TMPL_VAR wsurl /> | Full URL of the current page, with the CGI parameters | http://www.site.com/page?param1=val |
<TMPL_VAR wsurlpath /> | Original path of the page, with no processing or renaming rule applied | - |
<TMPL_VAR wspath /> | Name of the page after processing and renaming rules, if configured | - |
Products
These tags return the data of the first product passed in the tag. To retrieve every product, use the prdloop loop.
| Tag | Description | Multi-product loop |
|---|---|---|
<TMPL_VAR prdref /> | Reference of the first product (prdref) | <TMPL_LOOP prdloop><TMPL_VAR prdref /></TMPL_LOOP> |
<TMPL_VAR prdname /> | Name of the first product (prdname) | <TMPL_LOOP prdloop><TMPL_VAR prdname ESCDQUOTE /></TMPL_LOOP> |
<TMPL_VAR prdamount /> | Amount of the first product including VAT (prdamount) | <TMPL_LOOP prdloop><TMPL_VAR prdamount /></TMPL_LOOP> |
<TMPL_VAR prdamountexvat /> | Amount of the first product excluding VAT (prdamount) | <TMPL_LOOP prdloop><TMPL_VAR prdamountexvat /></TMPL_LOOP> |
<TMPL_VAR prdqty /> | Quantity of the first product (prdqty) | <TMPL_LOOP prdloop><TMPL_VAR prdqty /></TMPL_LOOP> |
<TMPL_VAR prds_pv.xxx /> | Value of the product category xxx passed through prdparam-xxx. Without a loop, returns the value of the last product only. E.g. <TMPL_VAR prds_pv.marque ESCDQUOTE /> | <TMPL_LOOP prdloop><TMPL_VAR prd_pv.xxx /></TMPL_LOOP> (note prd_pv without the s in the loop) |
<TMPL_VAR prdnb /> | Number of unique products. E.g. 3×A + 2×B → 2 | - |
<TMPL_VAR prdcnt /> | Total number of products. E.g. 3×A + 2×B → 5 | - |
User identifiers
| Tag | Description |
|---|---|
<TMPL_VAR email /> | The user’s email. Can be stored in the session and returned even if the user is not logged in. |
<TMPL_VAR uideah /> | Encrypted internal Eulerian ID of the current visitor. Based on first-party tracking and the Eulerian fingerprint. |
<TMPL_VAR uidsession /> | Eulerian session ID, unique per visit and per visitor. |
<TMPL_VAR uidws /> | CRM ID of the current visitor. Matches the value of the uid parameter passed to the tag. |
<TMPL_VAR uidwsh /> | CRM ID of the current visitor, hashed by Eulerian. |
<TMPL_VAR visitnb /> | Total number of the user’s visits since collection began. |
Partner IDs
| Tag | Description |
|---|---|
<TMPL_VAR eparam /> | Partner ID retrieved through the &eparam=ID_PARTENAIRE parameter in an Eulerian tracking link. Each new value overwrites the previous one, so it is not suited to use with several partners. Prefer mtuid. |
<TMPL_VAR mtuid /> | Partner ID retrieved through tracking URLs or cookie matching (Eulerian Real Time Data), see Partner publishers: storing and reusing partner IDs. Unlike eparam, each partner has its own database and the values do not overwrite each other. The one to favour. |
<TMPL_VAR dcuid /> | Equivalent of mtuid for S2S connectors. Returns the last partner ID collected. |
<TMPL_VAR dccduid /> | Same as dcuid, but returns the partner ID of the current device (not the last one collected). |
Date and time
| Tag | Format | Example |
|---|---|---|
<TMPL_VAR year /> | YYYY | 2024 |
<TMPL_VAR month /> | MM | 03 |
<TMPL_VAR day /> | DD | 15 |
<TMPL_VAR hour /> | HH | 14 |
<TMPL_VAR minute /> | MM | 32 |
<TMPL_VAR second /> | SS | 07 |
<TMPL_VAR epoch /> | Unix timestamp | 1710507127 |
Random values
| Tag | Description |
|---|---|
<TMPL_VAR rand /> | Random number generated when the page loads. The value is the same for every tag on a page. For a number unique to each tag, use mtrand. |
<TMPL_VAR mthrand /> | Random value that is unique each time the tag is used. |
Geolocation and technical context
| Tag | Description | Example |
|---|---|---|
<TMPL_VAR geocountry /> | Country code in capitals | FR, IT |
<TMPL_VAR georegion /> | Region code | - |
<TMPL_VAR geoloc /> | Country code + region code combined | FRA8 |
<TMPL_VAR os /> | The user’s operating system | - |
<TMPL_VAR browser /> | Browser and its version | Firefox 26.00 |
<TMPL_VAR lang /> | Browser language in capitals | FR, EN |
<TMPL_VAR isp /> | Internet service provider | - |
<TMPL_VAR ip /> | The user’s IPv4 address | - |
<TMPL_VAR ip6 /> | The user’s IPv6 address | - |
<TMPL_VAR dnt /> | Do Not Track switched on in the browser | 1 = yes, 0 = no |
<TMPL_VAR devicetype /> | Device type | Smartphone, Desktop, Tablet |
<TMPL_VAR cgip.cur /> | Transaction currency | EUR, USD |
Custom parameters
| Tag | Description | Example |
|---|---|---|
<TMPL_VAR iduserparam.NOM_PARAMETRE /> | Value of a first-party user parameter | iduserparam.birthdate, iduserparam.gender, iduserparam.optin |
<TMPL_VAR np_NOM_PARAMETRE /> | Value of a partner parameter in a partner tag | np_account |
User profile
| Tag | Description |
|---|---|
<TMPL_VAR profilesession /> | ID of the user profile for the current session |
<TMPL_VAR profileglobal /> | ID of the global user profile (all sessions) |
<TMPL_VAR profilesessiontxt /> | Label of the user profile for the current session |
<TMPL_VAR profileglobaltxt /> | Label of the global user profile |
Ad-centric parameters
The Activation module (native/custom tags and S2S calls) can send ad-centric data through the following macros. These keys can be used:
- in S2S / TMS data exports for real-time connectors to BI tools
- in the userdatass API to extract marketing attribution information
Available macros
| Tag | Description | Example |
|---|---|---|
<TMPL_VAR channelc /> | Channel abbreviation | ad |
<TMPL_VAR channelt /> | Touchpoint type | c |
<TMPL_VAR channelpubtxt /> | Publisher name | support |
<TMPL_VAR channelopetxt /> | Campaign name | campagne-brand-fil-rouge |
<TMPL_VAR channelsengtxt /> | SEO search engine | Bing |
<TMPL_VAR channelsengkwtxt /> | SEO keyword | marque |
<TMPL_VAR channelrfdomtxt /> | Ad-centric referring domain | https://... |
<TMPL_VAR channelrfdomuritxt /> | Ad-centric referring URI | /page |
<TMPL_VAR channelloctxt /> | Placement name | support-160x600 |
<TMPL_VAR channelcreatxt /> | Banner name | 150316-fr-brand |
<TMPL_VAR channelslkw /> | SEM keyword | parfum voiture neuve |
<TMPL_VAR channelsikey /> | Incoming segment | segmentation |
<TMPL_VAR channelsival /> | Incoming sub-segment | chaud |
<TMPL_VAR channelslcamptxt /> | SEM campaign | Marque-Bing |
<TMPL_VAR channelsladgrouptxt /> | Ad group | marque |
<TMPL_VAR channelclickid /> | Click ID of the current marketing touchpoint (150 characters max) | - |
Attribution views
The view.X.clé syntax retrieves the data of a specific attribution view, where X is the index of the view (0 = last channel).
| Tag | Description | Example |
|---|---|---|
<TMPL_VAR view.0.media /> | Short name of the media for the last-channel attribution view | ml, sf, ad |
<TMPL_VAR view.3.pub /> | Publisher ID for attribution view no. 3 | 13492 |
Note
Other keys can be queried for each view. Contact your Eulerian team for the full list.
Product loops (prdloop)
By default, <TMPL_VAR prdref /> returns only the reference of the first product passed in the collector tag. To retrieve every product in an order or a basket, you need the prdloop loop.
The basics
<TMPL_LOOP prdloop>
<TMPL_IF idx>SÉPARATEUR</TMPL_IF>
<TMPL_VAR prdref />
</TMPL_LOOP>
What <TMPL_IF idx> does · the idx condition is true for every product except the first. It inserts a separator between products without adding one before the first.
Without idx, you would get ;BV6543;VR7844;VR3321: the leading ; would be superfluous and could cause a JavaScript error.
The <TMPL_VAR prd_pv.xxx /> tag works the same way for product categories (matching the prdparam-xxx parameters in the collector tag).
Important
<TMPL_IF idx>must always come before the content to pass on.
Product references separated by a comma
Data in the collector tag:
EA_push(["prdref", "A5435", "prdref", "B7553", "prdref", "C9873"]);
Macro:
<TMPL_LOOP prdloop>
<TMPL_IF idx>,</TMPL_IF>
<TMPL_VAR prdref />
</TMPL_LOOP>
Result:
A5435,B7553,C9873
References, amounts and quantities
Data in the collector tag:
EA_push([
"scart", "1",
"prdref", "A5435", "prdamount", "10.00", "prdquantity", "1",
"prdref", "B7553", "prdamount", "15.00", "prdquantity", "2",
"prdref", "C9873", "prdamount", "12.00", "prdquantity", "3"
]);
Macro · products are separated by |, fields by ,:
<TMPL_LOOP prdloop>
<TMPL_IF idx>|</TMPL_IF>
<TMPL_VAR prdref />,<TMPL_VAR prdamount />,<TMPL_VAR prdqty />
</TMPL_LOOP>
Result:
A5435,10.00,1|B7553,15.00,2|C9873,12.00,3
References with product categories
Data in the collector tag:
EA_push([
"prdref", "A5435", "prdparam-categorie", "pantalon", "prdparam-taille", "43",
"prdref", "B7553", "prdparam-categorie", "chemise", "prdparam-taille", "40",
"prdref", "C9873", "prdparam-categorie", "veste", "prdparam-taille", "43"
]);
Macro · using prd_pv.xxx for the categories:
<TMPL_LOOP prdloop><TMPL_IF idx>|</TMPL_IF><TMPL_VAR prdref />:<TMPL_VAR prd_pv.categorie />:<TMPL_VAR prd_pv.taille /></TMPL_LOOP>
Result:
A5435:pantalon:43|B7553:chemise:40|C9873:veste:43
Grand total (amount × quantity)
This macro calculates the order total by multiplying each amount by its quantity.
Data in the collector tag:
EA_push([
"prdamount", "10", "prdqty", "3", // 10 × 3 = 30
"prdamount", "25", "prdqty", "1", // 25 × 1 = 25
"prdamount", "15", "prdqty", "2" // 15 × 2 = 30
]);
Macro · TMPL_UNLESS with REGEX('^1$') avoids printing 1 * when the quantity is 1:
<TMPL_LOOP prdloop> +(<TMPL_UNLESS prdqty REGEX('^1$')><TMPL_VAR prdqty /> * </TMPL_UNLESS><TMPL_VAR prdamount />)</TMPL_LOOP>
Result:
85
Replace one value with another
If you retrieve the value nouveau_client in the custom parameter type_client and your partner expects the value NC:
<TMPL_IF cgip.type_client REGEX("nouveau_client")>NC</TMPL_IF>
Result:
NC
This technique saves you creating two separate tags to handle the value sent to the partner dynamically.
User loops and audience segments
These loops retrieve user parameters and/or audiences when a tag fires.
All the loops share the same basic structure, with <TMPL_IF idx> to handle the separator:
<TMPL_LOOP NOM_BOUCLE><TMPL_IF idx>,</TMPL_IF>"<TMPL_VAR key />":"<TMPL_VAR val />"</TMPL_LOOP>
Parameters available in the loops
| Parameter | Description |
|---|---|
<TMPL_IF idx> | Inserts the separator before every item except the first |
<TMPL_VAR key /> | ID or name of the user-centric parameter (or of the audience) |
<TMPL_VAR val /> | Value of the user-centric parameter (or of the segment) |
First-party user parameters
<TMPL_LOOP iduserparamloop><TMPL_IF idx>,</TMPL_IF>"<TMPL_VAR key />":"<TMPL_VAR val />"</TMPL_LOOP>
Returns the IDs and values of the user-centric parameters collected first-party.
Result:
"5":"10","AGE":"25-30ans"
Second- or third-party user parameters
<TMPL_LOOP partneruserparamloop><TMPL_IF idx>,</TMPL_IF>"<TMPL_VAR key />":"<TMPL_VAR val />"</TMPL_LOOP>
Returns the IDs and values of the user-centric parameters that come from a Data provider (second or third party).
Result:
"2":"15","CODE_POSTAL":"75001"
Audience segments
<TMPL_LOOP clusternameloop><TMPL_IF idx>,</TMPL_IF>"<TMPL_VAR key />":"<TMPL_VAR val />"</TMPL_LOOP>
Returns the names of the audiences and the names of the segments they contain.
Result:
"PROFIL":"BUYER"
Audience segments from a Master DMP
To query the audiences of a specific site in a Master DMP, the loop syntax includes the site ID + the first 4 letters of the site name.
<TMPL_LOOP id+site(4)_clusternameloop><TMPL_IF idx>,</TMPL_IF>"<TMPL_VAR key />":"<TMPL_VAR val />"</TMPL_LOOP>
Example for a site with id=23 and nom=my-website:
<TMPL_LOOP 23my-w_clusternameloop><TMPL_IF idx>,</TMPL_IF>"<TMPL_VAR key />":"<TMPL_VAR val />"</TMPL_LOOP>
Returns the names of the audiences and the names of the segments they contain, limited to the targeted site.
Internal search engine parameters
<TMPL_VAR isengineparam.KEY />
Returns the value of the search parameter matching the specified KEY.
Example · with the following data in the collector tag:
EA_push(["isearchkey", "destinations", "isearchdata", "sea"]);
The <TMPL_VAR isengineparam.destinations /> macro returns:
sea
TMPL_MOD · Escape or encode a block
To escape a whole block of content (rather than a single variable), use <TMPL_MOD> with the option you need.
<TMPL_MOD ESCHTTP>http://sub.domain.tld/page?param1=1¶m2=2</TMPL_MOD>
Result:
http%3a//sub.domain.tld/directory/page%3fparam1%3d1%26param2%3d2
Available hashing and encoding algorithms
| Attribute | Format | Example result |
|---|---|---|
MD5 | 32-char hexadecimal | 900150983cd24fb0d6963f7d28e17f72 |
SHA224LX | SHA-224 lower case | 23097d223405d8228642a477bda255b3... |
SHA224UX | SHA-224 upper case | 23097D223405D8228642A477BDA255B3... |
SHA224B64 | SHA-224 base64 | Iwl9IjQF2CKGQqR3vaJVsyqtvOS9oLP342ydpw== |
SHA256LX | SHA-256 lower case | ba7816bf8f01cfea414140de5dae2223... |
SHA256UX | SHA-256 upper case | BA7816BF8F01CFEA414140DE5DAE2223... |
SHA256B64 | SHA-256 base64 | ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0= |
SHA384LX | SHA-384 lower case | cb00753f45a35e8bb5a03d699ac65007... |
SHA384UX | SHA-384 upper case | CB00753F45A35E8BB5A03D699AC65007... |
SHA384B64 | SHA-384 base64 | ywB1P0WjXou1oD1pmsZQBycsMqsO3tFjGotgWkP/W+... |
SHA512LX | SHA-512 lower case | ddaf35a193617abacc417349ae204131... |
SHA512UX | SHA-512 upper case | DDAF35A193617ABACC417349AE204131... |
SHA512B64 | SHA-512 base64 | 3a81oZNherrMQXNJriBBMRLm+k6JqX6iCp7u5ktV05o... |
BASE64 | Standard Base64 | PFRNUExfTU9EIEJBU0U2ND5CQVNFNjQ8L1RNUExfTU9EPg== |
ESCHTTP | URL encoding | http%3a//sub.domain.tld/... |
Usage examples:
<!-- Hash the email in lower-case SHA-512 -->
<TMPL_MOD SHA512LX><TMPL_VAR email /></TMPL_MOD>
<!-- Encode a URL block -->
<TMPL_MOD ESCHTTP>https://www.monsite.com/page?param=valeur</TMPL_MOD>
Conditions
IF / ELSE
TMPL_IF prints its content only if the condition is true. TMPL_ELSE takes over if it is false.
<TMPL_IF orderestimate>
var type = "conversion";
<TMPL_ELSE>
var type = "view";
</TMPL_IF>
IF / UNLESS
TMPL_UNLESS is the opposite of TMPL_IF: its content is printed if the condition is false. The two are interchangeable with IF/ELSE:
<TMPL_IF orderestimate>
var type = "conversion";
</TMPL_IF>
<TMPL_UNLESS orderestimate>
var type = "view";
</TMPL_UNLESS>
Available native conditions
| Condition | Description |
|---|---|
order | The current page contains a sale confirmation tag |
estimate | The current page contains a quote confirmation tag |
orderestimate | The current page is a sale or quote tag |
scart | The current page contains a started basket tag |
prdref | The current page contains one or more prdref parameters |
homepage | The current page is the site’s homepage (declared when the site was created) |
cgip.XXXXX | Tests whether the native or custom parameter XXXXX is passed in the collector tag |
Nested conditions · a full example
This structure is the most common one in Eulerian’s native templates. It fires the right type of tag on each page without duplicating any call.
<TMPL_IF orderestimate>
// Confirmation tag (sale or quote)
</TMPL_IF>
<TMPL_UNLESS orderestimate>
<TMPL_IF scart>
// Started basket tag
</TMPL_IF>
<TMPL_UNLESS scart>
<TMPL_IF prdref>
<TMPL_UNLESS cgip.prdr1>
// Product tag (a single product)
</TMPL_UNLESS>
<TMPL_IF cgip.prdr1>
// Category tag (several products)
</TMPL_IF>
</TMPL_IF>
<TMPL_UNLESS prdref>
<TMPL_IF homepage>
// Homepage tag
</TMPL_IF>
</TMPL_UNLESS>
</TMPL_UNLESS>
</TMPL_UNLESS>
Why TMPL_UNLESS scart and TMPL_UNLESS orderestimate? A basket page with products always satisfies <TMPL_IF prdref>. Without an explicit exclusion, the product tag would also fire on the basket page. These conditions prevent double calls.
Why cgip.prdr1 to tell a product from a category? Each prdref passed in the tag is automatically re-indexed from 0 (prdr0, prdr1, prdr2…). Testing for prdr1 checks that there are at least 2 products · the hallmark of a category page.
Additional attributes
These attributes go directly inside TMPL tags to change their content on the fly.
REGEX · Conditions based on a regular expression
Used in TMPL_IF or TMPL_UNLESS to test a variable’s value against a regular expression.
<TMPL_IF cgip.profile REGEX("newcustomer")> var _pt_newcus = 1; </TMPL_IF>
<TMPL_UNLESS cgip.profile REGEX("newcustomer")> var _pt_newcus = 0; </TMPL_UNLESS>
This technique saves you creating two separate tags: the value of _pt_newcus is handled dynamically in a single template.
Syntax: REGEX("ARG1") · ARG1 is the regular expression to test.
SREGEX · Transform the returned value
Used in TMPL_VAR to capture and reformat a variable’s value dynamically. Capture groups are wrapped in brackets and reused with $1, $2, etc.
<!-- Product reference: SX12345F453 -->
<TMPL_VAR prdref SREGEX("SX(.*)","$1") />
<!-- Result: 12345F453 -->
<TMPL_VAR prdref SREGEX("SX(.*?)F(.*)","$1$2") />
<!-- Result: 12345453 -->
<TMPL_VAR prdref SREGEX("SX(.*)","VR$1") />
<!-- Result: VR12345F453 -->
<!-- Amount: 23.50, converting the decimal point to a comma -->
<TMPL_VAR prdamount SREGEX("(.*)\.(.*)","$1,$2") />
<!-- Result: 23,50 -->
Tip
You can chain several
SREGEXin the same tag to transform the value in several steps.
Syntax: SREGEX("ARG1","ARG2") · ARG1 is the regular expression, ARG2 the output format.
STRFTIME · Format a timestamp
Converts a timestamp into a readable date format.
<TMPL_VAR epoch STRFTIME('%Y-%m-%d %H:%M:%S', 'Europe/Paris') />
Syntax: STRFTIME("ARG1","ARG2") · ARG1 is the POSIX format you want, ARG2 the time zone.
MATH + PRECISION · Arithmetic operations
Performs a mathematical operation on the value of a numeric variable. PRECISION rounds the result.
<!-- Apply a 20% discount and round to 2 decimal places -->
<TMPL_VAR prdamount MATH("*","0.80") PRECISION("2") /> €
<!-- Result: 16,00 € -->
Syntax: MATH("ARG1","ARG2") · ARG1 is the operator (*, /, +, -), ARG2 the value to apply.
LT / LE / GE / GT · Numeric comparisons
Used in TMPL_IF to compare a numeric value.
| Attribute | Meaning | Example |
|---|---|---|
LT(n) | Strictly less than n | <TMPL_IF vtest LT(10)> Inf 10 </TMPL_IF> |
LE(n) | Less than or equal to n | <TMPL_IF vtest LE(10)> Inf/EQ 10 </TMPL_IF> |
GE(n) | Greater than or equal to n | <TMPL_IF vtest GE(10)> Sup/EQ 10 </TMPL_IF> |
GT(n) | Strictly greater than n | <TMPL_IF vtest GT(10)> Sup 10 </TMPL_IF> |
BASE64 · Encode in base64
Encodes a variable’s value in base64.
<TMPL_VAR prdref BASE64 />
<!-- Reference: ref-123456789 → Result: cmVmLTEyMzQ1Njc4OQ== -->
CONTEXT FLAG · Loop over Context Flags
Retrieves the Context Flags associated with the current page.
Note
This loop requires the “Context-Flag: authorize values in templates (TMPL_LOOP cflag)” option to be switched on in the site options.
<TMPL_IF cflag>
<TMPL_LOOP cflag>
<TMPL_IF idx>,</TMPL_IF>
<!-- your variables here -->
</TMPL_LOOP>
</TMPL_IF>
Variables available in the loop:
| Variable | Description |
|---|---|
<TMPL_VAR idx /> | Iteration index |
<TMPL_VAR key /> | Context Flag key |
<TMPL_VAR keytxt /> | Key label |
<TMPL_VAR cat /> | Context Flag category |
<TMPL_VAR cattxt /> | Category label |
<TMPL_VAR inc /> | Number of increments |
<TMPL_VAR tmd /> | Timestamp of the last change |
<TMPL_VAR aged /> | Age |
<TMPL_VAR current /> | 1 if the flag is active on the current page, 0 otherwise |
TMPL_FLAG · Control output formatting
Switches certain template formatting behaviours on or off.
Syntax:
<TMPL_FLAG $flag /> <!-- Switch on -->
<TMPL_FLAG !$flag /> <!-- Switch off -->
Available flags:
| Flag | Default state | Description |
|---|---|---|
DELCARRIAGERET | On | Removes carriage returns from the output |
DELEMPTYLINE | On | Removes empty lines from the output |
These flags go at the start of the template. They are especially useful for S2S connectors that expect a structured payload with line breaks.
Example · sending a CSV file through S2S with carriage returns preserved:
<TMPL_FLAG !DELCARRIAGERET />
https://my-custom-endpoint.com/segments/eulerian?HDR_CUSTOM_X-API-KEY=some_api_key&POST_CTYPE=csv&POST_DATA=
id_visiteur;valeur;segment;expiration
<TMPL_VAR dcuid ESCHTTP />;EA_value_7;EA_test_segment_7;