F
F
Frel2018-07-21 22:09:39
JavaScript
Frel, 2018-07-21 22:09:39

Does anyone know how to record in cookies (or something else) how many times a user has visited the site?

Does anyone know how to record in cookies (or no matter how) how many times a user has visited the site?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Sokolov, 2018-07-21
@sergiks

const s = window.localStorage; // хранилище
const key = 'mySiteVisitCounter'; // название счётчика
const n = 1 + (s.getItem(key) >> 0); // считываем записанное, если есть
s.setItem(key, n); // сохранить обновлённое значение
console.log("Page access count:", n); // вывести что-то куда-то

M
msdos-x86, 2018-07-22
@msdos-x86

You can do this through a node, write a script in the html file that will make a request to the north (any), and on the server just catch ip-addresses. Number of requests = the number of all visits to the site, and if it is necessary for specific users, then you can save ip-addresses in the database

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question