# How to calculate daily new users to a website

**URL:** <https://discuss.elastic.co/t/how-to-calculate-daily-new-users-to-a-website/186214>\
**Category:** Kibana\
**Tags:** elastic-stack-graph\
**Created:** [June 18, 2019, 9:38am UTC](https://discuss.elastic.co/t/how-to-calculate-daily-new-users-to-a-website/186214 "2019-06-18T09:38:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Havana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/havana/32/47091_2.png) [@Havana](https://discuss.elastic.co/u/Havana)\
**Post date:** [June 18, 2019, 9:38am UTC](https://discuss.elastic.co/t/how-to-calculate-daily-new-users-to-a-website/186214/1 "2019-06-18T09:38:30Z")

</div>

We're using Elasticsearch to visualize our website usage data.  
Each day there are new users coming into our website.  
How can I calculate the number of new users and visualize it with a line graph?

---

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [June 24, 2019, 5:52pm UTC](https://discuss.elastic.co/t/how-to-calculate-daily-new-users-to-a-website/186214/2 "2019-06-24T17:52:16Z")

</div>

The simple answer is like this. I used `Unique count` of clientip and a Date Histogram with a daily interval.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/c/8c707df2eb3b20054048792e07eb359d13ea024a.png)

But the problem with this is that it's counting how many unique IPs there are each day. So the count on the second day includes all the IP addresses on that day even if they also were visitors on the previous day.

There are several other posts on this topic but I don't think any of them have a good solutions you could implement in Kibana. For example;

> [@Cumulative Sum Regardless of Time Interval - ES](https://discuss.elastic.co/t/cumulative-sum-regardless-of-time-interval-es/100237):
>
> Hi, I posted the following in the Kibana category, and it was suggest that it might belong here in Elasticsearch:

Here's a post that looks like it's developing the correct query in Elasticsearch but I'm not sure if we can do that in Kibana;

> <https://stackoverflow.com/questions/34445376/use-doc-count-as-cumulative-count>

I'll try to spend some time to see if Kibana can do this;

> **[Pipeline aggregations | Elasticsearch Guide \[8.11\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline.html#_special_paths)**

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [June 24, 2019, 5:56pm UTC](https://discuss.elastic.co/t/how-to-calculate-daily-new-users-to-a-website/186214/3 "2019-06-24T17:56:05Z")

</div>

A common way to get around this is to create a separate entity-centric index that contains a single document per identified user. This can contain the first seen date and be updated periodically, e.g. through a batch job. This makes it very easy to create user centric queries that are hard to perform based on large amounts of access records.

---

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [June 24, 2019, 11:32pm UTC](https://discuss.elastic.co/t/how-to-calculate-daily-new-users-to-a-website/186214/4 "2019-06-24T23:32:45Z")

</div>

I filed this issue in Elasticsearch repo. But even if implemented, Kibana would also require a change to support it.

> <https://github.com/elastic/elasticsearch/issues/43550>

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 22, 2019, 11:32pm UTC](https://discuss.elastic.co/t/how-to-calculate-daily-new-users-to-a-website/186214/5 "2019-07-22T23:32:55Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
