The Profit transformation is a method for calculating the total profit on transactions, allowing for tracking and optimisation either in addition to or instead of the normally tracked revenue.
The calculation is performed by looking up the product cost at the time of the transaction and subtracting it from the revenue on the order. This is sent to Enhanced signals at both the transaction level and the product level.
1. How this transformation works
This transformation will adjust profit according to the following formulas:
1.1. Total profit is calculated as the following:
Total profit = Total revenue (A) - Total cost (B)
A = Total revenue (event_data[“events”][0][“params”][“value”] from the incoming request)
B = Total cost (cost per
sku
(1) in Product cost list file or Margin fallback file xquantity
(2))(1)
sku
is taken from event_data[“event”][“params”][“items”][x][“item_id”] for each product bought.2
quantity
is taken from event_data[“event”][“params”][“items”][x][“quantity”] for each product bought.
Margin fallback is per market, and the market is available in the custom event parameter market
from the incoming request.
1.2. Profit per item is calculated as the following:
Profit per item = Revenue per item - Cost per item
Profit per item = event_data[“events”][0][“params”][“items”][x][“price”] - cost from Product cost list file or Margin fallback file.
2. How to set up Profit transformation
To get started:
Go to the left-hand menu.
Select Data and reporting → Enhanced signals.
Click on the 'Create new configuration' button.
Choose Profit transformation.
To run this transformation, two files in .csv format are required: a Product cost list file and a Margin fallback file. See below for more information on each file.
3. How to set up the Product cost list file
Product cost list is the list of product IDs (SKU) and their corresponding cost to the client.
In order to set it up:
1. Download a template for the Product cost list file.
2. You will now see a .csv file with the following structure:
In the given example above, the product cost (unit_cost
) for the product with sku
29-40064 in the AT market
is 2.25 SEK. This amount will be deducted from the revenue.
3. Put the required values to the file: sku
, unit_cost
, market
, currency
.
If you put a zero (0) value for unit_cost
, it is assumed that this is the cost. If you do not have a cost, leave the product sku
out of the Product cost list. In this case the system will use the margin percent from the Margin fallback file for the transaction’s market.
4. Press the 'Upload Product cost list file' button to add the corresponding values to the Enhanced signals configuration.
4. How to set up the Margin fallback file
This is the default set of margin percentages per market to use if a product sku
is not listed in the Product cost list file.
To set it up:
1. Download a template for the Margin fallback file.
2. You will now see a .csv file with the following structure:
In the given example above, if a product with a sku
not mentioned in the Product cost list file is sold in the SE market, the profit will be calculated as 0.30 (margin_percent
) * revenue.
3. Put the required values to the file: market
, margin_percent
.
There must always be a value for the 'default' market for cases where a purchase occurs in a market that is not listed in the Margin fallback file.
Lookups are case-insensitive.
4. Press the 'Upload margin fallback file' button to add the corresponding values to the Enhanced signals configuration.