Recording the number of users on the SmartSpace website
The assertion 'Object' web feature 'String' has 'Int' users at 'Time', introduced in SmartSpace 3.8 SP2, contains rows showing the numbers of browser windows that are open for various features on the SmartSpace website on a minute-by-minute basis.
These statistics can be viewed in real-time in TYPES / OBJECTS in SmartSpace Config by dragging the assertion from the list of complex properties into the workspace:
In each row:
-
The first item is the Object in the dataset with the name "Site". This is normally the top-level cell and is the same for every row in the assertion. It can effectively be ignored (it exists only because the assertion requires an object as a key)
-
Web feature is the part of the website users have opened, which can be:
-
ObjectView[:web partition]
Anytime someone has a connection to ObjectView open it is counted here.
[:web partition] identifies the web partition in installations where web-partitioning has been implemented.
-
Page:<path>[:web partition]
Anytime a browser is running in a particular page it is added to the count for that page
Web feature pages are identified by a code.
For example, Page:/SmartSpace/IF is the web map.
[:web partition] identifies the web partition in installations where web-partitioning has been implemented.
-
-
Count is the number of users who have been on the page for at least 5 seconds
-
The Time of the count is updated every minute
Updates and screen refreshes
Counts may be temporarily too high or too low due to the following:
-
Because the count is updated once a minute, it can take up to two minutes for the count to be decremented when a user leaves a feature.
-
Every time a screen is refreshed in the browser, or if the screen is opened multiple times so long as the screen is open for more than 5 seconds, it gets a new ID which can transiently inflate the count.
HMIs and web applications included in the user statistics
HMIs that are opened with the SmartSpace HMI wrapper around them are automatically included in the counts. See Options in HMI Settings and the description of the The HMI API.
HMIs and SPAs that do not use the SmartSpace HMI wrapper are not automatically included in user statistics. However they can be included by having them periodically call the required API.
To include an HMI (or other external web app) that does not use the SmartSpace HMI wrapper in the user statistics, you can register its path by doing a POST to the following address:
/SmartSpace/IFAPI/ifpublic/hello
The contents posted should be a unique ID and a path. For example:
{ "Id": 1689054729612, "Path": "/SmartSpace/CS" }
Typically the HMI should send the first post after being open for a few seconds, and thereafter two updates per minute.
Health monitoring and User Statistics
User statistics can also be used with the Health monitoring feature (if licensed).
Counts are written to the ubisense_web_feature_has_users metric with the feature as a parameter:
ubisense_web_feature_has_users{feature="ObjectView"} 2 1688994900006 ubisense_web_feature_has_users{feature="Page:/SmartSpace/AI"} 3 1688994900006 ubisense_web_feature_has_users{feature="Page:/SmartSpace/CS"} 1 1688994900006 ubisense_web_feature_has_users{feature="Page:/SmartSpace/HMI"} 1 1688994900006 ubisense_web_feature_has_users{feature="Page:/SmartSpace/IF"} 3 1688994900006
Reporting User Statistics
The 'Object' web feature 'String' has 'Int' users at 'Time' property can also be used with SmartSpace's Reporting feature.
Because the values in the rows are actually updating with time, the property is intended to be used non temporally and keep values forever. So in PROPERTY HISTORY, when defining how to log the property, ensure you choose to log only current values:
Note: We recommend that if you log this property to a database, you should create an index on at least the 'Time' column:
CREATE NONCLUSTERED INDEX web_features_idx ON U__IDENTIFYFIND____OBJECT_WEB_FEATURE___STRING_HAS___INT_USERS_AT___TIME_ ( [S_TIME] ASC )
For further information on configuring a database connection and properties to be logged, see Configuring Reporting.
You can use the logged property to build a query that shows you the counts. The three important fields for the query are:
-
the name of the feature, which is a string
-
the count, which is an INT
-
the time that's recorded
With logging for 'Object' web feature 'String' has 'Int' users at 'Time' defined in SmartSpace Config, in SmartSpace Web use the Query editor to add the property as a source and create three result expressions for feature names, user count and time:
Use the Test button to test the query and display the table showing the test output. Save the query and use it to create a report. In the example below, a multi-bar chart displays the user statistics:
See Designing Reports in SmartSpace for further assistance with report creation.