Script only one per 24hrs

mafer

Registered Member
Joined
Mar 25, 2015
Messages
69
Reaction score
7
Hi, can someone give me code which will I add to my popup and popup will be shown only once in 24hrs per one user.
Thanks and sorry for bad English.
 
Last edited:
If you are using wordpress I am sure there are pop up plugins that have that functionality.
 
I am not sure about that but I know that the plugins I have seen in order to have a pop up on WP almost always give you the option to set limits.
 
Hi there,

A lot of ways to achieve it by using database, javascript storage and cookies.

1. Add an additional field to the user table set and get the values to show popup. If the field doesn't show popup after you set it, use CRON / SCHEDULER jobs to reset that field for entire users in the very first minutes of the day.

2. Use javascript local storage to store session keys to handle this, and by the same way you got to reset the session timeout to a particular time (24 hours).

3. Create cookie with the life time of 24 hours to get your requirement done.

Hope this helps!
 
Simplest way is to use cookies, create a cookie with 24hs expire time when you first fire your popup, and when firing the popup check for the cookie, if it already exists don't fire it.
 
Back
Top