Learn R Programming

reconstructr (version 1.1.1)

bounce_rate: 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, decimal_places = 2)

Arguments

sessions
a list of sessions, generated with reconstruct_sessions
decimal_places
the number of decimal places to round the output to - set to 2 by default.

Value

a single numeric value, representing the percentage of sessions that are bounces.

See Also

session_events for generaliseable event-level calculations, and link{event_time} for performing operations on the time between events.

Examples

Run this code
#Calculate the bounce rate in the provided dataset.
#Load, convert timestamps to seconds, split
data("session_dataset")
session_dataset$timestamp <- to_seconds(x = session_dataset$timestamp, format = "%Y%m%d%H%M%S")
events_by_user <- split(session_dataset$timestamp, session_dataset$UUID)

#Sessionise and calculate bounce rate
sessions <- reconstruct_sessions(events_by_user)
bounce_rate(sessions)
#[1]58

Run the code above in your browser using DataLab