Braze

Braze is an analytics and marketing automation product. You can track Rover events into Braze to use it for either or both using the following sample integration. You may need to customize it to get the best value out of the tool.


Sending Rover events to Braze

After integrating both the Rover and Braze SDKs into your project, your goal will be to send all the Rover events to Braze as Braze custom events.


Create a Listener for Rover Events

Rover.shared?.eventEmitter?.addEventListener(object : RoverEventListener {
     // see below for implementations.
}

Experience Presented

override fun onExperiencePresented(event: RoverEvent.ExperiencePresented) {
    val properties = AppboyProperties()
    properties.addProperty("experienceID", event.experience.id)
    properties.addProperty("experienceName", event.experience.name)
    if(event.campaignId != null) {
        properties.addProperty("campaignID", event.campaignId)
    }

    Appboy.getInstance(this@SampleApplication).logCustomEvent(
        "Rover Experience Presented",
        properties
    )
}

Experience Dismissed

override fun onExperienceDismissed(event: RoverEvent.ExperienceDismissed) {
    val properties = AppboyProperties()
    properties.addProperty("experienceID", event.experience.id)
    properties.addProperty("experienceName", event.experience.name)
    if(event.campaignId != null) {
        properties.addProperty("campaignID", event.campaignId)
    }

    Appboy.getInstance(this@SampleApplication).logCustomEvent(
        "Rover Experience Dismissed",
        properties
    )
}

Experience Viewed

This event describes the session (duration, primarily) spent viewing a Rover Experience.

override fun onExperienceViewed(event: RoverEvent.ExperienceViewed) {
    val properties = AppboyProperties()
    properties.addProperty("experienceID", event.experience.id)
    properties.addProperty("experienceName", event.experience.name)
    properties.addProperty("duration", event.duration)
    if(event.campaignId != null) {
        properties.addProperty("campaignID", event.campaignId)
    }

    Appboy.getInstance(this@SampleApplication).logCustomEvent(
        "Rover Experience Viewed",
        properties
    )
}

Screen Presented

override fun onScreenPresented(event: RoverEvent.ScreenPresented) {
    val properties = AppboyProperties()
    properties.addProperty("experienceID", event.experience.id)
    properties.addProperty("experienceName", event.experience.name)
    properties.addProperty("screenID", event.screen.id)
    properties.addProperty("screenName", event.screen.name)
    if(event.campaignId != null) {
        properties.addProperty("campaignID", event.campaignId)
    }

    Appboy.getInstance(this@SampleApplication).logCustomEvent(
        "Rover Screen Presented",
        properties
    )
}

Screen Dismissed

override fun onScreenDismissed(event: RoverEvent.ScreenDismissed) {
    val properties = AppboyProperties()
    properties.addProperty("experienceID", event.experience.id)
    properties.addProperty("experienceName", event.experience.name)
    properties.addProperty("screenID", event.screen.id)
    properties.addProperty("screenName", event.screen.name)
    if(event.campaignId != null) {
        properties.addProperty("campaignID", event.campaignId)
    }

    Appboy.getInstance(this@SampleApplication).logCustomEvent(
        "Rover Screen Dismissed",
        properties
    )
}

Screen Viewed

This event describes the session (duration, primarily) spent viewing an individual screen within a Rover Experience.

override fun onScreenViewed(event: RoverEvent.ScreenViewed) {
    val properties = AppboyProperties()
    properties.addProperty("experienceID", event.experience.id)
    properties.addProperty("experienceName", event.experience.name)
    properties.addProperty("screenID", event.screen.id)
    properties.addProperty("screenName", event.screen.name)
    properties.addProperty("duration", event.duration)
    if(event.campaignId != null) {
        properties.addProperty("campaignID", event.campaignId)
    }

    Appboy.getInstance(this@SampleApplication).logCustomEvent(
        "Rover Screen Viewed",
        properties
    )
}

Block Tapped

override fun onBlockTapped(event: RoverEvent.BlockTapped) {
    val properties = AppboyProperties()
    properties.addProperty("experienceID", event.experience.id)
    properties.addProperty("experienceName", event.experience.name)
    properties.addProperty("screenID", event.screen.id)
    properties.addProperty("screenName", event.screen.name)
    properties.addProperty("blockID", event.block.id)
    properties.addProperty("blockName", event.block.name)
    if(event.campaignId != null) {
        properties.addProperty("campaignID", event.campaignId)
    }

    Appboy.getInstance(this@SampleApplication).logCustomEvent(
        "Rover Block Tapped",
        properties
    )
}