How to catch the browser history, or visited sites and the like using js, php? ... And is it even possible?

Or maybe cookies as you can see the user?

Like the same sites that show ads, track cookies and show me ads for products or services that I was interested in .. How do they do it?

    1 answer 1

    No, it would be a serious security / privacy hole.

    Google AD (and other similar systems) keeps track of you by the cookies that it sets for itself and, when entering any site with its ads, it can check its once set cookies (IP, browser settings are also checked).

    PS Evil tongues say that such giants can provide the accumulated information to other advertisers.