time_on_page: Calculate time-on-page metrics

Description Usage Arguments Value See Also Examples

Description

time_on_page generates metrics around the mean (or median) time-on-page - on an overall, per-user, or per-session basis.

Usage

1
time_on_page(sessions, by_session = FALSE, median = FALSE, precision = 2)

Arguments

sessions

a sessions dataset, presumably generated with sessionise.

by_session

Whether to generate time-on-page for the dataset overall (FALSE), or on a per-session basis (TRUE). FALSE by default.

median

whether to generate the median (TRUE) or mean (FALSE) time-on-page. FALSE by default.

precision

the number of decimal places to round the output to - set to 2 by default.

Value

either a single numeric value, representing the mean/median time on page for the overall dataset, or a data.frame of session IDs and numeric values if by_session is TRUE.

See Also

sessionise for session reconstruction, and session_length, session_count and bounce_rate for other session-related metrics.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#Load and sessionise the dataset
data("session_dataset")
sessions <- sessionise(session_dataset, timestamp, uuid)

# Calculate overall time on page
top <- time_on_page(sessions)

# Calculate time-on-page on a per_session basis
per_session <- time_on_page(sessions, by_session = TRUE)

# Use median instead of mean
top_med <- time_on_page(sessions, median = TRUE)

reconstructr documentation built on May 2, 2019, 8:51 a.m.