JENTIS Tag Manager Functions apply further logic to customize data to your implementations use case. These functions are put into use in tag configurations to be applied on certain variables (values). Useful to transform values before they are submitted in a tag, for example to shorten a string, put all characters to lower or upper case or hash the submitted value.
Client and Server Side Warning
Please be aware that the transformation functions use different runtimes and scopes based on the tags execution. If a tag is executed server side it is on an ES6 environment, capable resolving asynchronous functions. However client side code is more restricted. Beware to not use the same transformation function on both, server and client side tags.
Function Creation Process
Every function object has the following parameters:
Name: This is the value that will appear in the selection in a Tag configuration, here you should use a descriptive name.
ID: This is a technical reference that can be used to reference a function explicitly as this ID is unique per JTM account.
Description: Feel free to give your Function a description to later better understand the motivation to this application.
As a function is referenced in a tag to process and return a value you must define an input and output value. Make sure to use the following basic syntax, as any function must return a value.
var processed_value = input+1;
Server Side Transformation Functions
Any transformation function that runs server side has the full capability to run async-features, like `await` and `promise`.
Hence you must always declare the code to be async in the first line of code, if you intend to use async features. However that is optional, if no such feature is used.
//use await and promise if required
Client Side Transformation Functions
On client side executed transformation functions you can not use async features. Thus making the same transformation functions not applicable on both client and server side tags.