# Analysis Workspace Hacks (AGE) – Average Daily Unique Visitors

This is a post in the Adam-Greco-Edition (AGE) series of posts. They aim to iterate on some great posts by Adam Greco, showing some different approaches to achieve similar things.

In one of his posts Adam Greco shows a way to replicate the Daily Unique Visitors Metric from Reports & Analytics in Analysis Workspace. His approach involves creating a Calculated Metric for a given time range, summing up the Visitors for each day.

There are some limitations to that approach. The obvious one is that we need a new metric for each date range we want to analyze; We can’t use a 7-day Metric if there are 8 days to analyze. Second, Visitors are not deduplicated but summed up over all days in the reporting window (just as in the old interface); So a Visitor visiting our site three times would be counted as three Visitors. Last, the name could mislead our users into thinking they are looking at an average daily amount of Visitors instead of the sum, which I never liked in the past.

The last issue is solved simply by dividing our sum by the amount of days in the Metric. For the second issue, we would use one 7-day segment instead of seven 1-day segments, effectively deduplicating our Visitors. But what can we do to avoid having to build a separate Metric for every time frame?

## Introducing: Approximate Count Distinct

Luckily, Analytics has learned to count things with the Approximate Count Distinct function in the Calculated Metric Builder. With this function, we are able to count how many different Dimension values we have in a given Dimension during the Reporting Window. Once we drop it into the Definition, it presents itself like this:

As the Dimension, we will choose “Day” for our little use case, so drop it in there like this:

We name our Metric “Days” and save it. Let’s see what it does and throw it into a Freeform Table:

Yay, it works! Now we have a Metric returning the number of days in a given Reporting Window. Now we just need to divide our Unique Visitors by those counted days:

Now let’s see it side by side with Visitors and our Days Metric:

Awesome! Now we have exactly what we wanted! For Dec 2019, our 202 Visitors are divided by all the 30 days in December. Wait, what?

## Counting things is hard

This is where the “approximate” part of our function name comes in. For a system like Adobe Analytics, it’s a tremendous task to count how many different values for a Dimension are in a flexible Reporting Window. According to the documentation, they aim for 95% accuracy 95% of the time.

This is a good precision given that Analytics has to handle Terabytes of data. Things become more apparent once we include decimals to our days Metric:

We can see that there are approximately 30.22 days in December, which is quite precise. While it appears like a simple task for us (since people know how many days are there in any month), the system is actually doing a good job approximating it.

## All done!

Now we have our Average Daily Unique Visitors exactly how we want them. By using our counting function, we can change the Reporting Window without having to switch the Metric. We can do the same by using Weeks, Months, or Years as a Dimension like in the old interface. On top of that, we are also able to use the “Hour” Dimension!

I generally recommend exploring the possible use cases for Approximate Count Distinct on your site. The documentation already shows how to count the active Customers, but there is much more to explore. How many pages of your site are visited over time? How do they differ with certain entry pages? How many different search requests are issued on your search? How many videos played? There is so much more to explore!

Steps to create Average Daily Unique Visitors in Analysis Workspace:

1. Create “Days” Metric

Open the Calculated Metric Builder and drop the Approximate Count Distinct Function in there. Use “Day” as Dimension. Save the Metric and check if it looks like in the example.

2. Check if Metric works as expected

Drop the Metric alongside your Unique Visitors in a Freeform Table.

3. Create “Average Daily Unique Visitors” Metric

Open the Metric Builder and divide Unique Visitors by the created “Days” Metric.

4. Put it all together

Drop both new Metrics in Analysis Workspace with any Dimension you like for any Reporting Window.

5. Go beyond

Create more Calculated Metrics like this using the Year, Month, Week, or Hour Dimensions.

Scroll to Top