Automatic integration

Smartlook can be automatically integrated into Mixpanel like this:

val mixpanel = MixpanelAPI.getInstance(this, "YOUR TOKEN")
mixpanel.people.identify("sample_identifier")
...
Smartlook.enableIntegration(MixpanelIntegration(mixpanel))
MixpanelAPI mixpanel = MixpanelAPI.getInstance(this, "YOUR TOKEN");
mixpanel.people.identify("sample_identifier");
...
Smartlook.enableIntegration(new MixpanelIntegration(mixpanel));

📘

The user must be identified in Mixpanel for Smartlook automatic integration to work correctly.

A Smartlook visitor URL will be added as a new property called the Smartlook visitor dashboard URL into a Mixpanel user.

14591459

Manual integration

Smartlook can be easily integrated into Mixpanel using IntegrationListener:

Smartlook.registerIntegrationListener(object : IntegrationListener {
    override fun onSessionReady(dashboardSessionUrl: String) {
        val eventProperties = JSONObject()
            .put("Session url", dashboardSessionUrl)

        mixpanel.track("Smartlook session URL", eventProperties)
    }

    override fun onVisitorReady(dashboardVisitorUrl: String) {
        mixpanel.getPeople().set("Smartlook visitor URL", dashboardVisitorUrl)
    }
})
Smartlook.registerIntegrationListener(new IntegrationListener() {
    @Override
    public void onSessionReady(@NotNull String dashboardSessionUrl) {
        JSONObject eventProperties = new JSONObject();
        try {
            eventProperties.put("Session url", dashboardSessionUrl);
        } catch (JSONException exception) {
        }
        mixpanel.track("Smartlook session URL", eventProperties);
    }

    @Override
    public void onVisitorReady(@NotNull String dashboardVisitorUrl) {
        mixpanel.getPeople().set("Smartlook visitor URL", dashboardVisitorUrl);
    }
});

Full Mixpanel documentation with examples can be found on the official website.