Skip to content

Commit 4d75a79

Browse files
author
Altify
authored
visit.counter.live.
1 parent 0c4fdf4 commit 4d75a79

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

html/stats.reloaded.svg.html

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
<script>
2+
var counterContainer = document.querySelector(".website-counter");
3+
var visitCount = localStorage.getItem("page_view");
4+
5+
// Check if page_view entry is present
6+
if (visitCount) {
7+
visitCount = Number(visitCount) + 1;
8+
localStorage.setItem("page_view", visitCount);
9+
document.cookie = 'VisitorCount='+visitCount+'; expires=Wed, 1 Jan 2070 13:47:11 UTC; path=/';
10+
} else {
11+
visitCount = 1;
12+
localStorage.setItem("page_view", 1);
13+
}
14+
counterContainer.innerHTML = visitCount;
15+
</script>
16+
117
<h1>yo</h1><h1>yo</h1><h1>yo</h1><h1>yo</h1><h1>yo</h1><h1>yo</h1>
218
<h1><script>
319
let CookieListAll = document.cookie;
@@ -56,18 +72,3 @@ <h1><script>
5672
location.reload();
5773
};
5874
</script>
59-
<script>
60-
var counterContainer = document.querySelector(".website-counter");
61-
var visitCount = localStorage.getItem("page_view");
62-
63-
// Check if page_view entry is present
64-
if (visitCount) {
65-
visitCount = Number(visitCount) + 1;
66-
localStorage.setItem("page_view", visitCount);
67-
document.cookie = 'VisitorCount='+visitCount+'; expires=Wed, 1 Jan 2070 13:47:11 UTC; path=/';
68-
} else {
69-
visitCount = 1;
70-
localStorage.setItem("page_view", 1);
71-
}
72-
counterContainer.innerHTML = visitCount;
73-
</script>

0 commit comments

Comments
 (0)