MixPanel:在报告中显示为来宾的用户

Eya*_*ama 1 android mixpanel

我一直在尝试将Mixpanel集成到我的Android应用程序中.在跟踪事件等方面,事情很好,但问题是所有事件都记录在报告中的单个客户下.我在mixpanel.identify()and mixpanel.getPeople().identify()和我的代码上调用了identify(),如下所示:

    MixpanelAPI mixpanel = MixpanelAPI.getInstance(this, MIXPANEL_TOKEN);
    MixpanelAPI.People people = mixpanel.getPeople();
    people.identify("666");
    people.set("first_name", "john");
    people.set("last_name", "smith");

    JSONObject props = new JSONObject();
    try {
        props.put("Gender", "Male");
        props.put("Plan", "Premium");
    } catch (JSONException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }


    mixpanel.track("Plan selected", props);
    mixpanel.flush();       
Run Code Online (Sandbox Code Playgroud)

无论跟踪事件发送了多少次(即使我更改了标识的值并再次跟踪),所有事件都会以随机客户名称进行跟踪:访客#74352

use*_*536 5

如果要将事件与活动源中的用户名相关联,则需要使用$first_name$last_name(包括美元符号)作为属性.Android库不直接在流报告中支持名称标记,但您也可以通过mp_name_tag在事件中添加超级属性来获得名称.所以你可能希望你的代码看起来像这样:

MixpanelAPI mixpanel = MixpanelAPI.getInstance(this, MIXPANEL_TOKEN);
MixpanelAPI.People people = mixpanel.getPeople();

// Using the same id for events and people updates will let you
// see events in the people analytics activity feed.
mixpanel.identify("666"); 
people.identify("666");

// Add the dollar sign to the name properties
people.set("$first_name", "john");
people.set("$last_name", "smith");

JSONObject nameTag = new JSONObject();
try {
    // Set an "mp_name_tag" super property 
    // for Streams if you find it useful.
    nameTag.put("mp_name_tag", "john smith");
    mixpanel.registerSuperProperties(nameTag);
} catch(JSONException e) {
    e.printStackTrace();
}

JSONObject props = new JSONObject();
try {
    props.put("Gender", "Male");
    props.put("Plan", "Premium");
} catch (JSONException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
}

mixpanel.track("Plan selected", props);
mixpanel.flush(); 
Run Code Online (Sandbox Code Playgroud)