Data transformation functions are invoked after an event is collected from the data source and before the event is processed and can be used for a variety of purposes, including the following:

  • Flattening the event object passed to the function.
  • Removing sensitive data, such as a phone number or an email address.
  • Modifying variables in the event object. For example, you can change variables to lower-case.
  • Populating variables in the event object based on other values.
  • Renaming variables, which is done by assigning the value to a different variable and deleting the original variable.

This article provides details on the TealiumEvent input parameter, as well as information on the flatten library. For examples of data transformation functions, see Functions Example Code.

In this article:

TealiumEvent Input Parameter

The following tables provide information on the TealiumEvent properties and data types.

TealiumEvent Properties

Property Type Description
account string Read-only. Account information.
client_ip string Read-only. Client IP address.
data EventData Read-only. See EventData Data Type.
dataSourcePlatform string Read-only. Name of the data source platform. See dataSourcePlatform Values.
enrichmentOnly Boolean Read-only. Always false for live events. If false DataAccess is enabled, the event can be sent to DataAccess. May be true for bulk import events (event.type equals "BULK_IMPORT"). If true, event data can be used only for enrichment.
env string Read-only. Specifies the execution environment (dev or prod).
event_id string Read-only. Event ID.
new_visitor Boolean Read-only. True if this is the first visit for the user, otherwise false.
page_url EventUrl Read-only. Omitted for mobile events. See EventURL Data Type.
post_time number Read-only. Time stamp for the event.
profile string Read-only. Profile for the account.
referrer_url EventUrl Read-only. Omitted for mobile events. See EventUrl Data Type.
type EventType

Read-only. See EventType Data Type.

useragent string Read-only. Specifies the software the user is using, such as the web browser.
visitor_id string Read-only.
_forwarding_visitor_ids string[] Read-only. Contains the IDs of the visitor(s) forwarding this event. Used in the visitor stitching process.


dataSourcePlatform Values

The value of the dataSourcePlatform property can be one of the following:


EventData Data Type

Property Type Description
dom Object Read-only. Contains information about the page on which the event occurred (domain, query string, etc.) Omitted for mobile events. For more information, see Data Layer.
firstparty_tealium_cookies Object Read-only. Omitted for mobile events. Object contains properties specified in your data layer.
js Object Read-only. Omitted for mobile events. Object contains properties specified in your data layer.
meta Object Read-only. Omitted for mobile events. Object contains properties specified in your data layer.
udo Object Writable. Object contains properties specified in your data layer. Some properties prefixed with "tealium_" can be modified. See below for details.

The data.udo object is writable and the some of the udo object properties can be modified, but cannot be deleted. The following udo object properties can be modified:

  • /data/udo/tealium_datasource
  • /data/udo/tealium_environment
  • /data/udo/tealium_event
  • /data/udo/tealium_firstparty_visitor_id
  • /data/udo/tealium_thirdparty_visitor_id
  • /data/udo/tealium_library_name
  • /data/udo/tealium_library_version
  • /data/udo/tealium_random
  • /data/udo/tealium_timestamp_epoch
  • /data/udo/tealium_timestamp_local
  • /data/udo/tealium_timestamp_utc
  • /data/udo/tealium_session_number

The following udo object properties cannot be modified:

  • /data/udo/tealium_cf_ttl
  • /data/udo/_dc_ttl_
  • /data/udo/platform
  • /data/udo/tealium_visitor_id
  • /data/udo/tealium_account
  • /data/udo/tealium_profile
  • /data/udo/tealium_session_id

EventType Data Type

Property Type Description
type "LIVE" | "BULK_IMPORT" Specifies whether the event is from a live visit or is a bulk import event (from file import or omnichannel import).

EventURL Data Type

