Hi everyone!
I would like to include a number counter that always runs for 24 hours counting up to a specified number regardless if users visit the page or not. Meaning every time a user visits the page the same day (or within that 24 hour run starting at 12 at night or so) he sees a different increased number, but also sees the number increasing slowly while on the page. This is supposed to give the impression of something like a follower count increasing constantly. Does this makes sense?
Now I was wondering if there’s an existing widget for this already or if that’s relatively easy to code? Asks me without really any coding experience 
Any ideas anyone?
Hi,
What you are asking for is a task that runs in the “background” on the server. Wix Code does not currently support this. There are some ways that you could fake this, but it would require coding - which you admit you have no experience.
@acuratang,
Nice example, but it won’t continue to run in the background when the user goes away from the site. As I said, it can be “faked” using “vanilla” Wix Code without resorting to an HtmlComponent.
Thanks,
Yisrael
@ Yisrael (Wix)
Appreciate your input!
Despite me not being a coder, how difficult would a fake be? I could hand it off to out developers.
And what you are saying is, that it is possible to fake it in a way, so the number doesn’t always start at zero again a user revisits the website?
Cheers
if you rely want it to count in the background just save the start time with
getCurrentGeolocation( ) in local storage. When the user comes back just subtract that with the current time then divide by the tick rate and that will give you the number of ticks that passed when the user is not there, hope this helps
@ acuratang
The counter is a visual for the visitor to give the impression of constantly increasing numbers. Not for our stats. It can be fake, just needs to always increase in the background. But thx for the idea.
Hey Flash,
I was thinking of just getting the UTC Date . A Javascript Date object is really just the number of milliseconds that have passed since 1 Jan 1970. So, what you end up with is a number that progresses in a consistent and predictible manner without having to worry about incrementing it yourself. You could take that number - a big number, being the number of milliseconds since 1970 - and then do some sort of arithmetic mangling that would result in a number that would make sense for your needs.
The idea that @acuratang has isn’t far off from mine. I just ignore location and worrying about accuracy. You can do whatever mathematical manipulation you want to ensure getting a number that makes some sort of sense.
Be creative, have fun, and I hope this helps.
Yisrael
@ Yisrael (Wix)
I see. I’ll give it some thought and try.
Thanks so much, everyone!