I have a pop-up that appears on the homepage after its loading, and I need to make sure that this only happens once for every new visitor.
What is the best way to do this? I'm pretty familiar with jQuery and PHP but to be honest I haven't worked with ANY kind of cookies for a while.
All suggestions are welcome.
I could think of 3 possibilities:
When the event fires, sen an AJAX call to the server. Store the session_id for the user somewhere e.g. in a database (a simple 1 column table with the sessionid would be enough). If you check against the database and find the sessionid there, you know that the user has already fired the event.
Just store the information in a JS cookie. If you want to stick to jQuery, there is a nice plugin for this kind of purpose available.
This could be either the sessionStore or localStore where you can easily save the information you need to identify the fired event.
Personally, I would go with 2 or even 3 if you know the browser of your visitors since not every browser around is capable of this (though I doubt that anybody still wants to support IE6/7)