bounce_rate: calculate the bounce rate within a session dataset

Description Usage Arguments Value See Also Examples

View source: R/metrics.R

Description

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

Usage

1
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

1
2
3
4
5
6
7
8
9
#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)

Ironholds/reconstructr documentation built on Feb. 14, 2022, 9:01 p.m.