How can I get the number of current users on the site that are not signed in?
Also, how can I trigger a workflow, each time a new unique visitor is on the app (not on a specific page .i.e. I cannot use the on-page-load trigger with condition of current user not being logged in—I need to be able to identify the current user so as not to trigger again on page change or refresh).
Is there any identifier of unlogged users? IPs? Browser fingerprints? etc.?
Great question! One option might be to create a reusable element without elements inside, so that you can reuse the same set of workflows that count your current users that are not logged in. You can find more information on this here. Let us know if that helps or if you have any more questions!
Oh interesting! So the re-usable element workflow would work globally.
I can see how this would solve counting a same non-logged user twice who is navigating across the app.
But how could I keep track of the user identity though?
To check logged in users who are online, a workflow logs time every couple of seconds and so if it wasn’t logged after some time I can infer the user is offline.
For unlogged users though, how can I keep track? Is there some form of identifier I can use?
Edit: I just figured out non-logged users also have unique IDs! They even remain after refresh. So that’s excellent.
How are IDs managed thereafter? Do they get deleted? Are they tied to the user session if they do not use incognito windows?
Okay so with help of Jess, the solution is as follows:
- Create a re-usable element without children element and call it user_tracker.
- Create a datatype and call it User Tracker, with a user text field and a last online datetime field. (See Notes below)
- Create a workflow, repeat every 5 seconds, inside the user_tracker reusable element. The workflow will record the current timestamp in an existing user_tracker data entry with the same unique ID or create a new entry if failing to edit an existing one.
NB (28 April 21) : to display this tracker information back on to UI, you may need to remove default privacy rules to allow searching for your user tracker items in the database.
Great solution, thanks for summarizing it for fellow users! I was just about to reply that non-logged in users also have unique IDs, but you beat me to the punch; nice sleuthing. If you have any more questions, do let us know.
Yes, I do: what is the unique ID tied to? It seems to disappear with a new incognito session. What if a user uses a regular browser session? Does it stay as long as the user doesn’t clear cache or cookies? How ephemeral is this ID?
PS: I am also experiencing an issue and not sure if it’s a bug or not, but when I do a search for user tracker (my data type), it fails returning those trackers that were created from un-logged users and only returns logged users. I can clearly seem them in the database, but the do a search call just can’t seem to find them…
It may be because they don’t have any user in the “created by” field?
If the user returns using the same browser and does not clear cache or cookies, the temporary user will last for 3 days (more details here).
In regard to the search for the user tracker type, would it be possible to email us at [email protected] with some screenshots/more information about the current setup? Happy to take a closer look.
Thanks Jess. I sent a mail about the potential bug.
Regarding the documentation, I read the following:
The temporary user behaves like a signed up user, in the sense that you can modify it, and it will be saved to the application database.
However , I am not seeing temporary users in the database. Where are they to be found?
This topic was automatically closed after 70 days. New replies are no longer allowed.