create view tracker template
This commit is contained in:
parent
719a957f60
commit
dfb4095f60
16
views/shards/views.ejs
Normal file
16
views/shards/views.ejs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<div class="bg-gradient-to-br from-slate-800/80 to-slate-900/80 border border-slate-800 backdrop-blur-md shadow-xl rounded-2xl p-8 mx-4 mb-8">
|
||||||
|
<h1 class="text-4xl font-bold mb-2">Analytics</h1>
|
||||||
|
<p class="text-gray-400 italic mb-4">Our analytics system does not track you, ever. Only a simple counter is used, and your IP address is never stored or shared.</p>
|
||||||
|
<p>Total Views: <span id="totalViews">0</span></p>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
fetch('/api/log-view', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ page: '<%= req.originalUrl %>' }),
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
document.getElementById('totalViews').innerText = data.views;
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
x
Reference in New Issue
Block a user