Account details

Account details

General

Copy and paste these templates to capture useful details about your user’s account.

The most common data developers send themselves is user’s email (e.g. stephanie.smith@gmail.com). Depending on your app, instead of an email, you might want to report their username (e.g. stephanie_smith), user ID (e.g. 10d1ac10572b) or their screen name (e.g. dragon_slayer).

These will come in handy later on when you have to match a bug to a user for example!

App.kt
import com.shakebugs.shake.Shake
private fun onLoginPressed(username: String, password: String) {
val session = Session()
session.login(username, password, object: LoginListener() {
@override
fun onLoginSucceeded(user: User) {
Shake.setMetadata("id", user.id)
Shake.setMetadata("email", user.email)
Shake.setMetadata("name", user.name)
navigateToHome()
}
@override
fun onLoginFailed(message: String) {
Messages.show(message)
}
})
}

Gaming and education

If your app is in the gaming or education industry, think about sending yourself more specific details about your players or people taking classes, maybe a player’s class (e.g. Wizard), a list of their achievements (e.g. [1, 2, 5, 8, 15]), their difficulty settings (e.g. Beginner) or a list of languages or courses they are taking (e.g. English and Spanish) to get the whole picture about the player without nagging them for more details.

App.kt
import com.shakebugs.shake.Shake
private fun onPlayerSelected(player: Player) {
val type: String = player.type
val difficulty: String = player.difficulty
val achievements: List<int> = player.achievements
Shake.setMetadata("type", type)
Shake.setMetadata("courses", difficulty)
Shake.setMetadata("achievements", achievements.toString())
startGame()
}

B2B

In a more serious B2B environment, you probably want to always report yourself data like user’s account type (e.g. Admin), their subscription plan (e.g. Free) and similar.

App.kt
import com.shakebugs.shake.Shake
private fun onApplicationStarted() {
val user: User = getCurrentUser()
if (user != null) {
Shake.setMetadata("id", user.id)
Shake.setMetadata("plan", user.plan)
Shake.setMetadata("type", user.type)
navigateToHome()
} else {
navigateToLogin()
}
}