Automatic integration
Smartlook can be automatically integrated into Heap by using the following:
Heap.init(applicationContext, "MY ENV ID")
...
Smartlook.enableIntegration(HeapIntegration())
Heap.init(applicationContext, "MY ENV ID");
...
Smartlook.enableIntegration(new HeapIntegration());
enableIntegration
integration must be called after Heap is initialized.
A Smartlook visitor URL will be added as a new property called the Smartlook visitor dashboard URL into a Heap user.
Manual integration
Smartlook can be easily integrated into Heap using IntegrationListener
:
Smartlook.registerIntegrationListener(object : IntegrationListener {
override fun onSessionReady(dashboardSessionUrl: String) {
val props = mapOf("Session url" to dashboardSessionUrl)
Heap.track("Smartlook session URL", props)
}
override fun onVisitorReady(dashboardVisitorUrl: String) {
val props = mapOf("Smartlook visitor URL" to dashboardVisitorUrl)
Heap.addUserProperties(props)
}
})
Smartlook.registerIntegrationListener(new IntegrationListener() {
@Override
public void onSessionReady(@NotNull String dashboardSessionUrl) {
Map<String, String> props = new HashMap<>();
props.put("Session url", dashboardSessionUrl);
Heap.track("Smartlook session URL", props);
}
@Override
public void onVisitorReady(@NotNull String dashboardVisitorUrl) {
Map<String, String> props = new HashMap<>();
props.put("Smartlook visitor URL", dashboardVisitorUrl);
Heap.addUserProperties(props);
}
});
Full Heap API documentation can be found on the official website.