Page history

Good time.

Tell me, gentlemen, how can you find out by means of PHP (or others) the history of the movement of a site visitor through the pages of the site, like Yandex Metrika, i.e. for example, the user went to the main page, went to section1, went to section2, etc. How to get this information?

Answer 1, authority 100%

  1. Create session.
  2. Record each action in the database (for example, by the requested url and referrer), linking it to the session. You can use a bunch of Referrer and Requested URL, which is not the best solution, some proxies do not give out this information. You can fix its position within the system, the implementation depends on the system – and this is the most correct solution.
  3. To view, make a selection of sessions and actions, ordering either by date or by id