# Visitor Counter

**URL:** <https://forum.wixstudio.com/t/visitor-counter/4422>\
**Category:** Ask the community\
**Tags:** design\
**Created:** [November 10, 2021, 1:06am UTC](https://forum.wixstudio.com/t/visitor-counter/4422 "2021-11-10T01:06:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rfhall50](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/rfhall50/32/30808_2.png) [@rfhall50](https://forum.wixstudio.com/u/rfhall50)\
**Post date:** [November 10, 2021, 1:06am UTC](https://forum.wixstudio.com/t/visitor-counter/4422/1 "2021-11-10T01:06:50Z")

</div>

I would like to put a simple Visitor Counter on our main page. Don’t really care who they are/where they are from. Would prefer not to double count them if they go back to the main page to select another page.  
Your suggestions/help are appreciated.  
Bobby  
HEART Radio Team

---

<div class="post-metadata">

**Author:** ![yisrael-wix](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/yisrael-wix/32/1107_2.png) [@yisrael-wix](https://forum.wixstudio.com/u/yisrael-wix)\
**Post date:** [November 10, 2021, 11:54am UTC](https://forum.wixstudio.com/t/visitor-counter/4422/2 "2021-11-10T11:54:38Z")

</div>

You can use [local storage](https://www.wix.com/velo/reference/wix-storage/local) .

Use [setItem](https://www.wix.com/velo/reference/wix-storage/storage/setitem) to save an item that indicates that the visitor has already visited the site:

```javascript
local.setItem("visited", "yes");

```

Use getItem to get the item. If the item exists, the visitor has already visited your site, If the item does not exist, then they’re a new visitor. You can do something like this to check:

```javascript
let value = local.getItem("visited");
if(value === 'yes') {
   // visitor has already been here before
}
else {
   // new visitor, so update the counter
}

```

Or, you can even make the check simpler:

```javascript
let value = local.getItem("visited");
if(value === null) {
   // the item was never saved, so this is a new visitor
   // update the counter
}

```

---

<div class="post-metadata">

**Author:** ![rfhall50](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/rfhall50/32/30808_2.png) [@rfhall50](https://forum.wixstudio.com/u/rfhall50)\
**Post date:** [November 10, 2021, 10:10pm UTC](https://forum.wixstudio.com/t/visitor-counter/4422/3 "2021-11-10T22:10:53Z")

</div>

I understand about the 3 type of local storage (local, session, memory), at least I think I do. However, when looking at keeping an ongoing count for the number of visitors, where can I store the current count ?  
Example if they do not have a “visited” indicator for SESSION, then I want to get the latest count, increase by one, save the new number, then display on the screen. I understand that in this scenario, if they came back to the site a couple of days later, they would be counted again. This is what I want. BUT, …  
Where can I store the “count to date” so that other visitors get counted as well?  
Thank You.
