User Tracking
Setting up the User Tracking module
The User Tracking module requires adding the UserActions table to the database. This can be done by running the script at /Areas/Lynicon.Base/Admin/SQL/UserTrackingInit.sql.
Configuring the User Tracking module
Setting the KeepFor property to a Timespan means that the module will purge any UserAction records created longer ago than the KeepFor period of time.
Facilities provided by the User Tracking module
User Tracking provides various facilities on server and client side for tracking users and their actions. Server side functionality includes:
- GetUserId() returns a guid which is either the current user id or a random user id which is the same between requests from the same unlogged-in user.
- TrackVisit(PageContent page) stores a visit UserAction to the page whose content is supplied, and stores the visit in a client-side cookie used for that purpose
- RecordEvent(string actionCode, string data, string itemId, Guid? userId) stores an action against the given user id with the supplied action code, action data, serialized itemId. The user id supplied should be null if no user is logged in.
- CountEvent(Guid eventId, string actionCode) records an event with given action code against the current user, and increments a count for events of this type stored in a cookie which stores counts on the client side
- GetVisitEvents() gets an object which contains the recorded visits by this user
- GetCountEvents() gets an object which contains the recorded counts for events by this user
Client side functionality includes the potential for accessing the abovementioned cookies, and the following HTTP service urls:
- POST /lynicon/tracking/record with arguments: 'actionCode' - the action code; 'data' - any data you want to include; 'itemId' - the serialized item id of the relevant content item; 'userId' - current user id as a string