Skip to main content
Item lookup value transformation
Jonas Østergård Bæk avatar
Written by Jonas Østergård Bæk
Updated over a month ago

The Item lookup value transformation applies basic mathematical operations (multiplication, division, addition, and subtraction) to each item value in a transaction based on matching custom keys of choice. This functionality provides flexibility in transforming and manipulating data, enabling calculations on item values before they reach the target platform.

For example, you can calculate expected return rates on different product categories and account for them before they reach the target ad platform.

1. How this transformation works

You set up the rules of the transformation by providing the Lookup rule key, the mathematical operation to perform, and the corresponding .csv file that contains the required parameters.

The transformation will attempt to find a the lookup_key and adjust original item_value based on the item_value and corresponding mathematical operation, in the order how rules were set up (one by one). Multiple rules are allowed.

Transformation example

  • Original item_value = 100.00 (event_data[“events”][“params”][“items”][x][“price”] from the incoming request)

  • Lookup_value = 0.35 (event_data[“events”][“params”][“items”][x][“category_id”] .e.g. 'socks', matched by lookup_key('socks') in category_id.csv)

  • Operation = multiply

  • Adjusted item_value = 100.00 * 0.35 = 35

2. How to set up Item lookup value transformation

To get started:

  1. Go to the left-hand menu.

  2. Select Data and reportingEnhanced signals.

  3. Click on the 'Create new configuration' button.

  4. Choose Item lookup value.

You will now see an option in the interface to set up the required rules. Rules are set up one by one and are applied in the order they were created. You can add as many rules as needed for your business case.

For example, if the order of rules is:

  1. Rule 1: item_id

  2. Rule 2: category_id

  3. Rule 3: custom_lookup_value

The transformation will first try to find a match for item_id. If there’s no match for item_id, it will then try to match category_id, and finally, custom_lookup_value. If all rules are tested and no match is found, no operation will be performed, and the item will retain its original value.

Each rule has its own settings, such as:

  • Lookup rule key

  • Lookup rule operation

  • .csv file to provide the required parameters

See below for more details on each parameter.

3. How to set up a Lookup rule key

You have a choice of different types of Lookup rule keys:

The most commonly used keys, such as 'item_id', 'item_category', and other Lookup rule keys, can be selected directly from the dropdown menu. The 'lookup_key (user_defined)' can be any parameter defined by the user. It could be any item-level parameter from a Google Analytics 4 purchase event (see all available standard parameters). However, it could also be a completely custom value, as long as it is available to be picked up when the event is sent to Enhanced signals.

4. How to set up a Lookup rule operation

You have a choice of four basic mathematical operations:

Select the one required for your business case:

Operation

Description

Multiply

Multiplication is the process of combining equal groups. It is essentially repeated addition. For example, multiplying 3 by 4 (3 * 4) means adding 3 four times (3 + 3 + 3 + 3), which equals 12.

Divide

Division is the process of splitting a number into equal parts. It is the inverse operation of multiplication. For example, dividing 12 by 4 (12 / 4) means finding out how many groups of 4 can be made from 12, which equals 3.

Add

Addition is the process of combining two or more numbers to find their total or sum. For example, adding 2 and 3 (2 + 3) means combining the two numbers to get 5.

Subtract

Subtraction is the process of taking one number away from another. It is the inverse operation of addition. For example, subtracting 3 from 8 (8 - 3) means taking 3 away from 8, which equals 5.

5. How to set up a Lookup value file

To set it up:

1. Download a template for the Lookup value file.

2. You will now see a .csv file with the following structure:

3. Put the required values to the file: lookup_key, lookup_value, market, currency.

Both currency and market are optional parameters. Leave the cells empty in the file if you do not need to provide these values.

Currency is only optional for the mathematical operations 'multiply' and 'divide'. It is required for the operations 'add' and 'subtract'.

4. Press the 'Upload Lookup value file' button to add the corresponding values to the Enhanced signals configuration.

If you need to set up several rules, you may need to create several files with different values. Each file should start with a prefix ‘lookup_value_’.

Example 1. File lookup_value_item_id.csv

If you select the Lookup rule key as 'item_id' and would like to use the product sku as a required parameter, you need to provide sku numbers (such as a-123, b-999, etc.) in the lookup_key column of your file.

lookup_key

lookup_value

market

currency

a-123

0.35

SE

SEK

a-132

0.40

DE

DKK

b-999

0.55

SE

SEK

h-42

0.02

SE

SEK

Example 2. File lookup_value_item_category.csv

If you select the Lookup rule key as 'item_category' and would like to use product categorisation as a required parameter, you need to provide product categories (such as socks, sweatshirts, etc.) in the lookup_key column of your file.

lookup_key

lookup_value

market

currency

socks

0.35

SE

SEK

sweatshirts

0.40

DE

DKK

kids

0.55

SE

SEK

casual

0.02

SE

SEK

Example 3. File lookup_value_custom_lookup_key.csv

If you select the Lookup rule key as 'lookup_key(user_defined)' and would like to use custom parameters as required ones, you need to provide such parameters (for example, customer segments like high_value, returning, etc.) in the lookup_key column of your file.

lookup_key

lookup_value

market

currency

high_value

0.35

SE

SEK

returning

0.40

DE

DKK

churned

0.55

SE

SEK

low_value

0.02

SE

SEK

Did this answer your question?