Overview

A Mapping provides instructions for our platform to translate an input value into an output value. The output value is what our system will forward along to the integration.

Mapping transforms will apply some logic to the input value in order to create the desired output. The only mapping type where this does not apply is the Direct Assign mapping, which will translate an input to an output with no logic applied to the input value.

Mapping Types

The below mappings are available to select in the MetaRouter UI and represent transformation logic that can be applied to input values. The result of the input and applied transformation logic is the output field.

Direct Assign

A Direct Assign mapping will not apply any transformation on the input value. The input value will be transformed into the output value exactly as we receive it.

Example

1806

Considering the following analytics.js event triggered:

analytics.track('Order Completed', {
    "order_id": "TR1234567890",
  "total": "27.5",
  "shipping": 2.5,
  "products": [
    {
      "product_id": "1111111111",
      "name": "Product Name 1",
      "price": 19,
      "quantity": 1,
      "brand": "Product Brand 1"
    },
    {
      "product_id": "2222222222",
      "name": "Product Name 2",
      "price": 3,
      "quantity": 2,
      "brand": "Product Brand 2"
    }
  ]
});

The above example will add to the output event the following key:value pair:

transactionId: "TR1234567890"

To Float

A To Float mapping will transform the input value into a float.

Example

1804

Considering the following analytics.js event triggered:

analytics.track('Order Completed', {
    "order_id": "TR1234567890",
  "total": "27.5",
  "shipping": 2.5,
  "products": [
    {
      "product_id": "1111111111",
      "name": "Product Name 1",
      "price": 19,
      "quantity": 1,
      "brand": "Product Brand 1"
    },
    {
      "product_id": "2222222222",
      "name": "Product Name 2",
      "price": 3,
      "quantity": 2,
      "brand": "Product Brand 2"
    }
  ]
});

The above example will add to the output event the following key:value pair:

value: 27.5

To Truncated Integer

A To Truncated Integer mapping will transform the input value into a float, then will truncate it into an integer, removing all decimals if any exist.

Example

1808

Considering the following analytics.js event triggered:

analytics.track('Order Completed', {
    "order_id": "TR1234567890",
  "total": "27.5",
  "shipping": 2.5,
  "products": [
    {
      "product_id": "1111111111",
      "name": "Product Name 1",
      "price": 19,
      "quantity": 1,
      "brand": "Product Brand 1"
    },
    {
      "product_id": "2222222222",
      "name": "Product Name 2",
      "price": 3,
      "quantity": 2,
      "brand": "Product Brand 2"
    }
  ]
});

The above example will add to the output event the following key:value pair:

"value": 27

To Rounded Integer

A To Rounded Integer mapping will transform the input value into a float, then will round it into an integer, following the mathematical rounding the MetaRouter platform performs.

Example

1808

Considering the following analytics.js event triggered:

analytics.track('Order Completed', {
    "order_id": "TR1234567890",
  "total": "27.5",
  "shipping": 2.5,
  "products": [
    {
      "product_id": "1111111111",
      "name": "Product Name 1",
      "price": 19,
      "quantity": 1,
      "brand": "Product Brand 1"
    },
    {
      "product_id": "2222222222",
      "name": "Product Name 2",
      "price": 3,
      "quantity": 2,
      "brand": "Product Brand 2"
    }
  ]
});

The above example will add to the output event the following key:value pair:

"value": 28

Truncate Float

A To Truncated Float mapping will transform the input value into a float, then will truncate it into an integer based on the provided precision value.

Example

1808

Considering the following analytics.js event triggered:

analytics.track('Order Completed', {
    "order_id": "TR1234567890",
  "total": "27.5",
  "shipping": 2.5,
  "products": [
    {
      "product_id": "1111111111",
      "name": "Product Name 1",
      "price": 19,
      "quantity": 1,
      "brand": "Product Brand 1"
    },
    {
      "product_id": "2222222222",
      "name": "Product Name 2",
      "price": 3,
      "quantity": 2,
      "brand": "Product Brand 2"
    }
  ]
});

