Data Integrations and Customization
Tracking Rover Screen Views
Screen views and button taps in Rover experiences are tracked into Rover's own analytics features, but if you want to track them in your own analytics tools, you can do so by using registering callbacks with the Rover SDK.
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
.