Tracking User Authentication: Biometric and Email Logins
- 2 Minutes to read
- Print
- DarkLight
Tracking User Authentication: Biometric and Email Logins
- 2 Minutes to read
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
Biometric login (e.g., fingerprint or facial recognition) provides a streamlined login process. The Mapp Intelligence SDK allows you to track events when a biometric login is successful or failed.
Email Login: Tracks user logins using username and password, sending a tracking event when the input is valid.
Biometric Login: Tracks user logins using biometric data (e.g., fingerprint, facial recognition), sending tracking events for successful or failed logins.
Due to technical restrictions, it is difficult to distinguish the type of device recognition used. It is possible to detect the preferred login type, though.
//Username and password login (email login):
view.findViewById<Button>(R.id.login_button).setOnClickListener {
if (!validate()) {
onSignupFailed()
return
}
//Tracking event is sent if inpuit is valid
val params: LinkedHashMap<String, String> = LinkedHashMap()
params.put("ck2", "screen_name")
params.put("ck5", "login_mail")
Webtrekk.getInstance().trackCustomEvent("click.button", params)
}
//Biometric login:
private val authenticationCallback = object : BiometricPrompt.AuthenticationCallback() {
override fun onAuthenticationError(errorCode: Int,
errString: CharSequence) {
super.onAuthenticationError(errorCode, errString)
Toast.makeText(applicationContext,
"Authentication error: $errString", Toast.LENGTH_SHORT)
.show()
}
override fun onAuthenticationSucceeded(
result: BiometricPrompt.AuthenticationResult) {
super.onAuthenticationSucceeded(result)
Toast.makeText(applicationContext,
"Authentication succeeded!", Toast.LENGTH_SHORT)
.show()
//Tracking event is sent on authentication success
val params: LinkedHashMap<String, String> = LinkedHashMap()
params.put("ck2", "screen_name")
params.put("ck5", "biometric_login")
Webtrekk.getInstance().trackCustomEvent("click.button", params)
}
override fun onAuthenticationFailed() {
super.onAuthenticationFailed()
Toast.makeText(applicationContext, "Authentication failed",
Toast.LENGTH_SHORT)
.show()
}
}
//Username and password login (email login):
view.findViewById(R.id.login_button).setOnClickListener(v -> {
if (!validate()) {
onSignupFailed();
return;
}
//Tracking event is sent if input is valid
Map<String, String> params = new LinkedHashMap<>();
params.put("ck2", "screen_name");
params.put("ck5", "login_mail");
Webtrekk.getInstance().trackCustomEvent("click.button", params);
});
//Biometric login:
BiometricPrompt.AuthenticationCallback authenticationCallback = new BiometricPrompt.AuthenticationCallback() {
@Override
public void onAuthenticationError(int errorCode,
@NonNull CharSequence errString) {
super.onAuthenticationError(errorCode, errString);
Toast.makeText(getApplicationContext(),
"Authentication error: " + errString, Toast.LENGTH_SHORT)
.show();
}
@Override
public void onAuthenticationSucceeded(
@NonNull BiometricPrompt.AuthenticationResult result) {
super.onAuthenticationSucceeded(result);
Toast.makeText(getApplicationContext(),
"Authentication succeeded!", Toast.LENGTH_SHORT).show();
//Tracking event is sent on authentication success
Map<String, String> params = new LinkedHashMap<>();
params.put("ck2", "screen_name");
params.put("ck5", "biometric_login");
Webtrekk.getInstance().trackCustomEvent("click.button", params);
}
@Override
public void onAuthenticationFailed() {
super.onAuthenticationFailed();
Toast.makeText(getApplicationContext(), "Authentication failed",
Toast.LENGTH_SHORT)
.show();
}
};
Was this article helpful?