The above example will add to the output event the following key:value pair:

"value": 27.5

To Boolean

A To Boolean mapping will transform the input value into a boolean.

Example

1808

Considering the following analytics.js event triggered:

analytics.track('Order Completed', {
  "homepage": "false",
    "order_id": "TR1234567890",
  "total": "27.5",
  "shipping": 2.5,
  "products": [
    {
      "product_id": "1111111111",
      "name": "Product Name 1",
      "price": 19,
      "quantity": 1,
      "brand": "Product Brand 1"
    },
    {
      "product_id": "2222222222",
      "name": "Product Name 2",
      "price": 3,
      "quantity": 2,
      "brand": "Product Brand 2"
    }
  ]
});

The above example will add to the output event the following key:value pair:

"homepage": false

To Hash

A To Hash mapping will transform the input value by applying a Hash function on it.

Available Hash functions:

  • MD5
  • SHA256

The resulting data type is a string.

MD5 Hash Example

1808

Considering the following analytics.js event triggered:

analytics.track('Order Completed', {
    "order_id": "TR1234567890",
  "total": "27.5",
  "shipping": 2.5,
  "products": [
    {
      "product_id": "1111111111",
      "name": "Product Name 1",
      "price": 19,
      "quantity": 1,
      "brand": "Product Brand 1"
    },
    {
      "product_id": "2222222222",
      "name": "Product Name 2",
      "price": 3,
      "quantity": 2,
      "brand": "Product Brand 2"
    }
  ]
});

The above example will add to the output event the following key:value pair:

"transaction": "8a73740cfc773729af721c6ce0154b1f"

SHA256 Hash Example

1806

Considering the following analytics.js event triggered:

analytics.track('Order Completed', {
    "order_id": "TR1234567890",
  "total": "27.5",
  "shipping": 2.5,
  "products": [
    {
      "product_id": "1111111111",
      "name": "Product Name 1",
      "price": 19,
      "quantity": 1,
      "brand": "Product Brand 1"
    },
    {
      "product_id": "2222222222",
      "name": "Product Name 2",
      "price": 3,
      "quantity": 2,
      "brand": "Product Brand 2"
    }
  ]
});

The above example will add to the output event the following key:value pair:

"transaction": "79d744ea1c2365958db2815b5bf85f62fe9ffef21e77fdcb167002c7cd2bad37"

To String

A To String mapping will transform the input value into a string.

Example

1810

Considering the following analytics.js event triggered:

analytics.track('Order Completed', {
    "order_id": "TR1234567890",
  "total": "27.5",
  "shipping": 2.5,
  "products": [
    {
      "product_id": "1111111111",
      "name": "Product Name 1",
      "price": 19,
      "quantity": 1,
      "brand": "Product Brand 1"
    },
    {
      "product_id": "2222222222",
      "name": "Product Name 2",
      "price": 3,
      "quantity": 2,
      "brand": "Product Brand 2"
    }
  ]
});

The above example will add to the output event the following key:value pair:

"shipping": "2.5"

Trim String

A Trim String mapping will transform the input value into a string if not a string already, then will trim all leading and trailing whitespace characters including newlines and carriage returns.

Example

1810

Considering the following analytics.js event triggered:

analytics.track('Order Completed', {
    "order_id": "  TR1234567890  ",
  "total": "27.5",
  "shipping": 2.5,
  "products": [
    {
      "product_id": "1111111111",
      "name": "Product Name 1",
      "price": 19,
      "quantity": 1,
      "brand": "Product Brand 1"
    },
    {
      "product_id": "2222222222",
      "name": "Product Name 2",
      "price": 3,
      "quantity": 2,
      "brand": "Product Brand 2"
    }
  ]
});

The above example will add to the output event the following key:value pair:

"transaction": "TR1234567890"

Uppercase String

An Uppercase String mapping will transform the input value into a string if not a string already, then will convert the entire string to uppercase letters.

Example

1808

Considering the following analytics.js event triggered:

