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

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

For example, you can apply custom discounts or uplifts based on a transaction/event’s affiliation, coupon code, or a custom dimension with a user classification, such as new/returning.

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 the lookup_key and adjust original event_value based on the lookup_value and corresponding mathematical operation, in the order how rules were set up (one by one). Multiple rules are allowed.

Transformation example

  • Original event_value = 100.00 (event_data[“events”][“params”][“value”] from the incoming request)

  • Lookup_value = 0.35 (event_data[“events”][“params”][“coupon”] .e.g. ‘SUMMER_FUN', matched by lookup_key(’SUMMER_FUN') in lookup_value_coupon_ex.csv)

  • Operation = multiply

  • Adjusted event_value = 100.00 * 0.35 = 35

2. How to set up Event lookup value transformation

To get started:

  1. Go to the left-hand menu.

  2. Select Data and reporting → Enhanced signals.

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

  4. Choose Event lookup value.

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

For example, if the order of rules is:

  1. Rule 1: custom_dim_user_type

  2. Rule 2: coupon

  3. Rule 3: affiliation

The transformation will first try to find a match for custom_dim_user_type. If there’s no match on the custom_dim_user_type event attribute, it will then try to match on coupon, and finally on affiliation. 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 three different types of Lookup rule keys:

The most commonly used 'market' and 'customer_type' 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 event-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:

In the given example above, the Lookup rule key was chosen as 'customer_type'. Thus, in the column 'lookup_key', for the 'customer_type' defined as 'high_value', a coefficient of 0.35 will be applied to revenue according to the chosen mathematical operation. For example, if the operation is 'multiply', revenue will be multiplied by 0.35.

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_coupon_code.csv

If you select ‘lookup_key (user_defined)' as the Lookup rule key and would like to use a coupon as a required parameter, you need to provide coupon codes (such as 'SUMMER_FUN', etc.) in the lookup_key column of your file.

lookup_key

lookup_value

market

currency

SUMMER_FUN

0.35

SE

SEK

INFLUENCER_ID_JLO

0.40

DE

DKK

WINTER_BLUES

0.55

SE

SEK

CALI_CHILL_VIBES

0.02

SE

SEK

Example 2. File lookup_value_custom_dim_user_type.csv

If you select 'customer_type' as the Lookup rule key and would like to use customer segmentation as a required parameter, you need to provide customer segments (such as '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?