Data & Customization

Tracking Rover Events into Third-Party Analytics

Rover tracks a range of events internally — from experience screen views and button taps to notification opens and app lifecycle events — and you can forward any of these into your own analytics tools. The Rover SDK provides two mechanisms for this: targeted callbacks for experience interactions, and a lower-level event pipeline observer for everything else.


Screen Views

The registerScreenViewedCallback method on the Rover SDK singleton allows you to register a callback to be fired whenever an experience screen is viewed. The callback is given a single parameter, a value type with properties giving details about the experience and the screen.

iOS

// Add a screen viewed callback handler:
Rover.shared.registerScreenViewedCallback { event in
    // track screen view event into your own analytics tools here.
    // a common pattern for naming screens in many is to indicate hierarchy with slashes.  We'll
    // create a screen name out of the experience's name and screen name, if provided.
    let screenName = "\(event.experienceName ?? "Experience") / \(event.screenName ?? "Screen")"
    os_log("Rover experience screen viewed: %s", type: .default, screenName)
    
    // MyAnalyticsSDK.trackScreen(screenName)
}

Android

// You can wire up a callback to be informed of Experience screen views, for example
// for tracking events into another analytics tool:
Rover.shared.registerScreenViewedCallback { screenViewed ->
    // track screen view event into your own analytics tools here.
    // a common pattern for naming screens in many is to indicate hierarchy with slashes.  We'll
    // create a screen name out of the experience's name and screen name, if provided.
    val screenName = "${screenViewed.experienceName ?: "Experience"} / ${screenViewed.screenName ?: "Screen"}"

    Log.e("RoverExampleApplication", "Rover experience screen viewed: $screenName")

    // MyAnalyticsSDK.trackScreen(screenName)
}

Callback Parameter

On both platforms, your callback is given a single parameter, a value type. Here are the properties:

  • experienceID: the id of the Rover experience itself.
  • experienceName: the name of the Rover experience itself.
  • screenName : the name given to the screen being presented in the Rover experience.
  • screenID : the id of the screen being presented in the Rover experience.
  • screenProperties : metadata properties associated with the presented screen.
  • screenTags : metadata tags associated with the presented screen.
  • campaignID: the id of the campaign associated with this experience. This is typically used for analytics purposes.
  • data: JSON data from a Web API data source. Not applicable to classic experiences.
  • urlParameters: URL query parameters included with the URL that launched the experience. Not applicable to classic experiences.

Button Taps

The registerButtonTappedCallback method on the Rover SDK singleton allows you to register a callback to be fired whenever a button is tapped in an experience. The callback is given a single parameter, a value type with properties giving details about the experience and the button.

iOS

// Add a button tapped callback handler:
Rover.shared.registerButtonTappedCallback { event in
    // track button tap event into your own analytics tools here.
    
    // all the same fields are available as for screen views, plus
    // fields for the button node itself (or block, in the case
    // of a button in a classic experience.)

    let eventName = "\(event.nodeName) Tapped"

    // MyAnalyticsSDK.track(eventName)
}

Android

Rover.shared.registerButtonTappedCallback { buttonTapped ->
    // track button tap event into your own analytics tools here.
    
    // all the same fields are available as for screen views, plus
    // fields for the button node itself (or block, in the case
    // of a button in a classic experience.)

    val eventName = "${buttonTapped.nodeName} Tapped"

    // MyAnalyticsSDK.track(eventName)
}

Callback Parameter

On both platforms, your callback is given a single parameter, a value type. Here are the properties:

  • nodeID: the id of the button node (or block, in classic experiences) that was tapped.
  • nodeName: the name of the button node (or block, in classic experiences) that was tapped.
  • nodeProperties: metadata properties associated with the button node (or block, in classic experiences) that was tapped.
  • nodeTags: metadata tags associated with the button node (or block, in classic experiences) that was tapped.
  • experienceID: the id of the Rover experience itself.
  • experienceName: the name of the Rover experience itself.
  • screenName : the name given to the screen being presented in the Rover experience.
  • screenID : the id of the screen being presented in the Rover experience.
  • screenProperties : metadata properties associated with the presented screen.
  • screenTags : metadata tags associated with the presented screen.
  • campaignID: the id of the campaign associated with this experience. This is typically used for analytics purposes.
  • data: JSON data from a Web API data source. Not applicable to classic experiences.
  • urlParameters: URL query parameters included with the URL that launched the experience. Not applicable to classic experiences.

Field naming on Android

On Android the ID field names are suffixed with Id instead of ID.


Other Rover Events

Beyond experience screen views and button taps, Rover tracks a range of events internally — such as "Notification Opened", "Location Updated", "App Opened", and others — through its event pipeline. You can observe all events passing through this pipeline, which allows you to forward them to your own analytics tools.

iOS

On iOS, implement the EventQueueObserver protocol and register your observer with Rover.shared.eventQueue. Your observer will receive a callback for every event that is enqueued.

Make sure to hold a strong reference to your observer (for example, as a property on your AppDelegate or App struct), because the SDK holds it weakly.

// Implement the EventQueueObserver protocol:
class MyAnalyticsObserver: EventQueueObserver {
    func eventQueue(_ eventQueue: EventQueue, didAddEvent info: EventInfo) {
        // Forward to your own analytics tool:
        // MyAnalyticsSDK.track(info.name, properties: info.attributes)
        print("Rover event: \(info.name)")
    }
}

// In your AppDelegate or App init, after Rover.initialize(...):
let analyticsObserver = MyAnalyticsObserver() // retain this strongly
Rover.shared.eventQueue.addObserver(analyticsObserver)

The EventInfo value passed to your callback has the following properties:

  • name: the event name (e.g. "Notification Opened", "App Opened").
  • namespace: groups events by origin (e.g. "rover" for built-in events, "ticketmaster" for Ticketmaster integration events).
  • attributes: a dictionary of additional metadata associated with the event.
  • timestamp: the time the event was recorded (optional; defaults to the current time if not set).

Android

On Android, subscribe to the trackedEvents publisher on Rover.shared.eventQueue. This is a reactive-streams Publisher<Event> that emits every event as it is tracked.

// After Rover.initialize(...):
Rover.shared.eventQueue.trackedEvents.subscribe { event ->
    // Forward to your own analytics tool:
    // MyAnalyticsSDK.track(event.name, event.attributes)
    Log.d("MyApp", "Rover event: ${event.name}")
}

The Event value emitted has the following properties:

  • name: the event name (e.g. "Notification Opened", "App Opened").
  • attributes: a map of additional metadata associated with the event.
  • timestamp: the time the event was recorded.
  • id: a unique UUID for this event instance.
Previous
Privacy