Measure Wait Time

The wait time, also known as dwell time, is the time that a mobile app user spends waiting after arriving at a site and before being acknowledged by a monitor app user.

Acknowledgment is use-case specific but commonly includes scanning a barcode or verifying a passcode on the mobile app user’s device. It is the responsibility of the developer to indicate the time of acknowledgment using the ARRIVE SDK so that wait time can be calculated.

The wait time metrics are unavailable in the ARRIVE dashboard unless the CSEventLocatedUserAtSite event is submitted to the ARRIVE SDK.

Measuring Wait Time with a QR Code Scan

One way to accurately measure wait time is to instruct users of the monitor app to scan a QR code that encodes the trackToken and trackingIdentifier when servicing trips.

Trip Started on the Mobile App

[CSUserSession currentSession].trackingIdentifier = @"user123";
[[CSUserSession currentSession] startTripToSiteWithIdentifier:@"hardwaredepot_1337" trackToken:@"order456"]
CSUserSession.current().trackingIdentifier = "user123"
CSUserSession.current().startTripToSite(withIdentifier: @"hardwaredepot_1337", trackToken: @"order456")

After using the code snippet above to start a trip, we can create a JSON payload that has the two identifiers required by the CSEventLocatedUserAtSite event and encode it in a QR code.

JSON Snippet

["user123", "order456"]

Display the QR Code in the Mobile App

When the user arrives, you can display the QR code so that the mobile app user can show it to the monitor app user.

Use the [userArrivedAtSite] on the [CSUserSession] delegate to trigger the display of the QR code when the user arrives:

- (void)session:(CSUserSession *)session userArrivedAtSite:(CSSite *)site
	// Display the QR code in the mobile app here
func session(_ session: CSUserSession, userArrivedAt site: CSSite) {
	// Display the QR code in the mobile app here

Trip Acknowledged on the Monitor App

TrackingIdentifier and trackToken can be extracted when scanning the QR code that was defined above.

When these two values are available, the CSEventLocatedUserAtSite event must be submitted to the ARRIVE SDK.

The following code submits the event at the current site in the monitor app:

[[CSMonitoringSession currentSession] addEvent:CSEventLocatedUserAtSite forTrackToken: trackToken siteIdentifier: [CSMonitoringSession currentSession].arrivalSite.siteIdentifier properties: nil]
CSMonitoringSession.current().add(.locatedUserAtSite, forTrackToken: trackToken, siteIdentifier: CSMonitoringSession.current().arrivalSite?.siteIdentifier, properties: nil)

When this event is implemented in your monitor app, you will see that the wait time is populated in the ARRIVE dashboard. The wait time is calculated as the median wait time over the last 30 days.

Wait time