Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
I am trying to track how much time users spend on thingworx. It is kind of like how this PTC community portal tracks how many minutes each user spends here.
I have a couple of subscriptions that tracks when a user logs in and when a user logs out. It updates a property called trueLastConnection, when the following "SecurityMonitor" events occur:
In the subscription called "UpdateTrueLastConnectionLogout", I have the following code:
var currentDate = new Date();
Users[eventData.user].TotalMinutesOnline = Users[eventData.user].TotalMinutesOnline + ((currentDate - Users[eventData.user].trueLastConnection)/60000);
Users[eventData.user].trueLastConnection = currentDate;
This subscription is triggered by the "SecurityMonitor" event called "Logout".
I expected it to update the user property called "TotalMinutesOnline"; however, I noticed that it only works if the user actually clicks on the logout button. If the user closes the tab or browser, it seems the "TotalMinutesOnline" property does not get updated. Is there a way to check how much time a user spends on thingworx?
@Willie , refer to below article CS337758, currently Thingworx can get login/logout history, not the total online time:
Forgot to mention that I have added the properties called "trueLastConnection" and "TotalMinutesOnline" to the "UserExtensions" Thing Shape. I am using the subscriptions mentioned in my previous post to update these properties.
In the article, it states, "Currently ThingWorx does not log any session timeout activities." If an event for user session timeout were available, I would be able to log users minutes online. Is this something that will be available in the future? Or is there a way to somehow get the time when a user session times out?
To request this functionality, I suggest to submit an idea at PTC Community refer to article CS67713 so that Product Manager Team evaluate the feature and consider to add it in a future release.