SessionIdentifier
  • 1 Minute to read
  • Dark
    Light
  • PDF

SessionIdentifier

  • Dark
    Light
  • PDF

Article summary

General: SessionIdentifier

On a foreign (many-side) table, for the set of records corresponding to each key in the primary (one-side) table, create a sequence counter (an integer discrete field) for each set of records where the elapsed timestamp since the last entry seen is less than the specified duration, in seconds.

Purpose

Use this function to:
  • Organise timestamped data into user sessions of specified duration

Return Value

PropertyValue
FieldTypeInteger
FieldSizeContinuous
DataTypeContinuous
DataSizeInteger


Example Return Value: 1.....N where N is the number of individual sessions that are identified.


Parameters

ParameterJSONDescription
Table“targetTable”: “MyTableName”The target table on which the new field will be created
Filter“dataset”: {DataSet_JSON}Optional.   If a filter is applied, records not in the filter recordset will be returned as null.
Function"function":"sessionidentifier"SessionIdentifier
Primary Table“p1”: “PrimaryTableName”

A primary table that is linked to the target table on the key identifier.

For example, if Table = [transactions], Primary Table could be [customer], where the 2 tables are linked on [cid]

[transactions].[cid] ->[customer].[cid]

Timestamp“p2”:"DateTimeFieldName"Required. The DateTime Field to use for calculating session intervals.
Supports:  
  • DataType: Continuous
  • Field Type: DateTime
Duration Secs“p3”:"#120"Required. The number of seconds in a session.  
Supports:  
  • DataType: 
  • Field Type: 
  • Fixed Value:  
For the specified primary key (e.g., cid=123): 
  • If [Record2_Timestamp - Record1_Timestamp] is greater than [Duration Secs], then a new session identifier will be given to the current record.    
  • If [Record2_Timestamp - Record1_Timestamp] is less than [Duration Secs] then the current record will be given the same session identifier as the previous record.
Duration Secs must be provided in the format #N.
e.g., 
  • #120 = 2 minutes
  • #600 = 10 minutes

JSON Sample

{
  "method": "BuildBakedField",
  "project": "Internet1",
  "targetTable": "webaction",
  "overwrite": true,
  "name": "Session_10mins",
  "function": "sessionidentifier",
  "p1": "UniqueUser",
  "p2": "timestamp",
  "p3": "#600"
}

Usage Notes

See Also:   

  • Engineering | Expression Field
  • DateTime fields

Example

ExampleDetails
DescriptionGroup user transactions into sessions of no more than 2 mins inactivity
Input
  • Table: = [transactions]
  • Filter: = [No Filter]
  • Function: = SessionIdentifier
  • Primary Table:= customer
  • Timestamp:= TimeStampe
  • Duraton Secs:= #120
  • Name: =Session_2mins
Sample





Was this article helpful?