Property Type Description
domain string Read-only. Domain of the URL.
full_url string Read-only. Full URL.
path string Read-only. Path from the URL. May be empty.
query_params Object Read-only. An Object that contains one or more key/value pairs. Each key/value pair specifies a query string in the URL. For example:
"query_params": {
"utm_medium": "PPC",
"utm_source": "LinkedIn"
querystring string Read-only. Query string from the URL.
scheme string Read-only. Specifies the protocol to use for the web site, such as HTTP or HTTPS.

View Throttling Information for Data Transformation Functions

Data transformation functions have the following execution limits:

  • 1 hour of execution time per minute OR
  • 250,000 invocations per minute (15 mm per hour)

When data transformation functions exceed these limits, a message is displayed in the Functions Overview and a yellow alert icon is displayed next to functions that have been throttled.


To view more detailed information for a throttled function, use the following steps:

  1. In the Functions Overview, click on a throttled function, then click the Monitoring tab.
  2. Click View Rate Limits Data.
  3. To adjust the time frame shown in the graph, select the number of hours or days to include in the graph.
  4. To view details for a log, click on a log file.
    The expanded view of the log shows the following information:
    • The type of limit that was exceeded.
    • The time throttling started and ended.
    • The number of dropped messages (the number of function invocations that were dropped).

flatten Library

The flatten library is a standard library that is imported in the default code for a data transformation function. This library provides the flatten() utility, which converts a nested Object into an Object that is not nested. flatten() returns an Object that contains strings and arrays of strings.

flatten() accepts two parameters, as follows:

flatten(target[, options])
  • target is the event Object passed to the data transformation function.
  • options is an Object that specifies how nested keys are handled during the conversion.

The options parameter contains the following properties:

Property Data Type Description
delimiter string, default is ".". Specifies the character used to combine parent and child property names.
prefix string, default is "".

The prefix is concatenated at the beginning of the new key name followed by the delimiter.

ignoreKeys string[], default is []. Specifies keys that should be omitted from the output.
replaceKeys Object {string}, default is {}. Specifies new names for keys using key/value pairs, where the key is the existing key in the object, and

The following examples show how the options properties are used. These examples use the following nested Object as the target to be flattened:

const object = {
  page: {
    id: 1
  user: {
    id: 1
  util: ["1", "2", "3"]


If delimiter is "_", the following object is returned:

  page_id: 1,
  util: ["1", "2", "3"]


If prefix is "fl", the following object is returned:

  "": 1,
  "": 1,
  "fl.util": ["1", "2", "3"]


If ignoreKeys is ["page", "util"], the following object is returned:

  "": 1


if replaceKeys is defined as follows:

const replaceKeys = {
  "user": "",
  "page": "p"

The following object is returned:

  "id": 1,
  "": 1,
  "util": ["1", "2", "3"]
}Data Transformation Function Examples

Example of Flattening a Complex Object

import flatten from 'tealium/util/flatten';

const options = {
  delimiter: "_",
  ignoreKeys: ["array_of_strings"],
  replaceKeys: {
    "number": "float",
    "array_of_objects": "modified_array_of_strings",
    "ordinal": ""
  prefix: "t"

const output = flatten({
  "boolean": true,
  "number": 12.34,
  "string": "value",
  "date": new Date(1631009413904),
  "array_of_strings": ["first", "second"],
  "array_of_arrays": [
    [1, 2],
    [3, 4]
  "array_of_objects": [{
    "ordinal": "first"
  }, {
    "ordinal": "second"
  "object": {
    "child_boolean": true,
    "child_number": 12.34,
    "child_string": "value",
    "child_array_of_strings": ["first", "second"],
    "child_array_of_arrays": [
      [1, 2],
      [3, 4]
    "child_object": {
      "gchild_boolean": true,
      "gchild_number": 12.34,
      "gchild_string": "value",
      "gchild_array_of_strings": ["first", "second"],
      "gchild_array_of_arrays": [
        [1, 2],
        [3, 4]
}, options);

The following object is returned by flatten():

  "t_boolean": "true",
  "t_float": "12.34",
  "t_string": "value",
  "t_date": "2021-09-07T10:10:13.904Z",
  "t_array_of_arrays": ["1","2","3","4"],
  "t_modified_array_of_strings": ["first","second"],
  "t_object_child_boolean": "true",
  "t_object_child_number": "12.34",
  "t_object_child_string": "value",
  "t_object_child_array_of_strings": ["first","second"],
  "t_object_child_array_of_arrays": ["1","2","3","4"],
  "t_object_child_object_gchild_boolean": "true",
  "t_object_child_object_gchild_number": "12.34",
  "t_object_child_object_gchild_string": "value",
  "t_object_child_object_gchild_array_of_strings": ["first","second"],
  "t_object_child_object_gchild_array_of_arrays": ["1","2","3","4"]

Additional Information