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