Forum Academy Marketplace Showcase Pricing Features

Storing session data without login

How would you recommend storing data against a session without login? Eg. You have users coming in via referral link in an email (which has tracking info) and you want to save the referral data to the user after they create an account.

In my case I should also note that I am using a Facebook login as the primary authentication mechanism in my app and it seems that URL parameters get lost when users have authenticated and return from Facebook.

Is there some session object that can be used for this or do I need to find a workaround using my own data model?

You can always store it against the user. That works as an anonymous cookie based “user”.

That’s really helpful to know. So does that mean that anything stored with a non-logged-in user is stored in a cookie, whereas it’s stored in the DB if the user is logged in?

EDIT: Helpful posts…

Session variables
Do we have access to save cookies?

Does anyone know the answer to shot62’s question?

“Does that mean that anything stored with a non-logged-in user is stored in a cookie, whereas it’s stored in the DB if the user is logged in?”

I am trying to implement a similar thing.
I want a user to be able to make bookings for a hotel and then when prompted to login/sign-up, after login/sign-up the booking details is saved to that user.
How do I go about doing this?