dwell_time: Identify User Satisfaction Rate Based on Dwell Time

Description Usage Arguments Examples

View source: R/dwell.R

Description

One simple satisfaction heuristic is to look at the dwell time a user has on each page in a session and whether any one of those dwell-times exceeds a certain threshold. If it does, that session is deemed to be one in which the user was satisfied. dwell_time calculates that for a data.frame of user sessions.

Usage

1
dwell_time(data, id_col, ts_col, dwell_threshold = 100)

Arguments

data

a data.frame containing session data

id_col

the name or index of the column containing unique session IDs

ts_col

the name or index of the column containing timestamps

dwell_threshold

the value (in seconds) to use to indicate a "successful" session

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Data:
ts <- as.POSIXct(
  c("2016-03-01T06:52:49Z", "2016-03-01T06:53:19Z", "2016-03-01T06:53:39Z"),
  format = "%Y-%m-%dT%H:%M:%SZ", tz = "UTC"
)
x <- data.frame(timestamp = ts, session_id = "0024c4506bf92e1c")

# Use default threshold:
dwell_time(x, "session_id", "timestamp")

# Use 10s threshold:
dwell_time(x, "session_id", "timestamp", 10)

wikimedia/wikimedia-discovery-ortiz documentation built on Aug. 23, 2020, 9:46 a.m.