Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

gmehtaster's avatar

Storing Unique ID for Visitors on Site

Hi,

I am building a site using Laravel 5.2. My site will have members and visitors. How do I start assigning and logging a unique id for a visitor in my DB ? Need this to personalize content for visitors the next time they come in.

Anyone done this before can help?

0 likes
1 reply
Pendo's avatar
Pendo
Best Answer
Level 10

Nothing much you can do besides getting some client sided information to make store as unique information as possible. But, one option is to create a cookie name and set the cookie + store that name in a database of your own. Once the visitor gets back you check that cookie.

Of course, if the user clears the cookies they lose the preferences of your site. But if they don't register that's the pitfall that you will end up having no matter what.

1 like

Please or to participate in this conversation.