【问题标题】:MixPanel: Users showing as guests in the reportMixPanel:用户在报告中显示为客人
【发布时间】:2013-07-19 03:41:21
【问题描述】:

我一直在尝试将 Mixpanel 集成到我的 Android 应用中。在跟踪事件等方面工作正常,但问题是所有事件都记录在报告中的单个客人下。 我在 mixpanel.identify()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();       

无论该跟踪事件被发送多少次(即使我更改了标识的值并再次跟踪),所有事件都在一个随机的来宾名称下进行跟踪:Guest #74352

【问题讨论】:

    标签: android mixpanel


    【解决方案1】:

    如果您想将事件与活动提要中的用户名相关联,您需要使用$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(); 
    

    【讨论】:

    • 感谢乔提供有用的超级财产提示!原来我遇到的问题是由于默认的人员过滤器设置为显示列表中没有人员的值...
    猜你喜欢
    • 2011-09-24
    • 1970-01-01
    • 2020-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-14
    • 1970-01-01
    相关资源
    最近更新 更多