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 technical reference can explicitly reference a function, as this ID is unique per DCP.
Description: Feel free to describe your Function to better understand the motivation to this application later.
Javascript: This is the actual function code that you will define

As a function is referenced in a tag to process and return a value, you must define an input and output value. Use the following basic syntax, as any function must return a value.
Functions can only work with one input. Adding more variables in the tag edit view will concatenate the inputs into a single parameter.
async function(input){
var processed_value = input+1;
return processed_value;
}
Transformation Functions
Any transformation function that runs server-side can fully support async features like `await` and `promise`.
Hence, if you intend to use async features, you must always declare the code to be async in the first line of code.
async function _(input) {
// use await or promise if required
}
You can not use async features on client-side executed transformation functions, so the same transformation functions are not applicable to both client—and server-side tags.
Workaround for multiple arguments
If you need multiple input arguments, a possible workaround is to use a delimiter to concatenate the different variables and then split the information within the function.

function hashed_id_sha256(args) {
let params = args.split(':::');
let id = params[0];
let account = params[1];
if (['abc','cdf'].includes(account)) {
return this.tools.getSHA256(id);
}
return id;
}
Last updated
Was this helpful?