Integration
Smartlook can be easily integrated into Mixpanel using User.Listener
and Session.Listener
// User URL integration
Smartlook.instance.user.listeners += object : User.Listener {
override fun onUrlChanged(url: URL) {
mixpanel.getPeople().set("Smartlook User dashboard URL", url.toString())
}
}
// Session URL integration
Smartlook.instance.user.session.listeners += object : Session.Listener {
override fun onUrlChanged(url: URL) {
val eventProperties = JSONObject()
.put("URL", url.toString())
mixpanel.track("Smartlook session", eventProperties)
}
}
// User URL integration
Smartlook.getInstance().getUser().getListeners().add(url -> {
mixpanel.getPeople().set("Smartlook User dashboard URL", url);
});
// Session URL integration
Smartlook.getInstance().getUser().getSession().getListeners().add(url -> {
JSONObject eventProperties = new JSONObject();
try {
eventProperties.put("URL", url);
} catch (JSONException exception) {
}
mixpanel.track("Smartlook session URL", eventProperties);
});
Full Mixpanel documentation with examples can be found on the official website.