Learn R Programming

webtrackR (version 0.1.0)

add_session: Add a session variable

Description

add_session() groups visits into "sessions", defining a session to end when the difference between two consecutive timestamps exceeds a cutoff.

Usage

add_session(wt, cutoff)

Value

webtrack data.table (ordered by panelist_id and timestamp) with the same columns as wt and a new column called session.

Arguments

wt

webtrack data object.

cutoff

numeric (seconds). If the difference between two consecutive timestamps exceeds this value, a new browsing session is defined.

Examples

Run this code
if (FALSE) {
data("testdt_tracking")
wt <- as.wt_dt(testdt_tracking)
# Setting cutoff to 30 minutes
wt <- add_session(wt, cutoff = 1800)
}

Run the code above in your browser using DataLab