bounce_rate: calculate the bounce rate within a session dataset

View source: R/metrics.R

bounce_rateR Documentation

calculate the bounce rate within a session dataset

Description

Calculates the "bounce rate" within a set of sessions - the proportion of sessions consisting only of a single event.

Usage

bounce_rate(sessions, user_id = NULL, precision = 2)

Arguments

sessions

a sessions dataset, presumably generated with sessionise.

user_id

a column that contains unique user IDs. NULL by default; if set, the assumption will be that you want per-user bounce rates.

precision

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

Value

either a single numeric value, representing the percentage of sessions overall that are bounces, or a data.frame of user IDs and bounce rates if user_id is set to a column rather than NULL.

See Also

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

Examples

#Load and sessionise the dataset
data("session_dataset")
sessions <- sessionise(session_dataset, timestamp, uuid)

# Calculate overall bounce rate
rate <- bounce_rate(sessions)

# Calculate bounce rate on a per-user basis
per_user <- bounce_rate(sessions, user_id = uuid)


reconstructr documentation built on March 18, 2022, 7:05 p.m.