Skip to content

Tracking Gimbal Events

Sam Woodall edited this page Jul 30, 2019 · 2 revisions

If you're using Gimbal for location related updates you can track the reception of these events with Rover Campaigns. These events can then be used to trigger Rover related events such as sending a push notification that launches an experience. An example of tracking a Gimbal Visit Started event is shown below. The same logic can be applied for other Gimbal events.


Sending Gimbal Events to Rover

val placeEventListener = object : PlaceEventListener() {
    override fun onVisitStart(visit: Visit?) {
        super.onVisitStart(visit)

        visit?.let {
            val event = Event("Visit Started", mapOf(
                "arrivalDate" to it.arrivalTimeInMillis,
                "departureDate" to it.departureTimeInMillis,
                "dwellTime" to it.dwellTimeInMillis,
                "place" to mapOf("name" to it.place.name, "identifier" to it.place.identifier),
                "visitID" to it.visitID
            ))

            RoverCampaigns.shared?.resolve(EventQueueServiceInterface::class.java)?.trackEvent(event, "gimbal")
        }
    }
}

PlaceManager.getInstance().addListener(placeEventListener)