time_on_page | R Documentation |
time_on_page
generates metrics around the mean (or median)
time-on-page - on an overall, per-user, or per-session basis.
time_on_page(sessions, by_session = FALSE, median = FALSE, precision = 2)
sessions |
a sessions dataset, presumably generated with
|
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. |
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.
sessionise
for session reconstruction, and
session_length
, session_count
and
bounce_rate
for other session-related metrics.
#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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.