# Simple Mean and Conditional Counters – Statistics in Adobe Analytics

In my last post, we took a look at how we can predict the future through Regression Analysis with Adobe Analytics and visualize it in Analysis Workspace. While that was a quite advanced post, there are a lot of things we can do using basic statistical analysis. This is what we are going to look at in this post, exploring some ways to describe our data in a standardized way.

At the end of this post, we want to describe our relative page performance for a website like this, showing us top- and low performing pages and how many there are of both:

## Describing ranked website performance relative to the Mean

This first part will show how we can level-up our ranked reports. Let’s pretend we want to judge how certain pages on our website are performing. To do this, we might start with a simple table containing our Page Views:

We already see a lot from this table. There are a few pages that receive the majority of traffic and an extensive longtail of smaller pages. One of the most common ways to describe data is to look at the average by calculating the Mean from the rows of data. Luckily, this can be done very easily in Analysis Workspace, by clicking right on the Metrics and create a new Metric using the Mean:

This gives us a new column in our Freeform Table with the Mean Page Views metric:

Wow, that’s impressive! Only the last two pages in our top-10-list have a below-average performance. The new column is a nice demonstration on how Analytics calculates and outputs this value, because we now have the exact same output in every row of data. This allows us to go even further: If we select both columns and right click, we get some new options to create a new Metric. We are going to subtract them for now:

Now we have a third column:

I find this new column very helpful. It clearly indicates which pages perform above and below average and by how much. That proves our observation from before, but in a much clearer way! But it is still hard so give meaning to those absolute numbers, so let’s put them in relation to the Mean. First, drag the middle column to the right, then select both like before and create a new metric. But this time, we are going to open them in the Metric Builder:

By default, Analytics will put a Divide operator between our two selected metrics, which is exactly what we want, but there still are two things we need to change here. We want the Format to be Percent and have two Decimal Places:

Once we drag this new Metric in our Table, we have a much clearer way to look at our data:

This is a very impressive insight. It clearly shows the impact of the first two pages in relation to the average page performance. If we were looking at which pages we should optimize, those would certainly be our go-to candidates! And since we are in Analysis Workspace, we can easily add some segments to learn a bit more about our users. Let’s do this for our new and return users:

That’s very interesting! Now we see that our observation from before is valid, but not for all user in the same way. There is not much change for the first two pages, but the third page is drastically more important for our first time users! Now we might wonder: How many pages are actually performing above and below average?

## Conditional Counters in Adobe Analytics

To know this, we need to create a counter Metric that only increments if the current row is above or below average. First, we need to have a metric that returns 1 for a above-average row and 0 for one below average. We are going to use our “Page Views – Mean Page Views” Metric from before, so right-click it and open it in the metric builder.

In the Builder, we first drag in an IF function from the left rail. That way we can define that we want to return 1 or 0 as static numbers, making this the ideal criteria for a logical test. For the condition, we use the GREATER THAN function and compare our “Page Views – Mean Page Views” to 0. The complete metric looks like this:

Save this as “Page Views above average” and drag it in our table. We see that it works nicely and returns 1 if the current line is above average:

We are almost there! In our next Metric, we drag the CUMULATIVE function in. As number, we enter 0 and drag our “Page Views above average” metric in for the metric slot. As last step, we wrap it in the COLUMN MAXIMUM function like below. In simple terms, we are counting up if a row of data is above average and return only the highest value of all rows. The Metric looks like this:

I call this Metric “Page Views above average Counter”, save it and drag it in our table to confirm it works:

It works! Our new Metric is showing us how many of our pages are performing above average, just like we wanted. If we flip the value_if_true and value_if_false in our Metric, we can quickly create one that counts pages below average as well:

Just like before, this works fine for segmented data as well:

This clearly shows: For our returning users, we have less pages that are especially important compared to first time users, who focus more on certain pages. If we now want to constantly monitor that performance, we could build a nice workspace showing the relative page performance for our top pages as a horizontal bar chart, and both top- and baseline performance pages as a summary number:

## Summary

I think the output from our little adventure is quite nice. Now we have a defined way to judge our page performance. Remember, this can be done with any Metric and any Dimension available in Analytics! I’ve shown a few examples for using segments, but there also is no limit to that.

The conditional counter Metrics we introduced are also very versatile to summarize data. By looking at the maximum of our counter, we quickly get the number of rows counted as described above. I imagine you can think of a lot of things you would like to have counted and visualized in your reports! Let me know if you build something amazing with this.