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:

  1. Navigate to Server-Side, Functions > Overview.
  2. Click + Add Function.
  3. Enter a name for the function.
  4. For the trigger, select Data Transformation, then click Continue.
  5. Enter a Trigger Name.
  6. 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.
  7. Select an Operator, and enter a Value.
    The Value is limited to 128 characters.
  8. Click + Add Condition to add an additional AND condition.
    A block of AND conditions is limited to 10 conditions.
  9. Click + OR to add a block of AND conditions.
    The number of OR condition blocks is limited to 10.
  10. Click Continue.
    Commented example code is displayed. You can modify this code, or replace it with your own function code.
  11. 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.
  12. 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:

trigger-conditions-create-edit.png

Create an event or visitor function

  1. Navigate to Server-Side, Functions > Overview.
  2. Click + Add Function.
  3. Enter a name for the function.
  4. Select a trigger: Processed Event, or Processed Visitor, then click Continue.
  5. 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.
  6. Click Continue.
    Commented example code is displayed. You can modify this code, or replace it with your own function code.
  7. 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.
  8. 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.

Was this page helpful?

This page was last updated: January 7, 2023