This question already has an answer here:
I'm wondering if it is possible to identify a user on my website without asking him to create an account ? I know it is possible to use IP address, but IP often change if I'm not wrong ? So, is there a method such as IP address to identify a user on long term ?
</div>
You could set sessions that don't expire.
Take a look here: http://php.net/manual/en/reserved.variables.session.php
I guess the proper way to do it would be to store an unique token into the user's navigator using a cookie. But you won't be able to track him through different browsers.
I solved that similar problem on my website by
1 - Figuring out ID from user's browsers by Valve/fingerprintjs method from Github
This fingerprint can give unique number according to their browser. And it is 90+% about to be unique.
2 - Get user public information(if you want) by using this api (demo )
That api will give you about user's public information. city,ip,timezone,country,network,lat:long of ISP, etc.
3 - Combining with generated token sessions and cookies for the best results .