Web events and sessions
Web events and sessions are used in Loymax Smart Communications to process customer actions on an online store website or in a mobile app.
Contents:
Web events
A web event is an action performed by a customer on a website or in a mobile app. In Loymax Smart Communications, web events are objects stored in the database that can be used to build segments, as well as in campaigns and bulk messages.
Web events are linked to an event source (for example, one of several websites or a mobile app).
Along with information about the web event, its context may also be saved. Event context is an object associated with the event. For example, along with the Product added to cart event, the Product object will be saved, i.e., the values of all fields of the product added to the cart.
Methods for receiving information about web events
Loymax Smart Communications can receive information about web events in three ways, described below. Regardless of the transmission method, Loymax Smart Communications creates an object with the same set of attributes (fields) and available actions.
JS tracker
The JS tracker includes a set of preconfigured web events (such as website authorization or product view), as well as the ability to configure arbitrary custom events (for example, a customer giving a product a low rating).
Mobile SDK
The event method of the Mobile SDK allows transmitting arbitrary web events related to customer activity in the mobile app to Loymax Smart Communications. The set of supported events is configured during integration.
REST API
The Partner's master system can transmit information about web events to Loymax Smart Communications via REST API calls (Web_event method).
Sessions
A session is a sequence of customer actions on a website or in a mobile app (i.e., a sequence of web events). The session identifier is a mandatory attribute of a web event and allows linking it to the customer.
If no user_login or user_visit event with a filled customer identifier field was transmitted within the session (for example, a customer browses products on the site without logging in), the session will be anonymous. Anonymous sessions are stored in the Loymax Smart Communications database for 60 days.
Session handling logic differs depending on how web events are transmitted to Loymax Smart Communications.
Handling sessions via JS tracker
When a new session starts, the JS tracker creates and sends a cookie file to the client. At the same time, the user_visit event is automatically generated and recorded in the database. Subsequent customer actions will be linked to the session via this cookie. The cookie lifetime is 1 hour, with automatic renewal after each new action.
If the customer has previously logged in to the website and still has a cookie file from a previous session, the JS tracker will automatically fill in the customer identifier field. Additionally, the JS tracker will fill in the customer identifier field if the user arrived at the site via a link from an email campaign.
In other cases, identifying the customer requires transmitting the authorization and registration event (user_login) to the JS tracker. The corresponding code needs to be added to the authorization page.
If the cookie lifetime expires and the customer performs a new action, the JS tracker creates a new cookie file and starts a new session.
Handling sessions via Mobile SDK and REST API
When working via Mobile SDK and/or REST API, the logic for grouping events into sessions must be implemented on the Partner's side. Web events are transmitted to Smart Communications using the event method of the Mobile SDK and the Web_event method of the REST API.
When starting a new session, you must transmit the user_login or user_visit event with the session identifier (session_id) and customer identifier in the master system (user_id) fields filled in. All subsequent events must have the session identifier field (session_id) filled.