Create a function
This article provides instructions for creating a data transformation functions and event and visitor functions.
Create a data transformation function
Follow these steps to create a data transformation function:
- Navigate to Server-Side, Functions > Overview.
- Click + Add Function.
- Enter a name for the function.
- For the trigger, select Data Transformation, then click Continue.
- Enter a Trigger Name.
- Enter a Selector, which is a JSONPath expression (see JSONPath). For example,
$.datasourceId
or$.data.udo.tealium_event
.
The Selector is limited to 128 characters. - Select an Operator, and enter a Value.
The Value is limited to 128 characters. - Click + Add Condition to add an additional AND condition.
A block of AND conditions is limited to 10 conditions. - Click + OR to add a block of AND conditions.
The number of OR condition blocks is limited to 10. - Click Continue.
Commented example code is displayed. You can modify this code, or replace it with your own function code. - After testing the function, click the Configuration tab, change the Status to ON, and click Done.
For more information on testing functions, see Test Functions. - Save and publish.
The function is not saved, and cannot be triggered, until you save and publish. If you edit a function later on, make sure you save and publish for the changes to take effect.
When you save and publish after creating a data transformation function, it can take up to 300 seconds for the change to take effect.
Example of conditions for a data transformation function
To run a campaign for users whose purchase is more than $1000 and whose cart includes personal electronics products, the following conditions could be used:
Create an event or visitor function
- Navigate to Server-Side, Functions > Overview.
- Click + Add Function.
- Enter a name for the function.
- Select a trigger: Processed Event, or Processed Visitor, then click Continue.
- Configure the function, as follows:
- If you selected the Processed Event trigger, select an Event Feed.
- If you selected the Processed Visitor trigger, select an Audience.
- Click Continue.
Commented example code is displayed. You can modify this code, or replace it with your own function code. - After testing the function, click the Configuration tab, change the Status to ON, and click Done.
For more information on testing functions, see Test Functions. - Save and publish. The function is not saved, and cannot be triggered, until you save and publish. If you edit a function later on, make sure you save and publish for the changes to take effect.
This page was last updated: February 21, 2023