analytics.track('Order Completed', {
    "order_id": "tr1234567890",
  "total": "27.5",
  "shipping": 2.5,
  "products": [
    {
      "product_id": "1111111111",
      "name": "Product Name 1",
      "price": 19,
      "quantity": 1,
      "brand": "Product Brand 1"
    },
    {
      "product_id": "2222222222",
      "name": "Product Name 2",
      "price": 3,
      "quantity": 2,
      "brand": "Product Brand 2"
    }
  ]
});

The above example will add to the output event the following key:value pair:

"transaction": "TR1234567890"

Lowercase String

A Lowercase String mapping will transform the input value into a string if not a string already, then will convert the entire string to lowercase letters.

Example

1804

Considering the following analytics.js event triggered:

analytics.track('Order Completed', {
    "order_id": "TR1234567890",
  "total": "27.5",
  "shipping": 2.5,
  "products": [
    {
      "product_id": "1111111111",
      "name": "Product Name 1",
      "price": 19,
      "quantity": 1,
      "brand": "Product Brand 1"
    },
    {
      "product_id": "2222222222",
      "name": "Product Name 2",
      "price": 3,
      "quantity": 2,
      "brand": "Product Brand 2"
    }
  ]
});

The above example will add to the output event the following key:value pair:

"transaction": "tr1234567890"

Substring

A Substring mapping will transform the input value into a string if not a string already, then will grab the subset of the characters given the Start and End character positions.

Note: The character position starts at 0 (zero).

Example

1806

Considering the following analytics.js event triggered:

analytics.track('Order Completed', {
  "experience": "desktop",
    "order_id": "TR1234567890",
  "total": "27.5",
  "shipping": 2.5,
  "products": [
    {
      "product_id": "1111111111",
      "name": "Product Name 1",
      "price": 19,
      "quantity": 1,
      "brand": "Product Brand 1"
    },
    {
      "product_id": "2222222222",
      "name": "Product Name 2",
      "price": 3,
      "quantity": 2,
      "brand": "Product Brand 2"
    }
  ]
});

The above example will add to the output event the following key:value pair:

"deviceType": "d"

Split String

A Split String mapping will transform the input value into a string if not a string already, then will split it via the specified Separator into an Array. The resulted output value will be an Array with the maximum elements number based on the specified Max Elements.

Example

1810

Considering the following analytics.js event triggered:

analytics.track('Order Completed', {
    "order_id": "TR1234567890",
  "categories": "games,fun,play,entertainment",
  "total": "27.5",
  "shipping": 2.5,
  "products": [
    {
      "product_id": "1111111111",
      "name": "Product Name 1",
      "price": 19,
      "quantity": 1,
      "brand": "Product Brand 1"
    },
    {
      "product_id": "2222222222",
      "name": "Product Name 2",
      "price": 3,
      "quantity": 2,
      "brand": "Product Brand 2"
    }
  ]
});

The above example will add to the output event the following key:value pair:

"categories": [
  "games",
  "fun",
  "play"
]

Replace String

A Replace String mapping will transform the input value into a string if not a string already, then will replace all occurrences of the Replace string provided with the With string provided, using exact matching.

Note: Empty string and space string can be used for both Replace and/or With fields. Leading the input empty for one of these fields, will result into an empty string. Possible use-cases: remove all spaces inside a string (will need a space char as Replace value, and empty string as With value).

Example

1808

Considering the following analytics.js event triggered:

analytics.track('Order Completed', {
    "order_id": "TR1234567890",
  "total": "27.5",
  "shipping": 2.5,
  "products": [
    {
      "product_id": "1111111111",
      "name": "Product Name 1",
      "price": 19,
      "quantity": 1,
      "brand": "Product Brand 1"
    },
    {
      "product_id": "2222222222",
      "name": "Product Name 2",
      "price": 3,
      "quantity": 2,
      "brand": "Product Brand 2"
    }
  ]
});

The above example will add to the output event the following key:value pair:

"categories": "games|fun|play|entertainment"