In ecommerce, you’ll typically be given a revenue target your site needs to hit every month. In my experience, these revenue targets are often proposed by finance directors, CEOs, or non-executive directors, with little knowledge of how ecommerce sites really work, or how on earth you’re supposed to hit some kind of made up target.

As a result, ecommerce revenue targets can range from relatively easy to hit, to totally impossible, even if you generated record KPI results. Thankfully, it only takes some simple maths and an understanding of your basic ecommerce KPIs to calculate what revenue figure you’re likely to hit, and what KPI combination you need to hit or exceed your revenue target.

Ecommerce data science ranges from extremely complicated to surprisingly simple. Just three KPIs dictate the number of orders and amount of revenue any site will make. They are:

**Sessions:**Sessions are website visits made by users. Since a proportion of visitors will be persuaded to purchase, the more sessions you get, the more orders you get. The number of sessions is easy to extract from Google Analytics and other web analytics platforms, either via the front-end reporting tools or API based systems like GAPandas.**Conversion rate:**The conversion rate is a metric that shows the percentage of sessions that result in a transaction. It’s also reported by tools like Google Analytics, or you can calculate it yourself by dividing the number of transactions by the number of sessions. As a result, it’s sometimes called transactions per session.**Average Order Value:**Finally, there’s Average Order Value or AOV, which is the average value of each customer’s transaction. It’s calculated by dividing the total revenue by the total number of transactions.

Since you can calculate the number of orders from the number of sessions and the conversion rate, and the amount of revenue from the number of orders and the AOV, you only need to know the sessions, conversion rate, and AOV in order to calculate or forecast (if you can call it that) the number of orders and amount of revenue you’ll make.

To make it quick and easy to calculate the number of orders and the amount of revenue you’ll generate from a given combination of sessions, conversion rate, and AOV, we’ll make a simple Python function. We’ll then be able to pass in different combinations of KPIs and see what we’ll get, or what we need to hit a target.

First, we’ll calculate the number of orders we’re going to generate. This can be calculated with the following formula: `orders = int(sessions / 100 * conversion_rate)`

. For example, 500,000 sessions / 100 x 2.15 = 10750 orders.

Secondly, we’ll calculate the amount of revenue we’ll generate. This is calculated from the number of orders returned by the previous formula, multiplied by the AOV. So 10750 x £75 = £806,250. Finally, we return the two values and we’re ready to go.

```
def forecast_performance(sessions: int,
conversion_rate: float,
aov: float):
"""Return the number of orders and revenue that will be generated from
a given set of ecommerce KPIs comprising sessions, conversion rate, and AOV.
Args:
sessions (int): The number of sessions, i.e. 500000
conversion_rate (float): The conversion rate, i.e. 2.15
aov (float): The average order value, i.e. 75.00
Return:
orders (int), revenue (float)
"""
orders = int(sessions / 100 * conversion_rate)
revenue = orders * aov
return orders, revenue
```

Let’s say your FD has set you a target of generating £825,000 in sales for next week. You can enter the number of weekly sessions you got last week, i.e. 500,000, enter your conversion rate of 2.15%, and the AOV of £75, and the function will tell you you’re going to generate 10,750 orders and £806,250 in revenue.

```
forecast_performance(500000, 2.15, 75)
```

```
(10750, 806250)
```

What happens if you increase the AOV, perhaps by running a promotion with a spend threshold that encourages customers to spend a little more than they normally would. If we keep the sessions at 500,000 and the conversion rate at 2.15% but increase the AOV to £76, we generate the same 10,750 orders but increase the revenue to £817,000, putting us a little closer to our target.

```
forecast_performance(500000, 2.15, 76)
```

```
(10750, 817000)
```

Alternatively, we could consider a different kind of promotion that perhaps increases conversion rate significantly. In practice, these are harder to pull off, and often have a negative impact on margin, but we’ll ignore that for the purposes of this simple example. Let’s say it increases conversion rate from 2.15% to 2.20%. That gives us 11,000 orders and the £825,000 in revenue we need to hit our target.

```
forecast_performance(500000, 2.20, 75)
```

```
(11000, 825000)
```

Matt Clarke, Monday, May 09, 2022