Automatic integration
Smartlook can be automatically integrated into Amplitude using the following:
val amplitudeInstance = Amplitude.getInstance().initialize(this, "YOUR_API_KEY")
...
Smartlook.enableIntegration(AmplitudeIntegration(amplitudeInstance))
AmplitudeClient amplitudeInstance = Amplitude.getInstance().initialize(this, "YOUR_API_KEY");
...
Smartlook.enableIntegration(new AmplitudeIntegration(amplitudeInstance));
The Smartlook visitor URL will be added as a new property called the Smartlook visitor dashboard URL into a Amplitude user.
Manual integration
Smartlook can be easily integrated into Amplitude using IntegrationListener
:
Smartlook.registerIntegrationListener(object : IntegrationListener {
override fun onSessionReady(dashboardSessionUrl: String) {
val eventProperties = JSONObject()
.put("Session url", dashboardSessionUrl)
Amplitude.getInstance().logEvent("Smartlook session URL", eventProperties)
}
override fun onVisitorReady(dashboardVisitorUrl: String) {
Identify identify = Indetify()
identify.set("Smartlook visitor URL", dashboardVisitorUrl)
Amplitude.getInstance().identify(identify)
}
})
Smartlook.registerIntegrationListener(new IntegrationListener() {
@Override
public void onSessionReady(@NotNull String dashboardSessionUrl) {
JSONObject eventProperties = new JSONObject();
try {
eventProperties.put("Session url", dashboardSessionUrl);
} catch (JSONException exception) {
}
Amplitude.getInstance().logEvent("Smartlook session URL", eventProperties);
}
@Override
public void onVisitorReady(@NotNull String dashboardVisitorUrl) {
Identify identify = new Indetify();
identify.set("Smartlook visitor URL", dashboardVisitorUrl);
Amplitude.getInstance().identify(identify);
}
});
Full Amplitude documentation with examples can be found on the official website.